248 Commits

Author SHA1 Message Date
kimvde
01613a2e55 Remove usages of deprecated SimpleExoPlayer.Builder
PiperOrigin-RevId: 390130681
2021-08-11 17:34:19 +01:00
olly
b627d70054 Migrate uses of deprecated DataSource factories
PiperOrigin-RevId: 389844289
2021-08-10 14:56:20 +01:00
olly
7e8ba03147 Deprecate final non-nested Factory classes in upstream
PiperOrigin-RevId: 389661768
2021-08-09 20:07:24 +01:00
olly
c71fa05c88 Correctly remove package-info.java from empty packages
#minor-release

PiperOrigin-RevId: 373550935
2021-05-13 12:09:17 +01:00
bachinger
4c1a294b2e Format Java source files
PiperOrigin-RevId: 372127633
2021-05-06 13:32:25 +01:00
christosts
7af95230cb DebugMediaCodecVideoRenderer: expect output format change after flush
The DebugMediaCodecVideoRenderer expects the MediaCodec to return an
output format change after the MediaCodecRenderer detects an input
format change, but the DebugMediaCodecVideoRenderer resets its state
after flushing MediaCodec. This does not cover the following case: an
input format change is detected when queueing sample with timestamp X
and before the respective output buffer is dequeued, the player seeks
back to X. After seeking back to X, the MCR does not trigger an input
format change for X again, and MediaCodec (correctly) returns an output
format change before dequeueing output X.

This commit is changing DebugMediaCodecVideoRenderer to keep expecting
an output format change after a flush, is one a format pending output.
Such an an edge-case is addressed already in MediaCodecRenderer.

PiperOrigin-RevId: 370482506
2021-04-26 18:29:37 +01:00
christosts
a162d689b6 MediaCodecRenderer: do not call protected methods from constructor
MediaCodecRenderer is calling its protected methods
resetCodecStateForRelease() and resetCodecStateForFlush() from its
constructor. Classess that override the methods (eg.
DebugMediaCodecVideoRenderer) need to checks if the methods
are called from the superclass constructor thus their members are not
initialized yet.

With this change, the MCR constructor does not call the two
methods and sets the respective state directly on its fields.

PiperOrigin-RevId: 370445978
2021-04-26 18:29:13 +01:00
christosts
2fba921558 DebugMediaCodecVideoRenderer clean-up
After refactoring MediaCodecRenderer's configureCodec() to
getMediaCodecConfiguration(), there was some state initialization left
in DebugMediaCodecVideoRenderer's configureCodec(). This is now moved
inside DebugMediaCodecVideoRenderer.onCodecInitialized().

PiperOrigin-RevId: 370430193
2021-04-26 18:17:03 +01:00
olly
7a13163664 MediaCodecAdapter.Factory creates a started Adapter.
This change moves the responsibility of creating, configuring and starting the MediaCodec from the MediaCodecRender to the MediaCodecAdapter.Factory.

This move allows ExoPlayer's client to decide how and when codecs are created and/or reused.

To allow the move, this CL replaces MediaCodecRenderer.ConfigureCodec with MediaCodecRenderer.getCodecConfiguration

PiperOrigin-RevId: 369273887
2021-04-20 00:10:36 +01:00
ibaker
61a5ca480e Reduce the diff between different versions of GTS tests
This means there are fewer changes required when exporting these tests
as part of the GTS suite run by device manufacturers.

PiperOrigin-RevId: 367230977
2021-04-09 13:18:37 +01:00
ibaker
84ce648c90 Move @Ignore from class to methods in DashWidevineOfflineTest
PiperOrigin-RevId: 365794941
2021-04-01 16:04:16 +01:00
ibaker
710dff0388 Disable setOutputSurface workaround for all codecs in GTS tests
Issue: #8427
PiperOrigin-RevId: 355381785
2021-02-03 15:03:24 +00:00
olly
a1f06987eb Replace non-inclusively named constant
Issue: #7565
PiperOrigin-RevId: 353649187
2021-01-25 17:38:26 +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
ibaker
71c2b8a76c Re-add the v22 and v29 test targets
PiperOrigin-RevId: 351393044
2021-01-13 00:04:06 +00:00
ibaker
704f006be1 Remove mobile_test_v29 while the V29 tests are disabled
PiperOrigin-RevId: 351117930
2021-01-11 18:05:14 +00:00
ibaker
1057f2e455 Remove mobile_test_v22 while the V22 tests are disabled
PiperOrigin-RevId: 350578598
2021-01-08 15:32:47 +00:00
ibaker
a25ad03b9f Disable DashWidevineOfflineTest
These tests are performing offline-centric assertions using a streaming
licence. They need to be reconfigured to use a new offline-centric
licence that sets the correct duration fields (rental_duration_seconds
and playback_duration_seconds).

PiperOrigin-RevId: 350550971
2021-01-08 15:32:16 +00:00
krocard
538445572d Move FormatSupport in common
#player-to-common

PiperOrigin-RevId: 344558028
2020-11-30 09:33:11 +00:00
olly
c47e62209d Report reasons for not being able to reuse decoders
PiperOrigin-RevId: 342344090
2020-11-16 16:49:48 +00:00
ibaker
99b87139df Change Truth assertions in DashWidevineOfflineTest to increase clarity
PiperOrigin-RevId: 342040610
2020-11-13 14:55:01 +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
ibaker
32194def67 Exclude PC devices from H.265 GTS tests
PiperOrigin-RevId: 333031399
2020-09-25 16:29:53 +01:00
olly
b2b08ade99 Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:41:51 +01:00
samrobinson
99dbb76455 Allow Format change in GTS test for MediaFormat time check.
PiperOrigin-RevId: 330348510
2020-09-07 20:43:19 +01:00
samrobinson
d1631cf86f Disable MediaFormat time check GTS test temporarily.
PiperOrigin-RevId: 329956142
2020-09-07 20:42:51 +01:00
samrobinson
0f29b9e84d Change GTS test boolean to a final variable.
PiperOrigin-RevId: 329714283
2020-09-07 20:41:46 +01:00
ibaker
5b80eb8ecc Enable multidex for the playback tests
PiperOrigin-RevId: 329527311
2020-09-07 20:40:23 +01:00
ibaker
91185500a1 Remove usage of assertThrows from ExoPlayer GTS tests
The environment these tests are executed in is only using JUnit 4.10,
which doesn't have assertThrows.

PiperOrigin-RevId: 329462985
2020-09-07 20:39:55 +01:00
andrewlewis
d881a675d0 Check output format change timing after API 30
PiperOrigin-RevId: 327795332
2020-08-26 16:38:57 +01:00
andrewlewis
0d8f016d33 Assume software decoder fix will happen before API 31 too
PiperOrigin-RevId: 327782731
2020-08-21 12:55:37 +01:00
samrobinson
7abece9a39 Add a software decoder check to MediaFormat change GTS test.
PiperOrigin-RevId: 327620772
2020-08-21 12:51:42 +01:00
ibaker
3af82b2a8b Skip WV tests on devices where WV is unsupported
PiperOrigin-RevId: 327392056
2020-08-21 12:50:47 +01:00
olly
7588c26b60 Remove support for cbc1 and cens encryptions schemes
PiperOrigin-RevId: 327199833
2020-08-21 12:48:39 +01:00
samrobinson
1b9992cf7a Add a GTS test for MediaFormat change occurring at the correct time.
PiperOrigin-RevId: 326428782
2020-08-17 16:12:12 +01:00
aquilescanta
fcb263a407 Make DrmSessionManager take a Format instead of DrmInitData
Skipping acquirePlaceholderSession which will be removed
in a following change.

PiperOrigin-RevId: 326402746
2020-08-17 16:11:17 +01:00
ibaker
fda3b3d8ec Use static imports for methods that make sense without their class name
PiperOrigin-RevId: 323349585
2020-07-27 23:59:52 +01:00
ibaker
161dea661f Assorted deprecation fixes/migrations/suppressions
These were missed on the first pass

PiperOrigin-RevId: 321553847
2020-07-24 10:37:41 +01:00
ibaker
ab95e3f388 Migrate usages of deprecated SimpleCache constructors
I duplicated some methods in SimpleCacheTest to ensure we keep testing
the deprecated code paths for now.

PiperOrigin-RevId: 321548802
2020-07-24 10:37:14 +01:00
ibaker
5c4b8085a0 Migrate usages of DefaultDrmSessionManager constructor to Builder
PiperOrigin-RevId: 321174738
2020-07-24 10:34:21 +01:00
ibaker
2f19b63ca0 Add package-info files to packages that only exist in tests
This doesn't affect the nullness checker or Kotlin, but it does make
weird warnings appear in Android Studio. It seems mildly preferable to
have the same spurious warnings in these files that we have in other
tests, rather than different spurious warnings.

PiperOrigin-RevId: 321173760
2020-07-24 10:34:12 +01:00
ibaker
fa594489d9 Completely separate MediaSource & DrmSession EventDispatchers
PiperOrigin-RevId: 319989989
2020-07-08 13:55:38 +01:00
samrobinson
81b0b53a37 Propagate gapless audio delay & padding.
MediaCodec does not need to be re-created in the
event of gapless metadata.

PiperOrigin-RevId: 318439694
2020-06-26 11:23:19 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
christosts
41d4a132c4 Add configure() in MediaCodecAdapter
The correct order of initializing the MediaCodec should be (as per
documentation
https://developer.android.com/reference/android/media/MediaCodec#initialization)

"create -> setCallback -> configure -> start"

but the MediaCodecRenderer currently does

"create -> configure -> setCallback -> start"

MediaCodec implementations did not complain about this so far, but the
wrong sequence does not work with the MediaCodec in block mode (new mode
in Android R) and also the ShadowMediaCodec won't operate in
asynchronous mode otherwise. To initialize the MediaCodec in the correct
order, this commit adds configure() in the MediaCodecAdapter so the
MediaCodecRenderer can do:

adapter.configure(); // sets the callback and then configures the codec
adapter.start();     // starts the codec

PiperOrigin-RevId: 316127680
2020-06-17 14:28:57 +01:00
ibaker
b9157a9e23 Add Guava dependency to ExoPlayer
Guava is heavily optimized for Android and the impact on binary size
is minimal (and outweighed by the organic growth of the ExoPlayer
library).

This change also replaces Util.toArray() with Guava's Ints.toArray()
in order to introduce a Guava usage into a range of modules.

PiperOrigin-RevId: 312449093
2020-05-21 17:08:33 +01:00
bachinger
9e35c6c28c Make all segment downloader use the media item
PiperOrigin-RevId: 311527440
2020-05-14 22:24:31 +01:00
tonihei
13c668f9e0 Fix Widevine offline test assertion for API29+.
The error type thrown when acquiring a license that has already
been released changed from MediaDrmStateException to IllegalStateException
from API 29.

Update the tests to assert the correct type of error based on API version.

PiperOrigin-RevId: 308239508
2020-04-27 10:41:50 +01:00
olly
6f2891e5c4 Remove usages of deprecated CacheDataSourceFactory
PiperOrigin-RevId: 307684243
2020-04-27 10:39:34 +01:00
olly
4abaaf138c Remove DownloadConstructorHelper
Something that helps a constructor always seemed a bit strange.
It's now possible to use CacheDataSource.Factory directly instead.

PiperOrigin-RevId: 307661930
2020-04-27 10:39:34 +01:00