7188 Commits

Author SHA1 Message Date
aquilescanta
ecb109dad8 Make MediaParser available for use in progressive media
PiperOrigin-RevId: 358379167
2021-02-22 10:35:06 +00:00
tonihei
1a12018dae Add ConcatenatingMediaSource version that fully combines windows.
The published Timeline contains one window only with all periods of
the child sources.

Issue: #4868
PiperOrigin-RevId: 358150276
2021-02-19 10:58:05 +00:00
tonihei
7830eb7ae5 Ensure non-fatal errors are logged to logcat.
We already report these errors through callbacks to interested listeners.
However, to ease debugging with bugreports and local error detection,
it's helpful to also log these non-fatal execptions to logcat. Otherwise
nothing in logcat indicates that the player recovered from an exception.

Issue: #6384
PiperOrigin-RevId: 357923899
2021-02-19 10:57:49 +00:00
tonihei
f191000e20 Report unexpected discontinuity as non-fatal audio sink error.
This is preferable to just logging to LogCat so that listeners can
report this to analytics systems if required.

Issue: #6384
PiperOrigin-RevId: 357906079
2021-02-19 10:57:41 +00:00
gyumin
dea6a67ce9 Remove nullable utility methods in Bundleable
PiperOrigin-RevId: 357845774
2021-02-19 10:57:32 +00:00
olly
2e5e1e7c0f SilenceSampleStream.readData: Handle flags-only buffers
The SampleStream.readData contract is that when reading a sample
with a flags-only buffer, the buffer timestamp and flags should
be set and the read position should not be advanced.

#minor-release

PiperOrigin-RevId: 357842130
2021-02-19 10:57:24 +00:00
olly
5da9fd83e9 Improve documentation of StreamStream/SampleQueue read methods
PiperOrigin-RevId: 357734165
2021-02-19 10:57:16 +00:00
olly
1a34de5954 Add plumbing for reporting internal decoder errors
PiperOrigin-RevId: 357732695
2021-02-19 10:57:08 +00:00
gyumin
2326b56132 Implement Bundleable for MediaItem and MediaMetadata
PiperOrigin-RevId: 357656504
2021-02-19 10:56:52 +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
gyumin
6a642ec58b Generalize exception thrown by fromBundle
It allows Bundleable classes throw a RuntimeException which is broader
than IAE. Now, Bundleable implementation may utilize checkNotNull for
brevity.

PiperOrigin-RevId: 357546375
2021-02-19 10:55:37 +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
kimvde
842ca9c09f Add method to query whether a command is available
- Other commands will be added later.
- The returned value is a boolean until we decide what it should be.

PiperOrigin-RevId: 357535877
2021-02-19 10:55:20 +00:00
gyumin
c7751344d4 Use compact String keys for Bundleable
To save bytes in serialized format, it uses shorter keys in Bundles.

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

PiperOrigin-RevId: 357273184
2021-02-12 22:53:40 +00:00
olly
18722bfb0b Bump version to 2.13.1
PiperOrigin-RevId: 357219132
2021-02-12 19:55:57 +00:00
kimvde
c1ef00ab42 Revert logic to decide whether meta atom is full
The previous logic was changed under the assumption that the first box
inside a meta box was not always an hdlr box, but this is not true.

#minor-release

PiperOrigin-RevId: 357200713
2021-02-12 19:55:47 +00:00
christosts
086d8f3a8e Contract test for TransferListener callbacks
PiperOrigin-RevId: 357190780
2021-02-12 16:40:40 +00:00
kimvde
b303eceafd Add support for MP4/QuickTime non-full meta atoms
#minor-release

PiperOrigin-RevId: 357160215
2021-02-12 16:40:31 +00:00
kimvde
158e6de25a Add comment explaining Dolby Vision fallback logic
PiperOrigin-RevId: 357158075
2021-02-12 16:40:23 +00:00
kimvde
6afb669aa7 Enable next button if window is live
This behavior is consistent with DefaultControlDispatcher#dispatchNext().

#minor-release

PiperOrigin-RevId: 357145076
2021-02-12 16:40:14 +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
tonihei
d700990198 Fix available end time calculation for multi-period DASH live streams
The available end time was accidentally substracted by the start time
of the last period.

To avoid similar time reference confusion in the future, also renaming
many variables and methods to clearly reflect the time reference point.
And to avoid constant conversion, the processManifest method also
attempts to converge to time relative to the start of the window as
quickly as possible.

Issue: #8537
PiperOrigin-RevId: 357001624
2021-02-12 16:39:56 +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
gyumin
753bccec1f Implement Bundleable for media2 MediaItem and related classes
PiperOrigin-RevId: 356622155
2021-02-11 12:05:18 +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
50db2ee172 Remove deprecated Player.DefaultEventListener
PiperOrigin-RevId: 356479682
2021-02-09 14:00:06 +00:00
olly
30ad70bbd7 Remove deprecated DownloadNotificationUtil
PiperOrigin-RevId: 356474350
2021-02-09 13:59:57 +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
andrewlewis
846bb94ec4 Handle loading the same ad more than once
Also allow the player's prepared ad media period durations array to exceed the
length of the loaded ad URIs array, as it's possible for the player to buffer
an ad media period fully at the point where it's known that an ad is coming up
but its URI is still unknown.

#minor-release

PiperOrigin-RevId: 356249284
2021-02-09 13:59:24 +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
kimvde
d21a47c4f1 Transformer: remove SpeedProvider interface from Javadoc
#minor-release

PiperOrigin-RevId: 356221487
2021-02-09 13:59:07 +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
tonihei
91c2f891a0 Ensure BandwidthProfileDataSource loading is fully deterministic
We currently block the loading thread until the calculated load
time has past and then unblock again by a message sent from the
playback thread. However, because the loading thread itself is not
using a Looper and runs freely, we don't control when the short
calculations on the loader thread that determine how long we have
to wait are happening, and we also don't control how long it takes
to start and stop this thread.

To solve these problems and to make the playback deterministic we
can
 1. Send a message on the playback thread to block until the loader
    thread has started.
 2. Block the playback thread whenever a loading thread is doing its
    short calculation of wait times. The playback thread knows when it
    can continue because loading either enter a new waiting state for
    a simulated load time or loading is finished completely.
 3. Also wait on the playback thread until the loader has shut down.
    As this is waiting for a message on the playback thread, we can
    achieve this by sending messages to ourselves at the current time
    until the loader is shut down.
All 3 steps together ensure that the loading thread interaction is
compeltely deterministic when simulating bandwidth profiles with the
BandwidthProfileDataSource. As we need to notify the source before and
after the load started/finished, we also need a small wrapper for the
chunk source when running the playback.

PiperOrigin-RevId: 355810408
2021-02-09 13:58:42 +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
kimvde
da52de669c Avoid skipping the first decoder output buffers after speed change
#minor-release

PiperOrigin-RevId: 355652144
2021-02-04 18:14:35 +00:00