8426 Commits

Author SHA1 Message Date
olly
cbe99ec475 Make SimpleDecoderXRenderers work with any Decoder implementation
The restriction that these classes only work with SimpleDecoders
is unnecessary. An FfmpegVideoRenderer will not be able to use a
SimpleDecoder, because the SimpleDecoder assumption that each input
buffer can be decoded immediately into a corresponding output is
not true for all video codecs that Ffmpeg supports (e.g., H264 does
not have this property). Generalizing SimpleDecoderVideoRenderer to
DecoderVideoRenderer will allow FfmpegVideoRenderer to still use
the base class, without having to use a SimpleDecoder.

This is a preliminary change toward being able to merge a version
of https://github.com/google/ExoPlayer/pull/7079.

Issue: #2159
PiperOrigin-RevId: 301412344
2020-03-19 00:49:58 +00:00
tonihei
a3a3b5be0b Add comment to clarify usage of constant.
PiperOrigin-RevId: 301406108
2020-03-19 00:49:50 +00:00
olly
5c4d4762d1 Remove unused dependency
PiperOrigin-RevId: 301397420
2020-03-19 00:49:42 +00:00
tonihei
9d5319d6ac Fix flaky test by slightly changing its setup.
The test is flkay (2/1000 runs) because the decoder initialization
before and after the seek are not perfectly deterministic. I couldn't
find a way to make them deterministic, so slightly chaning the test
setup instead. The test setup change doesn't affect the scenario being
tested.

PiperOrigin-RevId: 301390491
2020-03-19 00:49:34 +00:00
tonihei
363b4224b9 Fix stuck buffering problem caused by target buffer size of 0.
When no tracks are selected (or only tracks of unknown type), the
target buffer size is calculated to be 0. This means the player
won't request to buffer more data, nor can it start playback and
will be stuck forever.

PiperOrigin-RevId: 301374229
2020-03-19 00:49:26 +00:00
tonihei
71eec8ead1 Fix unrealistic FakeSampleStream.isReady
The FakeSampleStream is currently always ready even if it doesn't
have any samples to read. Fix that by checking for the conditions
under which read() will be successful.

PiperOrigin-RevId: 301371031
2020-03-19 00:49:18 +00:00
ibaker
cb414e8743 Change FakeRenderer to take a track type instead of a list of formats
The assertion about the expected formats doesn't really belong in a
fake, the assertions should be closer to the test method.

This gets in the way when I try and write a new test in
AnalyticsCollectorTest that doesn't use the expected, constant Format
(because i want to specify drmInitData) - but changing the expected
Format is tricky because it's hard-coded into the FakeVideoRenderer
inner class.

I replaced the assertion in FakeRenderer with assertions in test
methods that used to assert on the format count.

PiperOrigin-RevId: 301353072
2020-03-19 00:49:10 +00:00
ibaker
13ffb9c684 Add a comment explaining the null check in DefaultMediaItemConverter
Follow-up to 42b8fe2681

PiperOrigin-RevId: 301352557
2020-03-19 00:49:02 +00:00
kimvde
e962a478b9 Document missing messages in audio renderers
PiperOrigin-RevId: 301352482
2020-03-19 00:48:54 +00:00
olly
b7a5ace4be Make FfmpegLibrary H264/HEVC aware
Issue: #2159
PiperOrigin-RevId: 301351495
2020-03-19 00:48:46 +00:00
olly
235c631136 FfmpegAudioRenderer should use UNSUPPORTED_TYPE for non-audio formats
Issue: #2159
PiperOrigin-RevId: 301345559
2020-03-19 00:48:38 +00:00
ibaker
42b8fe2681 Fix null-check failure in DefaultMediaItemConverter
PiperOrigin-RevId: 301336818
2020-03-19 00:48:30 +00:00
bachinger
510f5edd1d Remove cast media item
PiperOrigin-RevId: 301224632
2020-03-19 00:48:22 +00:00
ibaker
5f8cc71d1b Use reference-counting for listeners from MediaSourceEventDispatcher
Previously calling removeListener would remove all instances of that
listener. Now it only removes a single instance.

This probably should have been part of introducing the Multiset:
2bd4d61b9b

PiperOrigin-RevId: 301191940
2020-03-19 00:48:14 +00:00
kimvde
aec6fe7e65 Notify listeners when audio session ID is set
PiperOrigin-RevId: 301187369
2020-03-19 00:48:05 +00:00
ibaker
354d5aea09 Add the listener type to MediaSourceEventDispatcher.add/removeListener
Without this change there's confusing behaviour if you pass e.g.
AnalyticsCollector (which implements both DrmSessionEventListener and
MediaSourceEventListener) to MediaSource.addEventListener: It will
receive DRM events too, even though you never passed it to
MediaSource.addDrmEventListener.

Also add some tests for MediaSourceEventDispatcher.

PiperOrigin-RevId: 301169915
2020-03-19 00:47:57 +00:00
olly
c294e0cb89 Clarify DataSpec.httpRequestHeaders documentation
Issue: #7069
PiperOrigin-RevId: 300738492
2020-03-19 00:47:49 +00:00
olly
3acc85c2df Re-split ExoHostedTest.onTestFinished into logMetrics and assertPassed
This is a partial revert of <unknown commit>. The split and the order is important. For
example, as things are currently, if playback fails for a test that makes additional
assertions in onTestFinished, the visible reason the test failed is quite likely to
be one of the additional assertions, rather than the error that actually caused the
playback to fail. I think we probably also don't want to log metrics if playback
fails.

PiperOrigin-RevId: 300733109
2020-03-19 00:47:41 +00:00
samrobinson
4a582b2361 Unit tests for WakeLockManager.
PiperOrigin-RevId: 300727785
2020-03-19 00:47:28 +00:00
tonihei
c16d0f6c5d Default prioritizeTimeOverSizeThresholds to false.
This prevents OOM errors for high bitrate streams that attempt to fill
the buffer regardless of the memory usage.

Also change the max buffer sizes to ensure this is a no-op for video
streams < 20Mbps and audio streams < 260kbps.

Issue:#6647
Issue:#7006
PiperOrigin-RevId: 300720299
2020-03-19 00:47:20 +00:00
andrewlewis
26a27944c5 Add option for sensor rotation in 360 playbacks
Issue: #6761
PiperOrigin-RevId: 300715682
2020-03-19 00:47:12 +00:00
bachinger
2028fdd756 add media item based playlist methods
After this change users of ExoPlayerImpl and SimpleExoPlayer can use the media item base playlist API which converts the media item to a media source.

It adds the media item based methods to the ExoPlayer instead of the Player interface. This avoids a big change in the CastPlayer which requires migrating the cast extension to the MediaItem of the core module (follow up CLs).

PiperOrigin-RevId: 300575567
2020-03-19 00:47:04 +00:00
bachinger
1e387601a6 update ExoPlayerTest to use get/setPlaybackSpeed
PiperOrigin-RevId: 300554337
2020-03-19 00:46:56 +00:00
olly
920117b081 Drop prefix test- from test methods under v2/library
This CL removes the prefixes to the tests added after a6d0caaa3c.

This CL is generated by following command
$ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/  public void \L\1\E\2/' {}

PiperOrigin-RevId: 300547504
2020-03-19 00:46:48 +00:00
ibaker
f08eed4145 Add DRM event plumbing to Playlist and CompositeMediaSource
Related to issue:#6765

PiperOrigin-RevId: 300539527
2020-03-19 00:46:40 +00:00
olly
beab272a8c Drop prefix test- from test methods under v2/playbacktests
This is one step toward following the google3's test naming convention.
See go/java-testing/getting_started#basic-test-template for details
why prefix test isn't necessary.

This CL is generated by following command
$ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/  public void \L\1\E\2/' {}

PiperOrigin-RevId: 300537212
2020-03-19 00:46:32 +00:00
olly
2f91c12f56 Drop prefix test- from test methods under v2/extensions
This is one step toward following the google3's test naming convention.
See go/java-testing/getting_started#basic-test-template for details
why prefix test isn't necessary.

This CL is generated by following command
$ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/  public void \L\1\E\2/' {}

PiperOrigin-RevId: 300530329
2020-03-19 00:46:24 +00:00
ibaker
2bd4d61b9b Use a Multiset for reference counting in MediaSourceEventDispatcher
This avoids duplicate events being dispatched to object foo if
addListener(foo) is called more than once.

Part of issue:#6765

PiperOrigin-RevId: 300529733
2020-03-19 00:46:15 +00:00
tonihei
4d4e2cdd2a Reorder renderer enabling/disabling
We currently have the following logic to update renderers during
period transitions:
 1. Wait for the currently reading period to finish reading all its
    streams.
 	a. Advance reading period.
	b. Set all streams that can't be replaced to final.
	c. If streams can be replaced, replace them now.
 2. Wait until playback position reaches the transition point
 	a. Disable all unneeded renderers (or those that need
           re-enabling).
	b. Advance playing period.
	c. Enable all new renderers (i.e. all except the ones where
           we replaced streams directly in step 1c.

This logic causes delays because steps 2a and 2c can easily happen
before 2b. Doing this allows a smooth transition for cases where
renderers change or where they need to be re-enabled.

The new order after this change is:
 1. Wait for currently reading period to finish reading.
	a. Advance reading period.
	b. Set all streams that can't be replaced to final.
 2. Update reading renderers iteratively.
	a. If streams can be replaced, replace them asap.
	b. If renderes need to be disabled, do so as soon as the
	   respective renderer ended.
	c. Once step b is fully finished, enable or re-enable all new
           renderers.
 3. Wait unril playback position reaches the transition point AND
    all tasks in step 2 are done (i.e. all renderers are set up for the
    playing period).
        a. Advance playing period.

As a nice side effect, decoder enabled and disabled events are now
always reported for the reading period, which is more consistent with
other renderer callbacks.

PiperOrigin-RevId: 300526983
2020-03-19 00:46:07 +00:00
aquilescanta
1f202f0aee Make DataSource extend DataReader and upcast uses
This means DataSource.read now may throw InterruptedException.

PiperOrigin-RevId: 300523430
2020-03-19 00:45:59 +00:00
ibaker
93e203f970 Tweak the assertions in MediaSourceTestRunner to give clearer failures
PiperOrigin-RevId: 300519989
2020-03-19 00:45:51 +00:00
olly
16e6ea6e40 Fix spurious reset of PreparedState boolean flags
PiperOrigin-RevId: 300513930
2020-03-19 00:45:42 +00:00
tonihei
c85e5137f0 No-op change removing bookkeeping for enabled renderers.
This list was meant to simplify some usages where we only want to
make operations on enabled renderers. However, keeping this list
up-to-date is slightly error-prone (because renderers aren't added
and removed from this list next to the corresponding enable and disable
calls) and it makes it hard to do more fine-grained changes that only
enable or disabled a single renderer at a time.

PiperOrigin-RevId: 300513788
2020-03-19 00:45:34 +00:00
tonihei
82599960c2 Add public API for pauseAtEndOfMediaItem
Also adds tests covering the internal implementation.

Issue:#5660
PiperOrigin-RevId: 300513548
2020-03-19 00:45:26 +00:00
bachinger
527563da31 remove deprecated usage of PlaybackParameter
Removes usage of PlaybackParameters where it seems to be trivial.

PiperOrigin-RevId: 300435199
2020-03-19 00:45:18 +00:00
bachinger
072720270d remove PlaybackParameter dependency from MediaClock
After this change MediaClocks and ExoPlayerImplInternal don't depend on the deprecated PlaybackParameter anymore but only know about playbackSpeed.

PiperOrigin-RevId: 300428791
2020-03-19 00:45:09 +00:00
bachinger
683cb0260e add get/setPlaybackSpeed and listener callback
This change deprecates the PlaybackParameters and remove the skipSilenceField from the PlaybackParameters. This implies that enabling and disabling skipping silences needs to be done on the Player.AudioComponent after this change.

After submission of the change, all Player API changes are done which are required to bring playbackSpeed and skipSilenceEnabled in the converged Player API state.

PiperOrigin-RevId: 300420843
2020-03-19 00:45:01 +00:00
Matthias Tamegger
2f2fc8ca01 Update media timestamp regex to allow negative values 2020-03-17 11:28:58 +01: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