9055 Commits

Author SHA1 Message Date
Steve Mayhew
1f11233ba0 Support implicit i-Frame initialization segment.
In the HLS Spec (https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-04#section-4.4.3.6), specifically this or condition of this statement:

"... defined by the EXT-X-MAP tag, or is located between the start of the resource
    and the offset of the first I-frame segment in that resource."

Change adds code to add this "implicit" Media Initialization Segment if no EXT-X-MAP defines one explicitly.
2020-03-17 17:18:18 -07:00
Steve Mayhew
64cd4383ad Default to not select iFrame oly tracks.
Pull in change to default to not use i-Frames for base AdaptiveTrackSelection.
The expectation is a subclases, that support transitioning to iFrame, will select these tracks.
2020-03-17 16:31:49 -07:00
Steve Mayhew
33667ebc8c Add basic unit test for parsing. 2020-03-17 16:31:48 -07:00
Steve Mayhew
f9151dfe23 Update to include iframe Variants in same TrackGroup
This was a change suggested by @ojw28 to allow adpative track selection to work with IFrame only `Variant` as any other adaptive seleted `Track` in the `TrackGroup`.  This actually works quite well with the exceptions that:

1. IFrame only tracks do not contain the same Rendition Group references as other non-iframe only varaints (so track selection should disable these tracks even in other non-video renderers.
2. Adapting to iFrame tracks only based on bandwidth might not be so good (as often larger spacial resolution iFrame track might have higher bitrate then lower spacial resolution non-iframe only track).

This change includes one proposed workaround in the AdaptiveTrackSelection class (only use iFrame for higher playback speeds).
2020-03-17 16:31:48 -07:00
Steve Mayhew
f076a5ebd6 IFrame only exposed as a video track.Plays correctly 2020-03-17 14:32:51 -07:00
Matthias Tamegger
8017118ef1 Extend FrameworkMediaDrm to support PSSHv1 on Amazon FireTV Gen1/Gen2/Stick Gen1/Stick Gen2 2020-03-17 12:33:16 +01:00
Matthias Tamegger
2f2fc8ca01 Update media timestamp regex to allow negative values 2020-03-17 11:28:58 +01:00
Steve Mayhew
ccf2ba3e1b Move HlsSampleQueue to be static inner-class
Backout making the original `FormatAdjustingSampleQueue` an outer class and combining the new timestamp checking logic.  This way the diff from `HlsSampleStreamWrapper` to dev-v2 are easier to see.
2020-03-16 13:51:22 -07:00
Steve Mayhew
0d46e24f94 Update comments for DASH
Update the comment to indicate the DASH equivalent use case for the exception.
2020-03-16 11:53:49 -07:00
Steve Mayhew
e690979d92 Update with first round of code review suggestions
Update with code review suggestions:
1. rename to HlsCheckedSampleQueue to HlsSampleQueue and combine with format adjusting class.
2. Copywrite in added classes
3. Capture additional items useful for recovery and reporting in the exception class
4. Remove extraneous logging
5. eliminate magic number (50 seconds) and use percentage of duration

WIP:
 - eliminate null check for chunk (chunkless prepare starts load before sampleQueue are created)
 - work out recovery strategy
2020-03-13 09:59:27 -07:00
Steve Mayhew
f78cbd2c9e Add HlsCheckedSampleQueue to check timstamp range
Add a SampleQueue subclass that checks the timestamp range of media samples queued to it and reports an exception on load if the timestamp is outside of spec bounds.
(Smashed to a single commit prior to rebase)
2020-03-12 14:34:41 -07:00
tonihei
7b82a3c889 Rollback of 5485133e5c
*** Original commit ***

Rollback of 949bbcfb2e

*** Original commit ***

Add masking for playWhenReady.

Masking is needed as soon as updates to a value can happen both in EPI
and EPII. PlayWhenReady is currently not masked because all updates
happen in EPI only. As soon as we allow pausing at certain times
(e.g. end of a stream), playWhenReady c...

***

PiperOrigin-RevId: 300330307
2020-03-11 16:27:58 +00:00
Oliver Woodman
b46f64ab70 Merge pull request #7064 from davibe:enhancement/6907
PiperOrigin-RevId: 300330109
2020-03-11 16:27:47 +00:00
Oliver Woodman
0175dd4441 Merge pull request #7057 from Chimerapps:dash_assetidentifier
PiperOrigin-RevId: 300313753
2020-03-11 16:27:36 +00:00
tonihei
5485133e5c Rollback of 949bbcfb2e
*** Original commit ***

Add masking for playWhenReady.

Masking is needed as soon as updates to a value can happen both in EPI
and EPII. PlayWhenReady is currently not masked because all updates
happen in EPI only. As soon as we allow pausing at certain times
(e.g. end of a stream), playWhenReady changes may be triggered by EPII
as well and that's why we need masking.

To know when the value actually changed, we also need to update the
internal state to include whether playback is supppressed.

***

PiperOrigin-RevId: 300303307
2020-03-11 16:27:25 +00:00
tonihei
949bbcfb2e Add masking for playWhenReady.
Masking is needed as soon as updates to a value can happen both in EPI
and EPII. PlayWhenReady is currently not masked because all updates
happen in EPI only. As soon as we allow pausing at certain times
(e.g. end of a stream), playWhenReady changes may be triggered by EPII
as well and that's why we need masking.

To know when the value actually changed, we also need to update the
internal state to include whether playback is supppressed.

PiperOrigin-RevId: 300284613
2020-03-11 16:27:16 +00:00
olly
f82bc244ea Add show/hideScrubber to DefaultTimeBar
PiperOrigin-RevId: 300249371
2020-03-11 16:27:07 +00:00
tonihei
c6e8e24ada Ensure seek and prepare positions never exceed period duration.
Exceeding the period duration may mean that that playback transitions
to another item even if the player is currently paused.

PiperOrigin-RevId: 300133655
2020-03-11 16:26:59 +00:00
tonihei
bb33d568ca Remove test-specific ActionSchedule tags
There is no need for that, updating them is often forgotten and
takes up too much line space. Replace by a single TAG per test class.

PiperOrigin-RevId: 300113072
2020-03-11 16:26:50 +00:00
olly
0d230d517a Miscellaneous cleanup related to recent changes
PiperOrigin-RevId: 300067561
2020-03-11 16:26:41 +00:00
olly
b83041a6f5 Fix SubtitleView.ViewType IntDef
PiperOrigin-RevId: 300067502
2020-03-11 16:26:33 +00:00
bachinger
a5f0eb1e10 replace extension with mime type
This change uses mime types in a functionally equivalent way to how we used the extension hint so far.

Using a mimeType instead of the extension has some advantages. Most importantly mimeTypes are used by the cast SDK with which we want to achieve interoperability in the cast extension.

Using a mimeType instead of the extension hint further appears to be a bit more clear (which might be opinionated). Further mime types are a well known and widely used concept to identify file type on the internet and it provides asterix based generalizations (audio/*, */*) which could express the media type OTHER that ExoPlayer is using internally (no usage of asterix required so far though).

PiperOrigin-RevId: 300058945
2020-03-11 16:26:23 +00:00
bachinger
87405cb1c0 remove DefaultMediaSourceFactory.Delegate
PiperOrigin-RevId: 299943596
2020-03-10 10:21:37 +00:00
krocard
fdf35776f8 Add support for x86_64 for the ffmpeg extension
Requested by https://github.com/google/ExoPlayer/issues/7058.
Additionally move one of the common option in COMMON_OPTIONS.

PiperOrigin-RevId: 299862479
2020-03-10 10:21:29 +00:00
samrobinson
c976d16a74 Simplify WakeLockManager and WifiLockManager logic.
Disabling reference counting allows some checks to be removed.

This is a no-op.

PiperOrigin-RevId: 299829600
2020-03-10 10:21:20 +00:00
tonihei
1c03226fb3 Merge AudioFocusManager methods to simplify control flow.
handlePrepare/Stop/SetPlayReady can be merged together as they all
handle changes to the desires state of the player.

Also, simplify parts of the control flow by not mixing code that
determines if audio focus needs to be handled with code that actually
acquires or abandons the focus.

PiperOrigin-RevId: 299824857
2020-03-10 10:21:12 +00:00
olly
1ac7d377a6 Fix proguard comment for DefaultMediaSourceFactory
PiperOrigin-RevId: 299819656
2020-03-10 10:21:03 +00:00
tonihei
0a89d0e8c3 Add option to MergingMediaSource to adjust for period time diffs
Without this option it's impossible to merge periods covering
different timestamps (at least not without playback issues).

Issue:issue:#6103
PiperOrigin-RevId: 299817540
2020-03-10 10:20:55 +00:00
bachinger
041a0696b7 remove UriBundle
PiperOrigin-RevId: 299361095
2020-03-10 10:20:47 +00:00
Oliver Woodman
26d3914e43 Merge pull request #7051 from Cizor:dev-v2
PiperOrigin-RevId: 299357049
2020-03-10 10:20:37 +00:00
kimvde
c982f4c4a0 Add possibility to set the audio session id
Issue: #6975
PiperOrigin-RevId: 299328798
2020-03-10 10:20:27 +00:00
ibaker
ab21f710bb Add MediaSource.{add,remove}DrmEventListener
Pre-work for issue:#6765

PiperOrigin-RevId: 299322086
2020-03-10 10:20:18 +00:00
ibaker
c6bf6aae2a Rename DefaultDrmSessionEventListener to DrmSessionEventListener
Part of issue:#6765

PiperOrigin-RevId: 299319146
2020-03-10 10:20:10 +00:00
ibaker
eeab811301 Add EventDispatcher to DrmSession(Manager) acquire & release calls
This is passed in but not currently used. I'll use it in follow-up
changes.

Pre-work for issue:#6765

PiperOrigin-RevId: 299314341
2020-03-10 10:20:01 +00:00
krocard
1f4156ce6d Restore the demo list position on start
It's quite anoying to have to search in the list
the last item played everytime the demo is restarted.

Fix that by saving and restoring it.

PiperOrigin-RevId: 299109261
2020-03-10 10:19:53 +00:00
aquilescanta
47b62e8c02 DataReader: replace InterruptedException with InterruptedIOException
PiperOrigin-RevId: 299092243
2020-03-10 10:19:45 +00:00
christosts
fbf865726c Fix flaky AsynchronousMediaCodecAdapterTest
PiperOrigin-RevId: 299057572
2020-03-10 10:19:36 +00:00
bachinger
4517829610 add DefaultMediaSourceFactory and use it in PlayerActivity
PiperOrigin-RevId: 298879027
2020-03-10 10:19:27 +00:00
tonihei
b5976a55ff Upgrade Kotlin annotations and fix gradle warnings
The new version fixes some warnings in Gradle builds. Also
add missing indirect compileOnly dependencies to fix some more warnings

Issue:issue:#7007
PiperOrigin-RevId: 298855510
2020-03-10 10:19:19 +00:00
tonihei
05443d1e9e Upgrade gradle plugin to 3.6.0
PiperOrigin-RevId: 298844826
2020-03-10 10:19:11 +00:00
tonihei
0339a33430 Rename EPII.copyWithNewPosition to handlePositionDiscontinuity
The new name better reflects the purpose of the method.

PiperOrigin-RevId: 298835578
2020-03-10 10:19:02 +00:00
tonihei
8b9f7c5628 Add test to ensure AdsLoader is initialized.
This tests explicitly that initialization happens even if the Timeline
is a placeholder.

No other change is needed. While the Timeline is still a placeholder
ImaAdsLoader.getCurrentPeriodPosition will return 0 and trigger
pre-rolls (intended behaviour) and it doesn't matter whether the
actual initial period position may be somewhere else.

PiperOrigin-RevId: 298833867
2020-03-10 10:18:54 +00:00
aquilescanta
2b88961bc1 Add ExoMediaDrm.OnExpirationUpdateListener
Which mirrors MediaDrm.OnExpirationUpdateListener.

PiperOrigin-RevId: 298826713
2020-03-10 10:18:46 +00:00
tonihei
61935e14bf Add option to pause at end of stream to ExoPlayerImplInternal
This option marks streams as final such that renderers play them out
completely, then waits until this happened, and then sets the player
to paused. After that, the player can continue to read the next period
to quickly resume playback if needed.

PiperOrigin-RevId: 298824745
2020-03-10 10:18:37 +00:00
ibaker
e88e889c95 Extract MediaSourceEventDispatcher from MediaSourceEventListener
Update it to allow any listener class to be registered (and thus
require the caller of dispatch() to provide the type of listener
to call).

Maintain MediaSourceEventListener.EventDispatcher as a sub-class
for now so that all existing references continue to work. This
avoids creating a huge diff in one CL. The intention is to in-line
these incrementally.

This is pre-work for issue:#6765

PiperOrigin-RevId: 298818198
2020-03-10 10:18:29 +00:00
kimvde
f204e4df7d Add setCoreFlacExtractorFlags on DefaultExtractory
PiperOrigin-RevId: 298816694
2020-03-10 10:18:21 +00:00
andrewlewis
470ec9e5d1 Init the ads manager for placeholder timelines
It looks like loading ad cue points would cause a source info refresh
causing the content media period load to be canceled, meaning we would
never get a non-placeholder timeline.

This changes ensures that the ads manager will still be initialized,
avoiding playback getting stuck when playing a ProgressiveMediaPeriod
with a preroll ad.

PiperOrigin-RevId: 298814758
2020-03-10 10:18:13 +00:00
olly
d8ea1f60af Annotate tests to use Robolectric's LEGACY LooperMode.
The default Robolectric Looper simulation mode is changing to PAUSED from LEGACY.
The following tests fail in this new mode, and are thus being defaulted to LEGACY.

For more details see ​go/robolectric-legacy-looper-mode-lsc

Cleanup change automatically generated by error-prone refactoring
//third_party/android/androidx_test/tools/errorprone/java/androidx/test/tools/errorprone:LegacyLooperModeConverter_refactoring

Tested:
    TAP train for global presubmit queue
    http://test/OCL:297627974:BASE:298600828:1583273401491:7d94dbaa
PiperOrigin-RevId: 298809656
2020-03-10 10:18:05 +00:00
ibaker
63256a48d4 Disable text selection in SubtitleWebView
PiperOrigin-RevId: 298605366
2020-03-10 10:17:56 +00:00
krocard
58f42e9f8b Annotate render's read source result
So that swich case has a warning if all case are not
covered.

PiperOrigin-RevId: 298574013
2020-03-10 10:17:48 +00:00