4108 Commits

Author SHA1 Message Date
olly
1a34de5954 Add plumbing for reporting internal decoder errors
PiperOrigin-RevId: 357732695
2021-02-19 10:57:08 +00:00
olly
9de6a75891 Remove dynamic data from ExoTrackSelection.Definition
PiperOrigin-RevId: 357587767
2021-02-19 10:56:44 +00:00
olly
abaf1e10a2 Respectful language cleanup
PiperOrigin-RevId: 357587009
2021-02-19 10:56:35 +00:00
olly
7f5b5c9b6d Add static TrackSelection type
This type is different to the selection reason, which is
dynamic (i.e., corresponds to the individual selected track,
which can change during playback). The static type is
exposed via TrackSelection, where-as the selection reason
will be internal to the core (i.e., player) module.

PiperOrigin-RevId: 357578201
2021-02-19 10:56:27 +00:00
olly
ff46a87d39 Remove track selection override reason and data
These have limited value, and are confusing because they're only
actually used if the override only selects a single track (if the
override is an adaptive selection then the values are never used).
The simpliest path forward is to remove them.

PiperOrigin-RevId: 357573186
2021-02-19 10:56:10 +00:00
olly
f52e4bed3d Don't clear audioSessionId when audio disabled
Issue: #8585
#minor-release
PiperOrigin-RevId: 357553237
2021-02-19 10:55:54 +00:00
olly
1b6dd40aa5 Move Spherical UI components to the UI module
PiperOrigin-RevId: 357549002
2021-02-19 10:55:46 +00:00
tonihei
8a084daaff Clarify/correct restrictions of AdsMediaSource.
The source can be used in compositions (in fact, every source is
automatically used in an internal composition when constructing the
playlist), and there is not really a concept of top-level media source
any more since the Player supports playlists.

The actual restriction is that the content media source needs to have
exactly one period to be able to create a SinglePeriodAdTimeline.

#minor-release

PiperOrigin-RevId: 357544191
2021-02-19 10:55:29 +00:00
olly
0b63c17a7e Fix RequiresApi annotation
#minor-release

PiperOrigin-RevId: 357273184
2021-02-12 22:53:40 +00:00
christosts
086d8f3a8e Contract test for TransferListener callbacks
PiperOrigin-RevId: 357190780
2021-02-12 16:40:40 +00:00
kimvde
158e6de25a Add comment explaining Dolby Vision fallback logic
PiperOrigin-RevId: 357158075
2021-02-12 16:40:23 +00:00
olly
0dba806894 Move DebugTextViewHelper to core
It's closely tied to SimpleExoPlayer, so cannot be part of a UI module
that depends only on common.

PiperOrigin-RevId: 357085802
2021-02-12 16:40:05 +00:00
ibaker
6b5b3d8141 Check if keepalive is enabled before releasing sessions in DDSM.release
If keepalive is disabled the existing code over-eagerly releases
DrmSession instances. This is arguably OK since a (Default)DrmSession
should be released before its (Default)Manager is released
(since the underlying MediaDrm instance might be released when the
manager is released). And if all sessions are released before the
manager is released then `sessions` is empty, so the loop is a no-op.

Issue: #8576
#minor-release
PiperOrigin-RevId: 356955308
2021-02-12 16:39:47 +00:00
ibaker
de359cd6fd Propagate DRM config when creating ad media sources
The `DrmConfiguration.sessionForClearTypes` property is often used
to ensure a secure decoder is used for clear ads played in encrypted
content. This is because some devices show black frames when switching
decoders.

Before this change the DRM config isn't propagated down when
constructing the ad media source, meaning
`DrmSessionManager.DRM_UNSUPPORTED` is always used, which will
cause playback to switch from secure to clear decoder when transitioning
to an ad break (ignoring the MediaItem `sessionForClearTypes` option.

Issue: #8568

#minor-release

PiperOrigin-RevId: 356951124
2021-02-12 16:39:38 +00:00
aquilescanta
f8505204cc Move MediaFormatUtil into common
Also move out of the mediacodec package into the util package.

PiperOrigin-RevId: 356949401
2021-02-12 16:39:28 +00:00
andrewlewis
5e229b4f05 Don't set playback parameters when using tunneling
Issue: #4803

#minor-release

PiperOrigin-RevId: 356923345
2021-02-11 12:06:13 +00:00
olly
493d996c6f Move RepeatModeUtil to common
It's used by the UI and mediasession modules. We may be able to move
it into the UI module if/when the mediasession module goes away.

PiperOrigin-RevId: 356734939
2021-02-11 12:06:02 +00:00
christosts
333de74140 Minor fixes in CacheDataSourceTest
PiperOrigin-RevId: 356695284
2021-02-11 12:05:51 +00:00
ibaker
a062075462 Cache the last DrmSessionManager instance inside the default provider
Without this a new manager is instantiated for every item in a playlist,
meaning the impact of caching improvements to DefaultDrmSessionManager
are reduced (since the cache doesn't persist across playlist items).

With this change, playlists of items with identical DRM config will use
the same manager instance (and thus share existing sessions).

Issue: #8523
#minor-release
PiperOrigin-RevId: 356690852
2021-02-11 12:05:28 +00:00
andrewlewis
e28332ff82 Add common prefix to loader thread names
All threads created by ExoPlayer should now have the prefix "ExoPlayer:".

PiperOrigin-RevId: 356518037
2021-02-11 12:05:06 +00:00
olly
94a4b905c9 Make additional modules depend only on common
ControlDispatcher and DefaultControlDispatcher also need
to move to common for the UI module. As does PlaybackPreparer,
although that will be removed entirely in a future release.

PiperOrigin-RevId: 356467394
2021-02-09 13:59:41 +00:00
tonihei
fbc8d6c801 Don't apply speed adjustment if windowStartTime is unknown.
This may happen for HLS live streams without program date time
information.

Issue: #8560

#minor-release

PiperOrigin-RevId: 356227729
2021-02-09 13:59:16 +00:00
aquilescanta
0b8b03e46d Add method to create a MediaFormat based on an ExoPlayer Format
PiperOrigin-RevId: 356157035
2021-02-09 13:58:59 +00:00
olly
01b6061bd2 Wire CodecException.isRecoverable to ExoPlaybackException
PiperOrigin-RevId: 355896218
2021-02-09 13:58:50 +00:00
olly
438bcada38 Consistently throw the original exception if recovery fails
PiperOrigin-RevId: 355664280
2021-02-09 13:58:33 +00:00
olly
a245fbdc99 #ExoPlayerMigration Ensure RawResourceDataSource class is obfuscated
PiperOrigin-RevId: 355659628
2021-02-09 13:58:24 +00:00
krocard
91d3f47e45 Clarify AudioFocusManager by renaming some methods/field
The current naming had cause confusinon in b/179369346
and #8545.

PiperOrigin-RevId: 355656404
2021-02-09 13:58:15 +00:00
olly
5107fea576 More clearly define the semantics of error recovery
- When throwing a recoverable error from a renderer, it's important to understand
  exactly how the player will attempt recovery. Clarify the documentation to
  make this explicit.
- Rename some methods/constants to make it clear that error recovery is specific
  to renderer errors. The current recovery mechanism only makes sense for
  renderer errors. Making the naming renderer specific avoids reader doubt that
  the implementation doesn't appear to be generic enough for other types of
  errors.

PiperOrigin-RevId: 355650945
2021-02-04 18:14:26 +00:00
kimvde
35d34af2e9 Fall back to AVC/HEVC for Dolby Vision levels 10-13
Before, the level was set to null in this case.
MediaCodecUtil.getCodecProfileAndLevel() was therefore returning null
and the fallback to AVC/HEVC was not enabled in MediaCodecVideoRenderer.

Issue:#8530
#minor-release
PiperOrigin-RevId: 355574499
2021-02-04 09:57:46 +00:00
olly
584a0730c9 Improve EventLogger static metadata formatting
#minor-release

PiperOrigin-RevId: 355203044
2021-02-03 15:02:50 +00:00
ibaker
0b34cabca0 Document that DrmSessionManagerProvider doesn't call DSM#prepare()
#minor-release

PiperOrigin-RevId: 355159635
2021-02-03 15:02:32 +00:00
ibaker
ffc1b5bbef Log a warning when SingleSampleMediaPeriod turns a load error into EOS
Without this no error is currently logged or propagated to EventLogger.
The propagation doesn't happen because
MergingMediaSource.ForwardingEventListener only propagates events
originating from the "main" source in the merge:
<unknown commit>

#minor-release

PiperOrigin-RevId: 354902467
2021-02-01 18:11:56 +00:00
olly
35b99d634f Make Cronet extension depend only on common
This also moves DefaultHttpDataSource to common, which seems
sensible, else non-player components that need a DataSource
don't have any useful concrete implementations. We should
think about moving some of the other concrete implementations
to common as well.

PiperOrigin-RevId: 354738925
2021-02-01 18:11:23 +00:00
olly
eb0d8e6f28 Fix nullness issues in DefaultHttpDataSource
This is needed to move it to common, since we don't want to start
adding any nullness exemptions for the common module.

PiperOrigin-RevId: 354734715
2021-02-01 18:11:14 +00:00
Oliver Woodman
c9fce083f3 Merge pull request #8490 from szaboa:dev-2-8435-ssa-color
PiperOrigin-RevId: 354293679
2021-02-01 18:10:35 +00:00
Arnold Szabo
28a3921a6a Add color decoding tests to SsaDecoderTest, remove SubStation Alpha colors" from media.exolist.json. 2021-01-26 22:57:10 +01:00
Arnold Szabo
f8a47bc86d Modify the SsaColor to be more similar to the Optional class. 2021-01-26 21:37:01 +01:00
tonihei
9b3014dd79 Remove randomness from adaptive bitrate tests.
- The order of sample stream (and thus the order in which loads are
  triggered) currently depends on a Set and thus on the hash codes
  of the objects that change with every run. Changing to a List solves
  this problem.
- The FakeAdaptiveDataSet directly created a static Random (with random
  seed) to compute the variation of chunk sizes. Changing this to an
  injected Random object that can always be initialized with the same
  seed also removed this randomness from the tests.

PiperOrigin-RevId: 353878661
2021-01-26 17:13:46 +00:00
tonihei
2e52c0b8d8 Make FakeClock fully deterministic.
This is achieved by only triggering one message at a time. After
triggering a message we send another to ourselves to know when the
following message can be triggered.

Other required changes:
 - The messages need to be sorted correctly (by time and creation order)
 - To prevent deadlocks when one thread is waiting for another,
   we need to add new method to Clock to indicate that the current
   thread is about to wait. This then allows us to trigger messages
   from other threads in FakeClock.
 - AnalyticsCollectorTest needed some adjustments:
   - onTimelineChanged now deterministically arrives after the initial
     timline is already known, so some of the period information changes
     from window only to full period info.
   - The playlistOperations test suffers from a bug that the first frame
     is rendered too early and that's why we now get additional events.

PiperOrigin-RevId: 353877832
2021-01-26 17:13:35 +00:00
tonihei
89ea38d155 Handle all messages in FakeClock.
Currently only delayed messages are handled. Change this to handling
all messages so that we have more control over their execution order.

This requires adding a new wrapper type for the Message to support
the obtainMessage + sendToTarget use case.

PiperOrigin-RevId: 353876557
2021-01-26 17:13:15 +00:00
christosts
ccf031f9bb BandwidthMeter minor javadoc fix
PiperOrigin-RevId: 353858581
2021-01-26 15:59:15 +00:00
Arnold Szabo
2241320535 Remove unused static variable 2021-01-25 23:36:50 +01:00
Arnold Szabo
1364c01e09 Improve support of SSA (V4+) PrimaryColour style 2021-01-25 23:35:10 +01:00
andrewlewis
e696a7c6e2 Use maximum supported channel count for Atmos from API 29
#minor-release

PiperOrigin-RevId: 353649545
2021-01-25 17:38:46 +00:00
olly
3fcc14b3c2 OkHttp/Rtmp extensions: Remove dependency on core
They only require common. This allows their use for non-playback networking
without requiring the user to depend on the whole of core. I will also make
the same change for Cronet, although this needs a little more work.

PiperOrigin-RevId: 353649388
2021-01-25 17:38:36 +00:00
olly
a1f06987eb Replace non-inclusively named constant
Issue: #7565
PiperOrigin-RevId: 353649187
2021-01-25 17:38:26 +00:00
krocard
b0258e7192 Move Player in common
This is the last CL to move Player in common.

#player-to-common

PiperOrigin-RevId: 353642347
2021-01-25 15:37:48 +00:00
krocard
ec43735054 Split mutations method out of TrackSelection
`TrackSelection` had mutation methods which were to be called only
internally by ExoPlayer components but were exposed in the
public `Player` interface.

The mutation methods have been moved out of `TrackSelection`
to a new class `ExoTrackSelection`.

Current track related read-only method have also been moved out,
because they are actually something quite unclear.
Even for a single item playlist, it's the track being buffered rather
than the track being played, which is unclear.
But when you have a playlist it starts to get really confusing,
because if the next item is being buffered, then it's actually
the last track to be buffered in the currently playing item.
As a final aside, the implementations don't do proper thread synchronization
to ensure visibility of updated state by the calling thread.

Exposing those mutable methods in the public `Player` interface
was problematic because they leaking internal concepts of `ExoPlayer`.
This is also required to minimize the `Player` interface for long term
stability.

`ExoTrackSelection` is a subclass of `TrackSelection`.
This is not ideal as an `TrackSelection` implementation could
break the current immutability.
This was done in order for this refactor to be simpler.
A future patch will fully split the two classes.

All `MediaPeriod` and `Sources` had to be updated to use the new
`TrackSelection` dynamic aspect class name.
An alternative would have been to break ExoPlayer's public API, keeping
`TrackSelection` as the dynamic aspect name, and calling the public static
aspect class `TrackSelectionState` or similar.
Nevertheless, while it would have impacted less files, it would have
many more small apps and casual users of ExoPlayer.

#player-to-common

PiperOrigin-RevId: 353637924
2021-01-25 15:37:38 +00:00
olly
b069a567ea Rename DUMMY_MEDIA_ID and related cleanup
Issue: #7565
PiperOrigin-RevId: 353616594
2021-01-25 15:37:28 +00:00
olly
dc7fde1ff7 Some more language fixes
Issue: #7565
PiperOrigin-RevId: 353613493
2021-01-25 15:36:59 +00:00