4180 Commits

Author SHA1 Message Date
aquilescanta
1a8592c5c0 Add Player.Listener.onPlayerErrorChanged
Equivalent to onPlayerError, except it's also called for null.

PiperOrigin-RevId: 381015336
2021-06-30 13:17:49 +01:00
aquilescanta
d87fdaa370 Fix the single-sample SampleStream regarding FLAG_REQUIRE_FORMAT
The current FLAG_REQUIRE_FORMAT documentation states: If an end of
stream buffer would be read were the flag not set, then behavior is
unchanged.

PiperOrigin-RevId: 380792251
2021-06-30 13:14:12 +01:00
aquilescanta
81c542b6a7 Remove deprecated ParserException constructor
And replace it with factory method which includes more
context for error code assignment.

PiperOrigin-RevId: 380624625
2021-06-21 22:29:27 +01:00
bachinger
f609fecf9b Parse BaseURL element including DVB attributes in DASH manifest
This change parses the entire BaseURL element including DVB extension attributes, stores it in an instance of new BaseUrl class and puts it in a list of base URLs of the resulting Representation. The base url handling itself is still the same, which means that only the first base url is taken into account, just as before this change.

PiperOrigin-RevId: 380609495
2021-06-21 22:28:17 +01:00
ibaker
f8320287ef Simplify FileDataSourceContractTest
#minor-release

PiperOrigin-RevId: 380531272
2021-06-21 22:21:56 +01:00
ibaker
607fa8bf74 Allow repeated DRM provisioning in DefaultDrmSessionManager
Also change to explicitly track the provisioning session, which makes
the code easier to reason about than always using the zero'th element
of the list.

PiperOrigin-RevId: 380181453
2021-06-21 22:18:57 +01:00
aquilescanta
fc1d3dd192 Make onPlayerError take a PlaybackException
PiperOrigin-RevId: 380174672
2021-06-21 22:15:01 +01:00
ibaker
043c2e7e33 Move CacheDataSourceContractTest to c.g.a.exoplayer2.upstream.cache
This is the package that CacheDataSource and CacheDataSourceTest(2) are
in.

PiperOrigin-RevId: 380156879
2021-06-21 22:12:21 +01:00
ibaker
0f23fddeef Add a test for the provisioning flow to DefaultDrmSessionManagerTest
#minor-release

PiperOrigin-RevId: 379913814
2021-06-21 22:01:38 +01:00
olly
63f12f0216 Remove obsolete Checker Framework suppression strings
More information: go/checker-3130-lsc

Tested:
    TAP for global presubmit queue passed after automated deflaking of failures: http://mondo/deflaker/run/ff80a4f9-d5d7-47ac-9560-63372e1ff624 http://mondo/deflaker/run/ca3ce61f-2af8-4fa7-b6e4-c98b5c4d950c
    http://test/OCL:379405669:BASE:379421861:1623763190392:bd2d256a
PiperOrigin-RevId: 379623080
2021-06-21 21:57:56 +01:00
olly
a3dbd61239 Remove obsolete Checker Framework suppression strings
More information: go/checker-3130-lsc

Tested:
    Some test failures are present, but the CL author has decided to mail the change anyway
PiperOrigin-RevId: 379622938
2021-06-21 21:56:37 +01:00
kimvde
912acacbe1 Add onFastForward/RewindIncrementChanged to Player
PiperOrigin-RevId: 379497408
2021-06-15 18:42:19 +01:00
aquilescanta
5f1921f531 Make Player.getPlayerError return a PlaybackException
PiperOrigin-RevId: 378899373
2021-06-15 18:27:48 +01:00
Oliver Woodman
5f77bf0469 Merge pull request #6500 from DolbyLaboratories:dev-v2-isDirectPlaybackSupported
PiperOrigin-RevId: 378895355
2021-06-15 18:26:27 +01:00
kimvde
aeeef65430 Add onAvailableCommandsChanged to AnalyticsListener
PiperOrigin-RevId: 378886637
2021-06-15 18:24:06 +01:00
kimvde
53d67daaef Add available commands to fast forward and rewind
PiperOrigin-RevId: 378842286
2021-06-11 12:24:37 +01:00
olly
3e819d082a Make javadoc valid html5
As of [JDK-8247957](https://bugs.openjdk.java.net/browse/JDK-8247957), doclint
no longer supports html4.

Tested:
    Some test failures are present, but the CL author has decided to mail the change anyway
PiperOrigin-RevId: 378819179
2021-06-11 12:23:35 +01:00
olly
c728de9947 Fix IncorrectContextUseViolation on Android 11
Issue: #8246
PiperOrigin-RevId: 378606475
2021-06-10 11:25:35 +01:00
samrobinson
5204bb0d44 Add playlist MediaMetadata to the Player.
PiperOrigin-RevId: 378407609
2021-06-10 11:23:30 +01:00
aquilescanta
22b126cac3 Assign ERROR_CODE_IO_NO_PERMISSION to ErrnoException (EACCES)
PiperOrigin-RevId: 378134423
2021-06-08 16:38:44 +01:00
kimvde
e4263c4a67 Add fast forward and rewind methods to Player
PiperOrigin-RevId: 378104210
2021-06-08 13:04:56 +01:00
olly
4b30cca914 Update @SuppressWarnings annotations for go/nullness diagnostics
in preparation for upgrading the version of the Checker Framework in google3.

More information: go/checker-3110-lsc

PiperOrigin-RevId: 377925828
2021-06-08 13:02:47 +01:00
olly
71fb7411ce Notify the client when ExoPlayer fallbacks to a different codec.
PiperOrigin-RevId: 377602447
2021-06-08 13:01:44 +01:00
christosts
fd4cfcdd67 AsynchronousMediaCodecAdapter cleanup
After refactoring MediaCodecAdapter.Factory to create configured and
started MediaCodecAdapters in a single operation, the
AsynchronousMediaCodecAdapter does not need to have separate methods to
configure and start, so they are merged. The CONFIGURED state is
removed.

PiperOrigin-RevId: 377519117
2021-06-08 12:56:39 +01:00
aquilescanta
29eeff9ff7 Assign error codes to FileDataSourceExceptions
PiperOrigin-RevId: 377481210
2021-06-08 12:54:31 +01:00
Dean Wheatley
cb1084f498 Use isDirectPlaybackSupported in AudioCapabilities
For Q devices and higher, use AudioTrack.isDirectPlaybackSupported
for determining AudioCapabilities.
2021-06-07 20:59:31 +10:00
aquilescanta
af4b891c99 Use UnrecognizedFormatException for progressive media only
PiperOrigin-RevId: 377303025
2021-06-03 20:07:04 +01:00
olly
2b6581afe0 Fix nullness checks for addition of Cursor.getString stub
PiperOrigin-RevId: 377298145
2021-06-03 20:05:58 +01:00
kimvde
b0a3bc5b28 Rename ExoFlags to FlagSet
We want to remove mentions of ExoPlayer for
convergence.

PiperOrigin-RevId: 377290376
2021-06-03 20:04:39 +01:00
aquilescanta
36841d4f6f Replace one of the ParserException constructors with factory method
PiperOrigin-RevId: 377281961
2021-06-03 20:03:16 +01:00
olly
bb2e0bc0ef Bump targetSdkVersion to 30
- Remove Robolectric workarounds that are no longer needed
- Add workarounds for b/190021699

PiperOrigin-RevId: 377279422
2021-06-03 20:01:50 +01:00
aquilescanta
89fe0d0cf9 Make AnalyticsListener.onPlayerError take a PlaybackException
NO_EXTERNAL

PiperOrigin-RevId: 377090819
2021-06-03 13:49:28 +01:00
olly
08c882a6ae Trigger reconfiguration on newly obtained MediaCodecAdapters
Add the `needsReconfiguration` API on the `MediaCodecAdapter` interface so that `MediaCodecRenderer` can reconfigure the `MediaCodec` in case a `MediaCodecAdapter` needs to be reconfigured immediately after being obtained from the `MediaCodecAdapter.Factory`.

PiperOrigin-RevId: 376944334
2021-06-02 18:10:01 +01:00
bachinger
2fb61b8ab5 Remove fully qualified package in link tag to avoid reformatting
PiperOrigin-RevId: 376932836
2021-06-02 00:00:55 +01:00
ibaker
58e307c6b0 Keep secure MediaCodec instances when disabling the renderer
A renderer is disabled (without being reset) in two situations:
* When transitioning into a period that starts with a discontinuity
* When stopping the player with setForegroundMode(true)

Before this change the behaviour of `MediaCodecRenderer` when disabled
(but not reset) depended on whether the content being decoded had an
associated `DrmSession`:
* For content without an associated DRM session the MediaCodec instance
  was kept alive.
* For content with an associated DRM session, the MediaCodec instance
  was released. This was to prevent the DRM session from staying alive
  and continuing to make license refresh network requests while the
  player was stopped in 'foreground mode'.

This change removes the second bullet, and keeps MediaCodec instances
alive in both the secure and insecure case. This will result in the
DRM machinery making occasional license refresh network requests (at
a frequency defined by the license policy) while the player is stopped
and in 'foreground mode'. This network usage is considered to be a
'limited resource' as described by the `ExoPlayer#setForegroundMode`
javadoc.

This means that switches between secure content (or between secure and
clear content when `MediaItem.drmConfiguration.sessionForClearTypes`
indicates a secure decoder should be used for clear content) should
keep the same video decoder, thus avoiding the 'black flash' that occurs
on some devices when switching the surface away from a secure decoder.

Issue: #8842

#minor-release

PiperOrigin-RevId: 376825501
2021-06-01 15:48:18 +01:00
ibaker
1bf5a273ff Ensure DefaultDrmSessions keep working if their manager is released
This change introduces a third 'state' for `DefaultDrmSessionManager`:
It's been fully released (prepareCount == 0) but at least one of its
sessions is still active.

In this state new acquisitions are rejected (`(pre)acquireSession()`
calls will fail) but the machinery to support the existing sessions
(ExoMediaDrm and MediaDrmHandler) is kept until they're all released.

This change will allow us to remove the TODO in MediaCodecRenderer
that resolves Issue: #8842.

PiperOrigin-RevId: 376193952
2021-05-27 18:56:29 +01:00
ibaker
4cca8b6d4a Add a test for handling of DRM key refresh events
In a follow-up change I will add an additional test to ensure these
events continue to be correctly handled when DefaultDrmSessionManager
has prepareCount==0 but a non-null ExoMediaDrm instance.

PiperOrigin-RevId: 376190225
2021-05-27 18:55:03 +01:00
olly
513185b72a Fix incorrect re-use of non-secure DummySurface with secure decoder
Issue: #8776
PiperOrigin-RevId: 376186877
2021-05-27 18:53:47 +01:00
tonihei
2938d40bf4 Allow to specify the number of removed ad groups in AdPlaybackState.
This helps to remove old ad groups (e.g. those that fell out
of the live window) to keep the data size of AdPlaybackState small.

Also added this case to some existing unit tests to ensure it's
covered.

PiperOrigin-RevId: 376170653
2021-05-27 18:49:53 +01:00
tonihei
0d0ccadc83 Add getter for ad groups in AdPlaybackState.
This allows to decouple the data structure from the access. In
a future change, this allows to completely remove old ad groups
(e.g. for live streams where the number of groups would otherwise
grow forever).

Also move the time into the group itself for better encapsulation.

PiperOrigin-RevId: 376170408
2021-05-27 18:48:40 +01:00
aquilescanta
c353151288 Add errorCode to the EventLogger
PiperOrigin-RevId: 376126959
2021-05-27 16:00:32 +01:00
ibaker
e7516fe4e0 Throw from (pre)acquireSession if the DrmSessionManager isn't prepared
Currently acquireSession() fails with an NPE from
checkNotNull(exoMediaDrm). A follow-up change will result in exoMediaDrm
sometimes being non-null while prepareCount==0 (and in this case we
still want acquireSession() to fail).

preacquireSession() doesn't currently fail in a way the caller can
observe - the same NPE is thrown, but asynchronously and it doesn't
propagate out of the background thread. Throwing directly seems
preferable since it's a clear bug to be trying to preacquire sessions
from an unprepared/released manager.

PiperOrigin-RevId: 375906450
2021-05-27 10:36:20 +01:00
aquilescanta
a1ecf3193a Assign ERROR_CODE_PARSING_* to ParsingException
PiperOrigin-RevId: 375515685
2021-05-26 11:29:53 +01:00
Oliver Woodman
afe4217c1c Merge pull request #8943 from dlafayet:embeddedstyle2
PiperOrigin-RevId: 375484765
2021-05-26 11:28:37 +01:00
ibaker
5afc915e51 Don't restore DRM keys before releasing them
#minor-release

PiperOrigin-RevId: 375436117
2021-05-26 11:26:09 +01:00
aquilescanta
2c2197d12c Assign ERROR_CODE_IO_BAD_HTTP_STATUS to InvalidResponseCodeException
PiperOrigin-RevId: 374885599
2021-05-21 12:03:39 +01:00
tonihei
d08303d05d Add ServerSideInsertedAdsMediaSource.
This media source wraps another source and publishes a Timeline with
ads. The created MediaPeriods for ad and content are mapped back to
the original stream to allow seamless playback.

PiperOrigin-RevId: 374836091
2021-05-20 15:43:00 +01:00
tonihei
1a6f36d4a4 Fix reading position at stream transition.
PiperOrigin-RevId: 374836046
2021-05-20 15:42:31 +01:00
tonihei
8eb990e47a Make SSAI player logic more targeted.
There is a newly added condition to help advancing between SSAI ads
and content in case the ad group position or ad duration changed. The
condition currently doesn't check directly whether it's a SSAI
transition but relies on indrect signals. Making this more direct
helps to understand the purpose and avoid unintentional bugs where
this condition would apply in other cases too.

In addition, we need to exclude TextRenderer from the check because
its read position doesn't correspond to the actual decode position
since the decoding happens in the renderer itself (b/181312195).

PiperOrigin-RevId: 374835985
2021-05-20 15:42:02 +01:00
tonihei
5ff4211c5e Avoid recalculation of whether a MediaPeriod is part of a SSAI stream
We can instead just save this information in MediaPeriodInfo, similar
to how we store whether the MediaPeriod is last in the timeline etc.

PiperOrigin-RevId: 374835918
2021-05-20 15:41:34 +01:00