3605 Commits

Author SHA1 Message Date
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
olly
e16ab27b63 No-op refactor of MediaCodecInfo.isSeamlessAdaptationSupported
PiperOrigin-RevId: 339084261
2020-11-02 22:56:30 +00:00
kimvde
80a37c7ed1 Rename MotionPhoto to MotionPhotoMetadata
This make it clear that this class does not contain any photo/video
data.

PiperOrigin-RevId: 339045203
2020-11-02 22:56:11 +00:00
andrewlewis
160ee9d890 Handle stream volume register/unregister errors
Issue: #8106
Issue: #8087
PiperOrigin-RevId: 338664455
2020-11-02 22:55:14 +00:00
xufuji456
4bc392a8ef fix the end point of span exceeds the length of SpannableStringBuilder 2020-10-29 15:12:49 +08:00
olly
e5434ff4d3 Add plumbing for decoderReleased analytics events
A subsequent CL will plumb a release reason through these
event paths.

PiperOrigin-RevId: 338655603
2020-10-23 13:55:09 +01:00
christosts
485949b56c Refactor AsynchronousMediaCoderAdapter
Refactor the AsynchronousMediaCoderAdapter and move the callback thread
out of the adapter so that implementation of async callback and and
async queueing are consistent design-wise.

PiperOrigin-RevId: 338637837
2020-10-23 13:55:00 +01:00
kimvde
521a220728 Avoid throwing for still photo metadata retrieval
PiperOrigin-RevId: 338497163
2020-10-23 13:54:31 +01:00
ibaker
18c6b16f91 Switch playback tests to single-parameter parameterized syntax
This is simpler than instantiating a single-element string array for
every parameter.

PiperOrigin-RevId: 338469324
2020-10-23 13:54:11 +01:00
kimvde
175b8eb69e Read Google Photos motion photo metadata
PiperOrigin-RevId: 338436906
2020-10-22 12:37:41 +01:00
bachinger
1051580a63 Improve naming of the methods of LivePlaybackSpeedControl
PiperOrigin-RevId: 338232327
2020-10-21 22:25:54 +01:00
tonihei
54506b506b Explicitly prevent callbacks after player is released
We currently implicitly rely on the internal playback thread to not send
new updates after the player got released. This may not always be ensured
since we let the release call timeout. For the timeout case, there may
still be a pending operation returning much later when it unstuck itself.

Fix this and potential other edge cases by explicitly removing all listeners
and preventing new listeners from being added after the release.

PiperOrigin-RevId: 338217220
2020-10-21 10:24:24 +01:00
olly
0ad33116b6 Simplify artwork selection in PlayerView
PiperOrigin-RevId: 338056357
2020-10-21 10:24:04 +01:00
Oliver Woodman
f1c3928bc9 Merge pull request #7867 from GeneticGenesis:pc/update-expected-http-statuses-for-failover
PiperOrigin-RevId: 338051017
2020-10-20 14:52:14 +01:00
ibaker
7ea1201bc2 Add playback tests for existing MP4 assets
Skip assets with >2 audio channels - this isn't
currently supported by ShadowAudioSystem. I'll add these when support is
available.

Also skip sample_ac4_protected.mp4 because DRM isn't supported in this
test environment either.

PiperOrigin-RevId: 338023738
2020-10-20 14:51:50 +01:00
ibaker
57e884b671 Add support for AC-3, AC-4, E-AC-3 and E-AC-3-JOC to playback tests
I added the TS playback tests for these assets without adding support
for the relevant MIME types to ShadowMediaCodec.

Also remove test assets with more than 2 audio channels - this isn't
currently supported by ShadowAudioSystem. I'll re-add these when support
is available.

PiperOrigin-RevId: 338023290
2020-10-20 14:51:41 +01:00
krocard
f54f763db5 AudioSink: Remove comment about unconfirmed crash
Consensus is that the NoClassDefFoundError does not
causes a crash but only a warning.

PiperOrigin-RevId: 338022354
2020-10-20 14:51:32 +01:00
Oliver Woodman
2f3fdf7c5b Merge pull request #8030 from yqritc:add-output-surface-workaround
PiperOrigin-RevId: 338016707
2020-10-20 14:51:20 +01:00
tonihei
febf5d2031 Use ListenerSet in AnalyticsCollector.
This ensures recursively sent events arrive in the correct order.

Issue: #8048
PiperOrigin-RevId: 337812882
2020-10-20 14:50:50 +01:00
tonihei
68cbf6ddf3 Move listener handling to common util class.
ExoPlayerImpl and CastPlayer repeat the same logic. Moving the listener
and event handling to a common util class allows to reuse the same code
and add unit tests for this logic.

The change is a functional no-op.

PiperOrigin-RevId: 337812358
2020-10-20 14:50:30 +01:00
krocard
e589d7238a Add a getter for sleeping for offload
This allows wakelock releases to be state based
instead of transition based.

#exo-offload

PiperOrigin-RevId: 337286501
2020-10-17 01:35:20 +01:00
ibaker
d97dd8d5eb Add playback tests for existing FLAC assets
PiperOrigin-RevId: 337280116
2020-10-17 01:35:11 +01:00
ibaker
74ac915124 Add playback tests for existing MP3 assets
PiperOrigin-RevId: 337279583
2020-10-17 01:35:01 +01:00
krocard
230f4e5bb5 Do not inherit directly from AudioTrack.StreamEventCallback
This was causing issues old devices where the class
inheriting StreamEventCallback was loaded even though
it was not used.

Instead use an anonymous class that seem to be loaded
more lazily.

PiperOrigin-RevId: 337252687
2020-10-17 01:34:43 +01:00
krocard
bb851c99b9 Add MiTV devices requiring the output surface workaround
Issue: #8014
PiperOrigin-RevId: 337142176
2020-10-17 01:34:33 +01:00
ibaker
2371b024dd Switch to an 'api' dependency on Guava
The 'implementation' dependency causes problems when resolving
ListenableFuture in contexts that also include the
com.google.guava:listenablefuture:1.0 dependency.

Issue: #7905
Issue: #7997
Issue: #7993
PiperOrigin-RevId: 337093024
2020-10-17 01:34:15 +01:00
christosts
c4b346e49d Integrate playback speed control in ExoPlayerImplInternal
Issue: #4904
PiperOrigin-RevId: 337048010
2020-10-17 01:33:37 +01:00
bachinger
bb7c934812 Add missing properties of MediaItem.Subtitle
Issue: #8044
PiperOrigin-RevId: 336955479
2020-10-17 01:32:59 +01:00
ibaker
d700627ec2 Move Robolectric-related test utils methods to robolectricutils module
This moves TestUtil#runMainLooperUntil and
TestUtil#createRobolectricConditionVariable to a new RobolectricUtil
class.

Also move testutil classes that use Robolectric-related utils classes
(e.g. TestPlayerRunHelper, TestDownloadManagerListener).

PiperOrigin-RevId: 336864959
2020-10-13 16:29:50 +01:00
samrobinson
9e1c6321ee Adjust static metadata logging to only list non-empty Metadata.
PiperOrigin-RevId: 336864814
2020-10-13 16:29:41 +01:00
christosts
8fdadade7b Add targetLiveOffsetUs parameter to LoadControl.shouldStartPlayback
This allows a LoadControl to start playback earlier if the target
live offset is very low.

Issue: #4904
PiperOrigin-RevId: 336863824
2020-10-13 16:29:31 +01:00
christosts
76b7f76437 Allow speed adjustments close to 1f in SonicAudioProcessor
Issue: #4904
PiperOrigin-RevId: 336841791
2020-10-13 16:29:22 +01:00