3636 Commits

Author SHA1 Message Date
veronicaradu
a19941f09c Add methods in TrackSelection to get details about the playback state.
Determine whether a rebuffer occurred and if the playback is paused or resumed.

PiperOrigin-RevId: 342849010
2020-11-18 18:30:47 +00:00
christosts
cbd91999b4 Add Robolectric playback tests for existing VP9 assets
PiperOrigin-RevId: 342660971
2020-11-17 13:50:35 +00:00
christosts
c87f95e153 Add Robolectric playback tests for existing MKV assets
PiperOrigin-RevId: 342618706
2020-11-16 16:50:46 +00:00
tonihei
1984779fa1 Discard buffer synchronously after seek before cancelling a load.
This ensures the buffer is not full when the `DefaultLoadControl` determines
whether we should continue loading and thus prevents a false warning about
not having enough memory left.

PiperOrigin-RevId: 342616623
2020-11-16 16:50:35 +00:00
olly
c47e62209d Report reasons for not being able to reuse decoders
PiperOrigin-RevId: 342344090
2020-11-16 16:49:48 +00:00
olly
3ef609fa3b Plumb playback speed and frame-rate via VideoFrameReleaseTimeHelper
PiperOrigin-RevId: 342289646
2020-11-16 16:49:37 +00:00
olly
f6928c0ef9 Keep download in completed state if only metadata is updated
#minor-release

Issue: #8116
PiperOrigin-RevId: 342269114
2020-11-16 16:49:25 +00:00
olly
7fe68b52d5 Remove stray arguments from method
PiperOrigin-RevId: 342263700
2020-11-13 16:30:28 +00:00
christosts
7fd78666d1 Add Robolectric playback tests for existing MKA assets
PiperOrigin-RevId: 342060794
2020-11-13 14:55:20 +00:00
olly
2693a107cd Fix frame release timing to be aware of playback speed
PiperOrigin-RevId: 342007987
2020-11-13 14:54:32 +00:00
tonihei
51c8ffbb0e Tweak DefaultLivePlaybackSpeedControl parameters.
Changing them to have fewer updates when adjusting the playback speed.

PiperOrigin-RevId: 341834423
2020-11-13 14:54:22 +00:00
claincly
6f7c97a729 Add method to expose the locally opened port for UdpDataSource.
PiperOrigin-RevId: 341707809
2020-11-11 09:51:09 +00:00
kimvde
4ae0401c34 Work around AudioManager#getStreamVolume crashes
#minor-release
Issue:#8191
PiperOrigin-RevId: 341632732
2020-11-11 09:50:49 +00:00
ibaker
363693d8ec Add multi-channel audio samples to Mp4PlaybackTest
Robolectric now supports multi-channel audio:
https://github.com/robolectric/robolectric/commit/9d84ceb6d588d5f53be29b

PiperOrigin-RevId: 341574417
2020-11-11 09:50:40 +00:00
ibaker
1e776a864b Fix some typos
PiperOrigin-RevId: 341573964
2020-11-11 09:50:30 +00:00
ibaker
337c412d2b Add multi-channel audio samples to TsPlaybackTest
Multi-channel audio is now supported by Robolectric:
https://github.com/robolectric/robolectric/commit/9d84ceb6d588d5f53be29b

PiperOrigin-RevId: 341573838
2020-11-11 09:50:21 +00:00
ibaker
f13058942a Add Robolectric playback tests for existing FLV assets
PiperOrigin-RevId: 341573808
2020-11-11 09:50:11 +00:00
christosts
9e98a680da Add flag to force synchronization in async queueing
Add experiment flag to force synchronization between
queueing threads in AsynchronousMediaCodecAdapter.

PiperOrigin-RevId: 341431481
2020-11-11 09:50:01 +00:00
christosts
9473fda056 Synchronize codec interaction with buffer queueing
Add experimental method to synchronize MediaCodec interactions
with asynchronous queueing. When the feature is enabled, interactions
such as MediaCodec.setOutputSurface() triggered by the
MediaCodecRenderer will wait until all input buffers pending queueing
are first submitted to the MediaCodec.

PiperOrigin-RevId: 341423837
2020-11-11 09:49:51 +00:00
tonihei
86ae7ebac4 Decrease target live offset if safely possible.
To check what is safely possible we keep track of the live offset
corresponding to the buffered duration and only deecrease the
target offset to a safe margin from the buffered duration.

Also, while still possible (i.e. while the actual offset is larger
than the safe margin), we increase the target offset to the safe
margin to avoid rebuffers to start with.

Issue: #4904
PiperOrigin-RevId: 341396492
2020-11-11 09:49:41 +00:00
bachinger
b03df4e8b5 Add dispatchPrepare(player) to ControlDispatcher
Issue: #7882
PiperOrigin-RevId: 341394254
2020-11-11 09:49:32 +00:00
christosts
1d4321b86e Move ownership of MediaCodec to MediaCodecAdapter
Move ownership of MediaCodec to MediaCodecAdapter so that all MediaCodec
interactions go through MediaCodecAdapter.

PiperOrigin-RevId: 341066926
2020-11-11 09:49:21 +00:00
claincly
8b5ecdb98d Fix javadoc formatting
PiperOrigin-RevId: 341051348
2020-11-06 16:40:34 +00:00
christosts
92ec1ab628 Add more MediaCodec methods to MediaCodecAdapter
Add more MediaCodec methods to MediaCodedAdapter so that renderers
interact with the MediaCodec through the MediaCodecAdapter.

PiperOrigin-RevId: 341023452
2020-11-06 16:35:23 +00:00
andrewlewis
764e5e8141 Expose the ads identifier in the Timeline period
Issue: #3750
PiperOrigin-RevId: 341021084
2020-11-06 16:35:06 +00:00
andrewlewis
0c301fefa8 Pass AdsMediaSource to other AdsLoader methods
Issue: #3750
PiperOrigin-RevId: 341020676
2020-11-06 16:34:57 +00:00
christosts
07e33a1395 Add getInputBuffer/getOutputBuffer in MediaCodecAdapter
PiperOrigin-RevId: 341016263
2020-11-06 16:34:37 +00:00
olly
1bcf1cf9f7 Decide whether to release rather than flush in onInputFormatChanged
- This change removes the last piece of logic that could cause deferred
  codec release (i.e., where the decision to release was made in
  processEndOfStream rather than in onInputFormatChanged.
- After this change, whether the codec will be released as a result of
  a format change is always established in onInputFormatChanged.

PiperOrigin-RevId: 341012403
2020-11-06 16:34:28 +00:00
olly
1fb675e876 Move last-buffer timestamp fix to better location
PiperOrigin-RevId: 340915538
2020-11-06 16:34:19 +00:00
olly
477eae3c57 Fix incorrect decoder non-reuse when operating rate needs clearing
This fixes a case where updateCodecOperatingRate would configure
the decoder to be drained and then released, only for
onInputFormatChanged to override the drain action with something
else.

We've not seen any reports of this issue, which suggests that either
it's OK to not release the decoder in such cases, or that the
case doesn't happen very often. I suspect that it's both, but let's
restore the intended behaviour for now.

PiperOrigin-RevId: 340909132
2020-11-06 16:34:08 +00:00
olly
773e890768 Move another adaptation workaround into MediaCodecInfo
PiperOrigin-RevId: 340654217
2020-11-06 16:33:50 +00:00
tonihei
effbc22a62 Increase target live offset when rebuffering.
Issue: #4904
PiperOrigin-RevId: 340654178
2020-11-06 16:33:42 +00:00
tonihei
2416d99857 Limit target buffer to media configured min/max values.
Issue: #4904
PiperOrigin-RevId: 340653126
2020-11-06 16:33:33 +00:00
olly
c9e80a20e6 Move reconfiguration workaround to canKeepCodec
PiperOrigin-RevId: 340651654
2020-11-06 16:33:24 +00:00
tonihei
ae17e6d6f8 Forward Timeline and period id to TrackSelection.Factory
This information is already available in the MappingTrackSelector,
but not currently forwarded to the TrackSelection.Factory.

This makes it more complicated (or impossible) to depend on period
or manifest information in the track selection (for example to only
select tracks which are cached for the current format).

PiperOrigin-RevId: 340605886
2020-11-06 16:32:57 +00:00
andrewlewis
5fd1601f91 Signal an ads identifier to the AdsLoader
In a later change, the AdPlaybackState will include the playing adsId (set by
the AdsLoader) and the ads loader will use this to determine what ad
information is associated with the playing/next periods, to allow loading ads
in playlists.

Apps can continue to pass just a URI for an ad tag with their MediaItem, in
which case the associated playlist will request that ad tag just and the same
state will be used for all occurrences of the ad tag.

This change has breaking changes to the AdsLoader interface and removes
deprecated ways of passing the ad tag, as it's very likely to go into a major
release anyway and not needing to handle the deprecated cases simplifies
ImaAdsLoader.

Issue: #3750
PiperOrigin-RevId: 340438580
2020-11-06 16:32:31 +00:00
ibaker
f937e40eab Make Tx3gDecoder fields final, and remove unnecessary null-check
PiperOrigin-RevId: 340412910
2020-11-06 16:32:22 +00:00
olly
e139a4652a Short term fix for setFrameRate ISE when surface is not valid
PiperOrigin-RevId: 340314496
2020-11-02 23:02:27 +00:00
olly
2c7473dc05 Clean up logic for determining whether DRM reconfig needs codec re-init
1. Move logic to decide to re-initialize the codec rather than using
   MediaCodec.setMediaDrmSession if (a) PlayReady is in use, and (b)
   the new session is still provisioning. This would previously have
   happened asynchronously after an input format change, after the
   decoder has subsequently been flushed. After this change the logic
   executes synchronously when the input format changes. This helps
   with the ref'd bug, since we want to propagate reasons for codec
   re-initialization through inputFormatChanged events.
2. Whilst moving the logic for re-initialization if PlayReady is
   being used, I fixed a bug that would occur when switching from
   [PlayReady --> non-PlayReady]. Re-use doesn't work in this case.
   The old logic only checked for the [Something --> PlayReady] case.
3. Remove pointless codec flush if updating the DRM session having
   not queued anything to the codec.

PiperOrigin-RevId: 340299790
2020-11-02 23:02:16 +00:00
Oliver Woodman
e1211f9254 Merge pull request #8133 from xufuji456:dev-v2
PiperOrigin-RevId: 340254878
2020-11-02 23:01:45 +00:00
ibaker
8e9c5c67a3 Migrate Tx3gDecoderTest to Guava and SpannedSubject
#minor-release

PiperOrigin-RevId: 340249019
2020-11-02 23:01:35 +00:00
olly
1d12d03283 Clarify DRM error deferral comments
- I don't think the session recovering later would work, because
  the codec will be configured not to use it.
- I'm not sure session recovery makes sense in general, and our
  implementations do not do this. Document it as a terminal state
  for now.

PiperOrigin-RevId: 340204194
2020-11-02 23:01:25 +00:00
olly
be1fd23666 Rename setOperatingRate to setPlaybackSpeed
This avoids confusion that currently exists between "operating rate"
and "codec operating rate", which are different. It also tightens the
requirement of the value being passed to be more than a "hint". It's
already being used as more than a hint for setting the Surface frame
rate.

PiperOrigin-RevId: 340201829
2020-11-02 23:01:16 +00:00
olly
c1dc802050 Make defaultLicenseUrl optional
Some content types always provide the license URL in the media.
The PlayReady example in the demo app doesn't provide a default
license URL for this reason, as an example.

#minor-release

PiperOrigin-RevId: 340125784
2020-11-02 23:00:57 +00:00
samrobinson
9962cf015b Add SEF based test to MetadataRetrieverTest
PiperOrigin-RevId: 339885432
2020-11-02 23:00:20 +00:00
aquilescanta
04c56c44cf Publish components that depend on MediaParser
This change will be followed up by:
- Changes adding APIs to enable the use of MediaParser in each of the supported
  media sources.
- Changes removing TODOs related to the change of the stable SDK to API 30.

PiperOrigin-RevId: 339556777
2020-11-02 22:59:05 +00:00
samrobinson
c0a0708fc3 Extract SEF slow motion cues as Metadata
PiperOrigin-RevId: 339307746
2020-11-02 22:57:47 +00:00
tonihei
e57193676a Add min/max live offset to MediaItem.LiveConfiguration.
This allows the user and the media to define bounds in which the live offset
can vary.

Issue: #4904
PiperOrigin-RevId: 339214605
2020-11-02 22:57:19 +00:00
olly
d436a69d8f Centralize canKeepCodec logic
Logic for determining if (and how) decoders can be adapted is
currently split between renderers and MediaCodecInfo. This change
centralizes the majority of the logic in MediaCodecInfo.

This change also fixes a bug in MediaCodecAudioRenderer when computing
max values for the codec. Previously, max values would not be increased
to account for potential adaptation to another stream in the case that
the codec needs to be flushed for the adaptation to occur.

PiperOrigin-RevId: 339133416
2020-11-02 22:57:09 +00:00
olly
959851b190 Add MediaCodecInfoTest
PiperOrigin-RevId: 339107784
2020-11-02 22:56:59 +00:00