6767 Commits

Author SHA1 Message Date
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
ibaker
702e5cfb3e Fix or suppress nullness warnings introduced by checkerframework 3.7.0
PiperOrigin-RevId: 340826532
2020-11-06 16:33:59 +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
bachinger
7f49b33fea Block HLS playlist requests at part level
Issue: #5011
PiperOrigin-RevId: 340625816
2020-11-06 16:33:15 +00:00
bachinger
4332dc2304 Parse HLS #EXT-X-RENDITION-REPORT tag
Issue: #5011
PiperOrigin-RevId: 340621758
2020-11-06 16:33:06 +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
bachinger
c04dd8b328 Use blocking HLS media playlist reload for segments
Issue: #5011
PiperOrigin-RevId: 340477795
2020-11-06 16:32:40 +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
olly
9d3875a860 Matroska: Support additional PCM codec modes
- Support 32-bit A_PCM/FLOAT/IEEE PCM
- Support 8-bit and 16-bit A_PCM/INT/BIG PCM

#minor-release
Issue: #8142
PiperOrigin-RevId: 340264679
2020-11-02 23:02:06 +00:00
christosts
42a2b9230a HLS: populate targetLiveOffset in MediaItem from server control
Issue: #5011
PiperOrigin-RevId: 340260636
2020-11-02 23:01:57 +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
bachinger
0d6ec21b30 Parse #EXT-X-PRELOAD-HINT tag
Issue: #5011
PiperOrigin-RevId: 339738292
2020-11-02 22:59:52 +00:00
kimvde
8f6b46f570 Transformer: flatten slow mo video at normal speed
Slow motion segments are not taken into account yet.

PiperOrigin-RevId: 339678840
2020-11-02 22:59:43 +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
christosts
d5170688b4 MediaItem: document params in method call
PiperOrigin-RevId: 339472160
2020-11-02 22:58:54 +00:00
bachinger
fe2acb5954 Parse HLS #EXT-X-PART tag
Issue: #5011
PiperOrigin-RevId: 339467702
2020-11-02 22:58:43 +00:00
tonihei
aab6aef443 Set min/max supported live offset in DashMediaSource.
In order to ensure we can update the values for new manifests but still use
the user provided override, we need to save the original and the updated MediaItem
seperately.

And in order to incorporate the existing logic for the min/max supported live
offset, which we already use to correct the target offset, also move both places
together so that all the adjustment happens in one place.

Logical adjustments to the previous min/max supported live offset:
 - Use the user-provided MediaItem values if set
 - Use the newly parsed ServiceDescription values if available.
 - Limit the minimum to 0 if the current time is in the window and we can
   assume to have low-latency stream.
 - Add minBufferTime from the manifest to ensure we don't reduce the live
   offset below this value.

Issue: #4904
PiperOrigin-RevId: 339452816
2020-11-02 22:58:34 +00:00
samrobinson
2c746c6b6b Generalise the SlowMotion Metadata.Entry naming.
PiperOrigin-RevId: 339352447
2020-11-02 22:57:56 +00:00
samrobinson
c0a0708fc3 Extract SEF slow motion cues as Metadata
PiperOrigin-RevId: 339307746
2020-11-02 22:57:47 +00:00
tonihei
aee7e6087c Parse min/max live offset from ServiceDescription.
Issue: #4904
PiperOrigin-RevId: 339215091
2020-11-02 22:57:28 +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
bachinger
949e26d1ba Support delta updates for media playlists
Issue: #5011
PiperOrigin-RevId: 339093145
2020-11-02 22:56:49 +00:00
olly
e16ab27b63 No-op refactor of MediaCodecInfo.isSeamlessAdaptationSupported
PiperOrigin-RevId: 339084261
2020-11-02 22:56:30 +00:00
ibaker
50566fb8ac Suppress ProGuard warnings related to Guava's compile-only deps
Without these lines, ProGuard fails on the demo app (R8 works).

Also include some more `-dontwarn` lines from
https://github.com/google/guava/wiki/UsingProGuardWithGuava

#minor-release

Issue: #8103
PiperOrigin-RevId: 339050634
2020-11-02 22:56:21 +00:00