8816 Commits

Author SHA1 Message Date
olly
cf726f0c60 Improve SimpleCacheTest
PiperOrigin-RevId: 313630376
2020-05-29 18:34:19 +01:00
olly
1cfb68bf68 Change order of RawCcExtractor init to call format before endTracks.
This fixes an issue where the output track's sample format is null for rawCC captions when endTracks method is called.

PiperOrigin-RevId: 313622631
2020-05-29 18:34:10 +01:00
bachinger
0c81022aaa Make HlsMediaSource add the media item to the timeline
PiperOrigin-RevId: 313605791
2020-05-29 18:34:01 +01:00
tonihei
37024ae450 Add named constant for group indices.
PiperOrigin-RevId: 313596831
2020-05-29 18:33:52 +01:00
tonihei
5c52915f0c Don't splice in if segments don't overlap and segments are independent.
If the sample times don't overlap and are independent, splicing makes no
difference because all samples (starting from the first one, which must be
a keyframe) will be appended to the end of the queue anyway.

PiperOrigin-RevId: 313594372
2020-05-29 18:33:43 +01:00
bachinger
a3b721e680 Make SsMediaSource add the media item to the timeline
PiperOrigin-RevId: 313573424
2020-05-29 18:33:34 +01:00
olly
a37374d5a7 Initial (and incomplete) 2.11.5 release notes
PiperOrigin-RevId: 313566474
2020-05-29 18:33:24 +01:00
tonihei
4419a26bbb Use assertThrows in CacheWriterTest.
PiperOrigin-RevId: 313556143
2020-05-29 18:33:15 +01:00
olly
a01fd007cb Change setOutputSurfaceV23 visibility.
PiperOrigin-RevId: 313481722
2020-05-29 18:33:06 +01:00
bachinger
f84bd4635a Replace manifest uri without changing the media item
We aim to have the same media item instance published in the timeline that is passed to the createMediaSource(mediaItem) method. This means when the manifest uri is manually replaced by a developer, the media item published in the next timeline update is still the same.

Note: This leads to the fact that the manifest published in that timeline is loaded from a different URI than the URI of the media item in the same timeline.
PiperOrigin-RevId: 313375421
2020-05-27 19:01:22 +01:00
Oliver Woodman
82e199445a Merge pull request #7422 from noamtamim:bandwidthmeter-5g
PiperOrigin-RevId: 313372995
2020-05-27 19:01:12 +01:00
aquilescanta
32c356177f Extract a ChunkExtractor interface
A future implementation will depend on MediaParser.

PiperOrigin-RevId: 313367998
2020-05-27 19:01:02 +01:00
olly
d88f5f47e6 Turn CacheUtil into stateful CacheWriter
- The new CacheWriter is simplified somewhat
- Blocking on PriorityTaskManager.proceed is moved out of
  CacheWriter and into the Downloader tasks. This is because
  we want to shift only the caching parts of the Downloaders
  onto their Executors, whilst keeping the blocking parts on
  the main Downloader threads. Else we can end up "using"
  the Executor threads indefinitely whilst they're blocked.

Issue: #5978
PiperOrigin-RevId: 313222923
2020-05-27 19:00:53 +01:00
ibaker
a1c72c0daf Add .inOrder() to most AnalyticsCollectorTest asserts
I skipped it where it didn't make sense (e.g. singleton lists, or lists
where all elements are identical).

PiperOrigin-RevId: 313217398
2020-05-27 19:00:44 +01:00
krocard
151ea531b1 Make constants more readable with _ separator
Add an `_` in long constants.
Eg: 10000 => 10_000.

I'm proposing this change because I have had multiple
missread due to confusing the number of 0 in a long number.

More specifically, added an underscore to all number matching:
`final.*\ [0-9]{2,}000;`

PiperOrigin-RevId: 313186920
2020-05-27 19:00:36 +01:00
tonihei
45b574d593 Fix flaky test.
The test was flaky because it didn't wait for pending commands to finish
after pausing the test playback.

Also add more debug information to the toString() method because the
expected and actual state only differed in the nextAdGroupIndex in the
flaky case.

PiperOrigin-RevId: 313175919
2020-05-27 19:00:27 +01:00
tonihei
0add067eaa Make fallback value more explicitly unset.
PiperOrigin-RevId: 313171970
2020-05-27 19:00:18 +01:00
olly
03ea39b175 ConditionVariable: Add uninterruptible block
Sometimes it's useful to be able to block until something on some other thread
"really has finished". This will be needed for moving caching operations onto
the executor in Downloader implementations, since we need to guarantee that
Downloader.download doesn't return until it's no longer modifying the
underlying cache.

One solution to this is of course just to not interrupt the thread that's
blocking on the condition variable, but there are cases where you do need to do
this in case the thread is at some other point in its execution. This is true
for Downloader implementations, where the Download.download thread will also
be blocking on PriorityTaskManager.proceed. Arranging to conditionally
interrupt the thread based on where it's got to is probably possible, but seems
complicated and error prone.

Issue: #5978
PiperOrigin-RevId: 313152413
2020-05-27 19:00:09 +01:00
tonihei
ee11d9d6fb Make manifest loads on timeline refresh optional in FakeMediaSource.
Every timeline refresh currently assumes that it corresponds to a manifest
refresh and issues the respective load events. However, there are other
timeline updates that don't have a manifest refresh (e.g. ad state updates)and thus shouldn't issue these events.

PiperOrigin-RevId: 313150489
2020-05-27 19:00:00 +01:00
tonihei
f099f570e6 Update TrackSelectionDialogBuilder to use androidx compat Dialog.
This ensure style themes are correctly applied.

issue:#7357
PiperOrigin-RevId: 313145345
2020-05-27 18:59:51 +01:00
andrewlewis
eddc2b0b33 Enable multidex for demos
This is necessary now we have Guava in debug (no-minified) apps.

Also switch to AndroidX multidex to remove the support library dependency.
Temporarily we need to add an Application class, as internal jetification
doesn't seem to handle declaring MultiDexApplication in AndroidManifest.xml.

issue:#7421
PiperOrigin-RevId: 313145023
2020-05-27 18:59:43 +01:00
ibaker
1f125425a8 Add Guava dep to exo-workmanager module
This fixes the "cannot access ListenableFuture" build error, even though
it seems on the surface like we shouldn't need a Guava dependency here.

There's more info about what's going on here:
https://blog.gradle.org/guava

PiperOrigin-RevId: 312712991
2020-05-27 18:59:31 +01:00
Noam Tamim
cf2214ddaa
Assume default 4G (instead of Wifi) bitrate for 5G 2020-05-24 15:20:18 +03:00
tonihei
dac3dde7bb Fix comparison in ChunkSampleStream.
A recent change tried to make this condition clearer by using Integer.MAX_VALUE, but
this only works if the comparison also compares against larger values.

PiperOrigin-RevId: 312697530
2020-05-21 18:43:13 +01:00
tonihei
80eb5d4235 Merge pull request #7244 from tvarga-dss:cancel-hls-chunk-download-and-discard-upstream
PiperOrigin-RevId: 312679454
2020-05-21 17:10:51 +01:00
tonihei
d487170eb0 Comment out unused code.
The code that uses these variables is already commneted out. Android Studio
complains about unused variables and code and it's better to comment them
out as long as they are not used.

PiperOrigin-RevId: 312660512
2020-05-21 17:10:40 +01:00
bachinger
2d52b0d5cf Add createMediaSource method with manifest and media item
This change adds an overloaded createMediaSource method which allows developers to pass in a media item with a in-memory manifest. Without this method the developer would not have a chance to pass in a non-dummy media item when using the factory for creting a DASH media source with an in-memory manifest.

PiperOrigin-RevId: 312660418
2020-05-21 17:10:30 +01:00
andrewlewis
1bc8503a9b Check DefaultAudioSink supports passthrough
Previously if the AudioCapabilities reported that an encoding/channel count was
supported, DefaultAudioSink could try to play it via passthrough. However,
DefaultAudioSink does not support passthrough of every possible format (for
example, it's likely that AAC passthrough does not work given it's never been
tested and recent GitHub issues indicate that trying to use it leads to no
audio being played).

Add additional checks to make sure the encoding is in the list of encodings that
are known to work with passthrough in DefaultAudioSink.

issue:#7404
PiperOrigin-RevId: 312651358
2020-05-21 17:10:20 +01:00
olly
4384ef5b73 Make CacheUtil only about writing
A subsequent change will rename it to CacheWriter and make it instantiable.

Issue: #5978
PiperOrigin-RevId: 312648623
2020-05-21 17:10:11 +01:00
christosts
1154e8098a Rollback of 78c850a885
*** Original commit ***

Remove set timeout on release() and setSurface()

Removes the experimental methods to set a timeout when
releasing the player and setting the surface.

***

PiperOrigin-RevId: 312647457
2020-05-21 17:10:01 +01:00
bachinger
634634f8e3 Make DashMediaSource add the media item to the timeline
PiperOrigin-RevId: 312646461
2020-05-21 17:09:51 +01:00
olly
63522ea554 Improve CacheKeyFactory documentation
- To make it clear that cache keys are for whole resources
- To explicitly make it clear to implementors that deriving a cache key
  from position and length is invalid. We've seen at least one developer
  trying to do this [1], so it seems worthwhile to be explicit!

[1] https://github.com/google/ExoPlayer/issues/5978#issuecomment-618977036

Issue: #5978
PiperOrigin-RevId: 312643930
2020-05-21 17:09:41 +01:00
olly
03d9375872 Fix demo app persistent sample selection
It currently crashes if the samples change such that the persisted
position is no longer within bounds.

PiperOrigin-RevId: 312554337
2020-05-21 17:09:32 +01:00
ibaker
2397e7f67a Replace TestUtil.joinByteArrays() with Guava's Bytes.concat()
PiperOrigin-RevId: 312481058
2020-05-21 17:09:22 +01:00
samrobinson
9035f1d701 Update getPcmEncoding return type to PcmEncoding rather than Encoding.
PiperOrigin-RevId: 312479370
2020-05-21 17:09:12 +01:00
ibaker
02e74d6c94 Fix Guava deps from compileOnly to implementation
PiperOrigin-RevId: 312479354
2020-05-21 17:09:03 +01:00
olly
f38a1015ae Adding instructions on how to build and run ExoPlayer demo apps
Issue:#7338
PiperOrigin-RevId: 312470913
2020-05-21 17:08:53 +01:00
bachinger
d233c04582 Simplify DownloadHelper
PiperOrigin-RevId: 312467496
2020-05-21 17:08:43 +01:00
ibaker
b9157a9e23 Add Guava dependency to ExoPlayer
Guava is heavily optimized for Android and the impact on binary size
is minimal (and outweighed by the organic growth of the ExoPlayer
library).

This change also replaces Util.toArray() with Guava's Ints.toArray()
in order to introduce a Guava usage into a range of modules.

PiperOrigin-RevId: 312449093
2020-05-21 17:08:33 +01:00
olly
e87221c938 Add Cache.getCachedBytes
This will replace the need to use CacheUtil.getCached, and is part of refactoring
CacheUtil to only do writing (it will be renamed to CacheWriter in a subsequent
change).

PiperOrigin-RevId: 312366040
2020-05-21 17:08:24 +01:00
olly
a42a1f49ed Allow passing C.LENGTH_UNSET to getCachedLength
The caller will often have C.LENGTH_UNSET already, and
it's awkward to force them to do the conversion themselves.

PiperOrigin-RevId: 312276810
2020-05-21 17:08:14 +01:00
olly
1be295ab0c Fix SimpleCache.getCachedLength rollover bug & improve test coverage
PiperOrigin-RevId: 312266156
2020-05-21 17:08:04 +01:00
ibaker
6e02a81501 Cleanup WebvttCueParser and WebvttCssStyle
- Remove scratchStyleMatches output parameter from WebvttCueParser.
- Switch from String[] to Set<String> for representing classes.
- In-line WebvttCssStyle.reset() since it's not used anywhere else.

PiperOrigin-RevId: 312249552
2020-05-21 17:07:54 +01:00
olly
0de9c007af Fix naming to reflect that CEA-708 is supported too
PiperOrigin-RevId: 312131816
2020-05-18 22:39:51 +01:00
olly
be098401e9 Cache: Improve documentation and terminology
PiperOrigin-RevId: 312130813
2020-05-18 22:39:35 +01:00
aquilescanta
ba33f60485 Deprecate LoadErrorHandlingPolicy methods without loadTaskId
Issue: #7309
PiperOrigin-RevId: 312115330
2020-05-18 22:39:19 +01:00
olly
cccb9e1ae8 CacheUtil: Remove confusing remove(DataSpec) method
- The remove(DataSpec) method was confusing because it ignored
  the DataSpec position and range, and instead removed all data
  with a matching cache key.
- The remove(String) method seems better put directly on the
  Cache interface.

PiperOrigin-RevId: 312113302
2020-05-18 22:39:02 +01:00
ibaker
377bf27f47 Extend WebVTT ruby-position support to include <rt> tags
PiperOrigin-RevId: 312096467
2020-05-18 22:38:45 +01:00
ibaker
38fc7d8c0d Add WebVTT support for ruby-position CSS property
This is currently only parsed if the CSS class is specified directly on
the <ruby> tag (e.g. <ruby.myClass>)

PiperOrigin-RevId: 312091710
2020-05-18 22:38:29 +01:00
Oliver Woodman
3db703a983 Merge pull request #7370 from jruesga:embedded-cea-708-support
PiperOrigin-RevId: 312090461
2020-05-18 22:38:10 +01:00