3314 Commits

Author SHA1 Message Date
olly
4abaaf138c Remove DownloadConstructorHelper
Something that helps a constructor always seemed a bit strange.
It's now possible to use CacheDataSource.Factory directly instead.

PiperOrigin-RevId: 307661930
2020-04-27 10:39:34 +01:00
olly
722a5b2279 Move PriorityTaskManager inside CacheDataSource
In the same way it made sense to tie CacheKeyFactory and CacheDataSource
together in
7ea83d7167,
it makes sense to tie the PriorityTaskManager to the CacheDataSource as
well. This prevents error prone scenarios where one can end up being
passed around without (or with the wrong instance of) the other.

This change also internalizes use of PriorityDataSource directly into
CacheDataSource, rather than requiring the caller to chain things
themselves.

PiperOrigin-RevId: 307647290
2020-04-27 10:38:46 +01:00
olly
fab8087472 Sanitize CacheDataSource/CacheDataSink factories
PiperOrigin-RevId: 307636959
2020-04-27 10:19:33 +01:00
aquilescanta
7839955f31 Separate encryption data into a new TrackOutput method
Allows media parser to populate crypto data.

PiperOrigin-RevId: 307616083
2020-04-27 10:19:13 +01:00
olly
1ab5923f27 Fix nullness checker warnings
PiperOrigin-RevId: 307570994
2020-04-27 10:19:03 +01:00
gyumin
118f0b3938 Prevent StreamVolumeManager from being released twice
PiperOrigin-RevId: 307534335
2020-04-27 10:18:52 +01:00
ibaker
eb8c174b4c Update WebVttCueParser to parse position alignment values
Currently we assume these are "start", "center", "middle" or "end",
which was correct in a previous draft of the spec:
https://www.w3.org/TR/2014/WD-webvtt1-20141111/#dfn-webvtt-text-position-cue-setting

The released spec uses "line-left", "center" and "line-right":
https://www.w3.org/TR/webvtt1/#webvtt-position-cue-setting

PiperOrigin-RevId: 307371066
2020-04-20 13:29:44 +01:00
andrewlewis
ccdd1a43c2 Fix AdsMediaSource child sources not being released
Also add unit tests for AdsMediaSource.

PiperOrigin-RevId: 307365492
2020-04-20 13:29:23 +01:00
andrewlewis
02af670a0f Fix gapless playback
Audio processors are now flushed twice after reconfiguration.
The second flush call cleared the pending trim start bytes so
transitions between tracks were no longer gapless.

Fix this by removing logic to clear pending trim bytes on flush.
As a result we may trim data incorrectly if there is a flush
before any data has been handled for seeking to a non-zero
position, but this edge case will happen rarely and the effect
shouldn't be noticeable.

PiperOrigin-RevId: 307344357
2020-04-20 13:29:14 +01:00
bachinger
8ea33e2315 Support ad tag with default media source
This is the missing attribute to support all features of the Sample with MediaItem. Hence PlayerActivity can use the setMediaItems() method directly without creating actual media sources in the app code.

PiperOrigin-RevId: 307102036
2020-04-20 13:28:56 +01:00
olly
7ea83d7167 Better tie injection of Cache/CacheDataSource/CacheKeyFactory
PiperOrigin-RevId: 307056661
2020-04-20 13:28:38 +01:00
Oliver Woodman
704993ce7c Merge pull request #7210 from nebyan:CacheKeyFactoryNotUsed
PiperOrigin-RevId: 307045655
2020-04-20 13:28:27 +01:00
tonihei
7350981ef9 Use higher level interface for method parameters where possible.
This makes it easier to use the helper methods because the player doesn't
have to be assigned to a SimpleExoPlayer in all cases.

PiperOrigin-RevId: 307039126
2020-04-20 13:28:16 +01:00
ibaker
ece8d22357 Remove a suppression introduced by the checker-framework 3.3.0 upgrade
Update the comment on a suppression of Field.get(null) which is safe
but blocked by the checker.

These suppressions were introduced in d1e0572448

PiperOrigin-RevId: 307036441
2020-04-20 13:28:07 +01:00
tonihei
ca2105d50c Wait with throwing stuck buffering error until pending load is finished
We currently check for shouldContinueLoading, which is the intention to load,
not playbackInfo.isLoading, which is the actual loading state, when detecting
stuck buffering issues.

They only differ if the LoadControl said stop loading (based on nextLoadPosition),
but there is still a load in flight (updating bufferedPosition). This may cause
the exception to be thrown in edge cases that are only temporary.

PiperOrigin-RevId: 307022608
2020-04-20 13:27:57 +01:00
bachinger
abadc76872 Merge pull request #7245 from Clement-Jean:silence-media-source-factory
PiperOrigin-RevId: 307010600
2020-04-17 10:44:42 +01:00
andrewlewis
efaa98eecf Fix TeeAudioProcessor sink configuration
TeeAudioProcessor needs to configure its sink when it is initially set up.

PiperOrigin-RevId: 306808871
2020-04-17 10:44:24 +01:00
bachinger
d7280f096f Add custom cache key to media item
This is required to migrate the PlayerActivity away from Sample to MediaItem. It hence needs adding buildUpon to MediaItem to mix in the customCacheKey and streamKeys before playback.

PiperOrigin-RevId: 306710643
2020-04-17 10:44:16 +01:00
Clement Jean
3c655981d4 Add tag and Factory to SilenceMediaSource 2020-04-16 22:28:48 +08:00
christosts
91690f06ed Add Clock#currentTimeMillis()
PiperOrigin-RevId: 306602043
2020-04-15 17:42:19 +01:00
tonihei
823419761f Allow custom playback session id generator.
This allows users to inject their own session id logic.

PiperOrigin-RevId: 306597785
2020-04-15 17:42:19 +01:00
olly
6cff8a6ad0 Don't select trick-play tracks by default
Issue: #6054
Issue: #474
PiperOrigin-RevId: 306504362
2020-04-15 17:42:18 +01:00
olly
66f1c04445 Fix capabilities check for low frame-rate content
Issue: #6054
Issue: #474
PiperOrigin-RevId: 306437452
2020-04-15 17:42:18 +01:00
tonihei
6a491e1294 Verify MediaSources passed to set/addMediaSources are non-null.
Even though they are annotated as non-null, Java users can pass in null values.
So we should verify the input to fail fast.

PiperOrigin-RevId: 306425487
2020-04-15 17:42:18 +01:00
olly
d1e0572448 Suppress warnings in preparation for Checker Framework 3.3.0 upgrade.
PiperOrigin-RevId: 305810757
2020-04-15 17:36:11 +01:00
gyumin
e250900a57 Add mute/unmute to DeviceComponent
PiperOrigin-RevId: 305648273
2020-04-09 16:43:54 +01:00
nebyan
a944b5cc4c CacheKeyFactory is not used. 2020-04-09 14:34:00 +03:00
gyumin
dbfb6b183c Implement DeviceComponent of SimpleExoPlayer
PiperOrigin-RevId: 305460260
2020-04-08 21:48:27 +01:00
christosts
7504ce763e Add QoePingStore and QoePingItem
This is the first CL for the offline qoe reporting
feature. Refer to the design doc for full information.

Design doc: go/exoplayer-offline-qoe

PiperOrigin-RevId: 305459231
2020-04-08 21:48:18 +01:00
christosts
e7fd6a0e01 SimpleExoplayer Builder for testing
Create a Builder that creates SimpleExoPlayer instances with fake
components, suitable for testing.

Basically extracts the Builder from ExoPlayerTestRunner to a standalone
class that can be re-used.

PiperOrigin-RevId: 305458419
2020-04-08 21:48:08 +01:00
bachinger
4e2a0f6032 simplify PlayerActivity towards using the media item only
PiperOrigin-RevId: 305300409
2020-04-08 21:47:48 +01:00
bachinger
8f24db73f1 rename Playlist to MediaSourceList
This CL is a renaming only. It's mostly about finding a decent naming for the internal Playlist class. The plan is to have a public Playlist class in the converged Player API, so we need to rename the internal one.

PiperOrigin-RevId: 305266196
2020-04-07 17:07:20 +01:00
olly
07f059116b Clean up AudioFocusManagerTest
PiperOrigin-RevId: 305235961
2020-04-07 13:39:39 +01:00
olly
20cadd6e04 Audio focus: Restore full volume if focus is abandoned when ducked
If we're in the ducked state and updateAudioFocus is called with a
new state for which focus is no longer required, we should restore
the player back to full volume.

Issue: #7182
PiperOrigin-RevId: 305232155
2020-04-07 13:39:30 +01:00
ibaker
5a7dbae18c Use Android's Color.argb() and Color.rgb() methods in ColorParser
PiperOrigin-RevId: 305216138
2020-04-07 13:39:22 +01:00
ibaker
8df6a4b301 Remove nullness warning suppressions from Matcher.group
These were introduced in c7164a30a0

In each case I checked that the groups are not optional,
so if they match they must be non-null.

PiperOrigin-RevId: 305213293
2020-04-07 13:39:13 +01:00
olly
8d2bc7d182 Audio focus: Re-request audio focus if in a transient loss state
This avoids cases where audio focus is never successfully acquired
because another app is holding on to transient audio focus indefinitely.

Issue: #7182
PiperOrigin-RevId: 305108528
2020-04-07 13:38:42 +01:00
andrewlewis
dc813eca41 Fix stuck ad playbacks with DRM-protected content
When ClippingMediaPeriod first tried to read a buffer, if its end
position was before the end of the stream and it was buffered to its end
position, it would sometimes erroneously signal end-of-stream for
protected content because the sample queue might be waiting for DRM keys
at this point.

Work around the issue temporarily by signaling this specific case back
to ClippingMediaPeriod via the DecoderInputBuffer.

There will likely be a cleaner fix as a result of adding support for
dynamic clip end points in the future, at which point this can be
reverted.

issue:#7188
PiperOrigin-RevId: 305081757
2020-04-07 13:38:33 +01:00
Oliver Woodman
8991586c3b Merge pull request #7034 from TiVo:p-exception-unreported-discontinuity
PiperOrigin-RevId: 305006564
2020-04-06 13:28:40 +01:00
kimvde
c13f41af0d Remove deprecated members in DefaultTrackSelector
PiperOrigin-RevId: 304986313
2020-04-06 13:28:28 +01:00
bachinger
fc785871b3 add start and end position to media item
PiperOrigin-RevId: 304795753
2020-04-06 13:28:18 +01:00
olly
8583cd92c7 Suppress warnings in preparation for Checker Framework 3.2.0 upgrade.
In particular, replace @SuppressWarnings("initialization") with
@SuppressWarnings("nullness"); see
https://github.com/typetools/checker-framework/issues/3212.

More information: go/checker-lsc

Tested:
    TAP train for global presubmit queue
    http://test/OCL:304697666:BASE:304680497:1585968008044:f0c4fd6c
PiperOrigin-RevId: 304751415
2020-04-06 13:28:07 +01:00
ibaker
bdffab1200 Support multiple <rt> nodes inside <ruby> in WebVTT
This is supported (despite what my now-deleted comment says), see the
example here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/rt

PiperOrigin-RevId: 304612099
2020-04-06 13:27:48 +01:00
olly
fb0330d4db Propagate playback position through LoadControl shouldContinueLoading.
PiperOrigin-RevId: 304420177
2020-04-06 13:27:37 +01:00
bachinger
fe013979c2 use an unmodifiable map with a copy of the license request headers
PiperOrigin-RevId: 304356504
2020-04-06 13:27:16 +01:00
ibaker
f3c7c88d7c Tweak Cue.line javadoc again to reflect WebVTT spec
It's interesting WebVTT explicitly handles line & position differently
in horizontal-rl/lr and vertical-lr/rl contexts. position is always
measured from the left of the viewport, even for rtl text, but line in
vertical-rl is measured from the right of the viewport.

We don't have to make Cue match WebVTT (I can go change the WebVTT
decoding instead) but it seems a reasonable 'default' to follow.

PiperOrigin-RevId: 304353900
2020-04-06 13:26:40 +01:00
bachinger
dc4118da7b add clearTrackTypes and playClearContentWithoutKey to DrmConfiguration
With these additional properties, we can declare the behaviour for clear tracks and clear content on a media item level.

PiperOrigin-RevId: 304351716
2020-04-06 13:26:29 +01:00
kimvde
c9a89bee1c Remove thread checks in player constructor
SimpleExoPlayer instances don't have to be created from the application
thread.

PiperOrigin-RevId: 304190901
2020-04-01 22:39:03 +01:00
ibaker
8cb7907e71 Expand Cue.line and Cue.position javadoc to cover vertical text
PiperOrigin-RevId: 304164078
2020-04-01 22:38:36 +01:00
aquilescanta
41853169a7 Remove loadTaskId to Loader.Callback
Partial rollback of ca799716b8. We'll have to plumb
the id manually, like the rest of the LoadEventInfo
members.

PiperOrigin-RevId: 304067761
2020-04-01 22:37:43 +01:00