9055 Commits

Author SHA1 Message Date
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
Joris de Groot
86b31e2954 Added storage not low as download requirement
Added monitoring storage levels in RequirementsWatcher
Added dependency on extension-workmanager to the demo app to be able to test with WorkManagerScheduler
Added getSupportedRequirements method to Scheduler interface
Implemented getSupportedRequirements for schedulers
2020-05-19 15:22:43 +02: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
andrewlewis
23f58b11e3 Fix typo
PiperOrigin-RevId: 312083761
2020-05-18 22:37:52 +01:00
andrewlewis
ea96ef828c Add release notes for issues fixed by preloading migration
PiperOrigin-RevId: 312080838
2020-05-18 16:14:45 +01:00
ibaker
9c8cd4b575 Add DRM data to AnalyticsCollectorTest
This requires lots of new DRM plumbing in FakeMedia{Period,Source} and
FakeSampleStream.

Part of issue:#6765

PiperOrigin-RevId: 312072332
2020-05-18 16:14:36 +01:00
bachinger
5b0e971f0e Make SingleSampleMediaSource provide a media item
This is part of go/exoplayer-playlist-retrieval which aims for all MediaSources to associate the media item to the corresponding window. Media items need to be added to the timeline which then assigns it to the window.mediaItem attribute.

PiperOrigin-RevId: 312065023
2020-05-18 16:14:28 +01:00
andrewlewis
ef615754db Fix handling of fetch errors for post-rolls
The ad break time in seconds from IMA was "-1" for postrolls, but this didn't
match C.TIME_END_OF_SOURCE in the ad group times array.

Handle an ad break time of -1 directly by mapping it onto the last ad group,
instead of trying to look it up in the array.

PiperOrigin-RevId: 312064886
2020-05-18 16:14:19 +01:00
ibaker
786edf8ecd Tweak DefaultDrmSession acquire & release event behaviour
The new behaviour:
- If the session is successfully opened, an acquire event is dispatched
  to all attached dispatchers.
- If acquire() is called but the session is already open, the acquire
  event is dispatched only to the dispatcher provided in to acquire()
- If the session is successfully released, a release event is dispatched
  to all attached dispatchers (in theory at most one should ever be
  attached at this point).
- If release() is called but the session isn't released (because
  referenceCount > 0) then a release event is dispatched only to the
  dispatcher provided to release().

PiperOrigin-RevId: 312062422
2020-05-18 16:14:10 +01:00
olly
b667a0e7e2 Rename closed caption variables to be non-608 specific
This is the rename-only part of https://github.com/google/ExoPlayer/pull/7370

PiperOrigin-RevId: 312057896
2020-05-18 16:14:01 +01:00
samrobinson
cda9417aa6 Allow MP3 files to play with size greater than 2GB.
Issue:#7337
PiperOrigin-RevId: 312042768
2020-05-18 16:13:52 +01:00
ibaker
8188c29279 Shorten the string form of AnalyticsCollectorTest internal objects
This makes test failures with lists of items much easier to read

PiperOrigin-RevId: 312035040
2020-05-18 16:13:43 +01:00
andrewlewis
ceddc60296 Publish MediaCodec-based renderer tests
Switch to snapshot Robolectric to pick up the latest version of shadows
required by MediaCodecVideoRendererTest and MediaCodecAudioRendererTest.

PiperOrigin-RevId: 312030332
2020-05-18 16:13:34 +01:00
aquilescanta
f6d0e34cea Fix Extractor.read throws documentation
PiperOrigin-RevId: 311755157
2020-05-18 16:13:25 +01:00
andrewlewis
793f12da6d Add support for timing out ad preloading
Detect stuck buffering cases in ImaAdsLoader, and discard the ad group after
a timeout. This is intended to make the IMA extension more robust in the case
where an ad group unexpectedly doesn't load.

The timing out behavior is enabled by default but apps can choose to retain
the old behavior by setting an unset timeout on ImaAdsLoader.Builder.

PiperOrigin-RevId: 311729798
2020-05-18 16:13:15 +01:00
tonihei
f3d331c9f7 Extend EventTime with full current position info.
EventTime contains information about when an event happened and where
it belongs to. Both places can be fully described using timeline, window
index, media period id and position.

Right now, only the information for where the event belongs to is fully
contained in EventTime, whereas the time when the event happened only has
the position, and none of the other information (timeline, window, period).

This change adds the missing information, so that the EventTime can easily
be used without having access to the Player. This also ensures Event
metadata is self-contained and can be stored and reused later.

issue:#7332
PiperOrigin-RevId: 311727004
2020-05-18 16:13:06 +01:00
christosts
78c850a885 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: 311703988
2020-05-18 16:12:57 +01:00
Tamás Varga
e4cb74057a add ability to interrupt HLS chunk download 2020-05-18 13:41:07 +02:00