55 Commits

Author SHA1 Message Date
aquilescanta
9d460023a2 Use fluent assertions
Gives a bit more information upon failures

PiperOrigin-RevId: 451882968
2022-05-30 16:55:07 +00:00
ibaker
8f3b4f590f Fix typos flagged by lint
PiperOrigin-RevId: 451135097
2022-05-30 16:30:11 +00:00
ibaker
26a1817ebf Rollback of e01bb47263
*** Original commit ***

Rollback of 07302a23bd

*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default imple...

***

PiperOrigin-RevId: 450453325
2022-05-23 17:12:22 +01:00
ibaker
1d139174fd Rollback of 07302a23bd5894d57514c68b2db499ac46726e77
*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450410833
2022-05-23 13:01:22 +01:00
ibaker
07302a23bd Remove @Nullable from MediaSource.Factory setters
The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450386627
2022-05-24 11:07:07 +01:00
rohks
001090cc43 Migrate leaf listeners of Player to new onCues override
PiperOrigin-RevId: 449587030
2022-05-24 11:02:03 +01:00
rohks
c728647290 Create new class to store cues and timestamp.
We need to pass timestamp for the list of cues so we are defining a new class CueGroup which will store both cues and timestamp.

PiperOrigin-RevId: 449212054
2022-05-24 10:49:48 +01:00
ibaker
9a67b30750 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 10:46:04 +01:00
ibaker
fd6b57469d Fix calculations that may lose precision compared to their target type
PiperOrigin-RevId: 444861268
2022-05-09 10:21:44 +01:00
olly
83daa052cb Rename TracksInfo and TrackGroupInfo
1. TracksInfo is renamed to Tracks
2. TracksInfo.TrackGroupInfo is renamed to Tracks.Group

PiperOrigin-RevId: 441232373
2022-04-26 14:30:14 +01:00
hschlueter
81ab6c730d Fix non-inclusive language in class names.
https://source.android.com/setup/contribute/respectful-code#term-examples

PiperOrigin-RevId: 438335305
2022-04-06 11:28:30 +01:00
olly
5d8ac644a6 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
olly
2ea902c1b2 Move TrackSelection back to ExoPlayer module
PiperOrigin-RevId: 433729648
2022-03-24 17:21:11 +00:00
olly
fdbae6379d Simplify application of track overrides
PiperOrigin-RevId: 432485797
2022-03-04 18:54:25 +00:00
olly
bdc3af1416 Remove deprecated Player track methods
getCurrentTrackGroups and getCurrentTrackSelections are
retained for now, but moved from Player to ExoPlayer, to
ease the transition for some application code that currently
uses these methods.

PiperOrigin-RevId: 430036355
2022-02-22 10:35:04 +00:00
olly
fdd3973a09 Fix potential NPE in test_utils WebServerDispatcher
PiperOrigin-RevId: 429338648
2022-02-18 14:56:01 +00:00
Ian Baker
38717ce969 Reformat some javadoc 2022-02-18 14:54:02 +00:00
bachinger
f3cc5327cd Do not manipulate the duration of SSAI periods in FakeTimeline
#minor-release

PiperOrigin-RevId: 428727560
2022-02-17 11:52:23 +00:00
bachinger
a72f04f9b0 Resolve media period ids in multi-period windows
Ignorable ad periods are skipped to resolve the media period id with the
ad playback state of the resulting period. In case of a change in the period
position un-played ad periods are rolled forward to be played.

PiperOrigin-RevId: 428011116
2022-02-17 10:26:59 +00:00
tonihei
6dae8746ad Stop using SimpleExoPlayer for tests
The class is deprecated and all tests should preferably use the
non-deprecated code paths.

PiperOrigin-RevId: 428007986
2022-02-17 10:25:19 +00:00
krocard
8f7c91a1ad Split AnalyticsCollector in interface and default Impl
This will allow R8 to strip out the implementation
if it is not needed for an app.

#minor-release

PiperOrigin-RevId: 427983730
2022-02-17 10:23:00 +00:00
tonihei
5cc3ce9a50 Remove deprecated EventListener
PiperOrigin-RevId: 427133817
2022-02-08 11:07:50 +00:00
tonihei
287182952d Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 11:07:50 +00:00
olly
1f7174e731 Revert of 87420e5f9bd1671cd3068185f7358f5faba53e71
PiperOrigin-RevId: 426996878
2022-02-08 11:07:43 +00:00
olly
631b107bda Revert of 9c8c0a59823e2a49451fbdf7040107c6cea43cc5
PiperOrigin-RevId: 426994820
2022-02-08 11:07:24 +00:00
olly
9c8c0a5982 Remove deprecated EventListener
PiperOrigin-RevId: 426876984
2022-02-08 10:21:37 +00:00
ibaker
87420e5f9b Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 10:49:31 +00:00
ibaker
6fc5f9800e Mark @C.SelectionReason as TYPE_USE (only) and use it in more places
This is not backwards compatible if the @SelectionReason annotation is
used in Kotlin code, but before this change there aren't many library
surfaces that return a value annotated with @SelectionReason, so it
seems relatively unlikely that it is in use in any/many apps.

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426409877
2022-02-07 10:46:18 +00:00
ibaker
8149ac8922 Mark all non-public IntDefs as only TYPE_USE
This only changes IntDefs that cannot be used by apps because they're
either private or package-private.

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426372273
2022-02-04 14:51:52 +00:00
olly
cb81b04dab Use ImmutableMap.Builder.buildOrThrow() instead of deprecated build().
More info: ​go/immutable-map-buildorthrow-lsc

NOTE: if the source of truth for this code is *NOT* `third_party`, please let me know and I'll revert this CL (and please consider upstreaming this change yourself).

#inlineme

Tested:
    TAP for global presubmit queue passed after automated deflaking of failures: http://mondo/deflaker/run/530857d2-45cb-4069-a234-48c5efe945f1 http://mondo/deflaker/run/0dce4296-e6bb-42d2-8b64-b393f45b6ad3
    http://test/OCL:425453729:BASE:425451020:1643699365244:811c1a24
PiperOrigin-RevId: 425616165
2022-02-01 18:21:37 +00:00
olly
f28de9de60 Rewrite EventLogger to use new track APIs
PiperOrigin-RevId: 425595951
2022-02-01 14:35:06 +00:00
tonihei
2521ee6d9f Add getRenderer method to ExoPlayer.
This allows access to custom renderers, for example to send messages
or to access custom fields and methods.

PiperOrigin-RevId: 424878963
2022-01-28 16:52:10 +00:00
tonihei
857c18b2e9 Remove opt-out for suppressing wrong thread usage error.
Enforcing the correct thread usage has been enabled since 2.13.0.
Opting-out of this enforement is dangerous as it can hide very hard
to debug bugs.

PiperOrigin-RevId: 424815808
2022-01-28 16:29:20 +00:00
hschlueter
f40f290a30 Remove Transformer-specific things from MediaCodecAdapter.
PiperOrigin-RevId: 421514944
2022-01-25 18:05:31 +00:00
ibaker
34a1f884dc Add MediaSource.Factory and deprecate MediaSourceFactory
This more closely matches the pattern we have for all implementations
except DefaultMediaSourceFactory (e.g. ProgressiveMediaSource.Factory)
and other factory interfaces like (Http)DataSource.Factory.

PiperOrigin-RevId: 417826803
2022-01-05 10:51:41 +00:00
ibaker
b63c0593b5 Mark FakeMediaSourceFactory final
There's no need to extend this class. Factories for subclasses of
FakeMediaSource will need to re-implement createMediaSource, at which
point they basically need to re-implement the whole factory interface.

PiperOrigin-RevId: 417817499
2022-01-05 10:50:40 +00:00
ibaker
cee7e8e2db Delete deprecated methods from MediaSourceFactory
Some have been deprecated since 2.13.0
([commit](5b9fa7d7d9)):
* `setDrmSessionManager(DrmSessionManager)`
* `setDrmHttpDataSourceFactory(HttpDataSource.Factory)`
* `setDrmUserAgent(String)`

And the rest have been deprecated since 2.12.0
([commit](d1bbd3507a)):
* `setStreamKeys(List<String>)`
* `createMediaSource(Uri)`

PiperOrigin-RevId: 417622794
2022-01-05 10:44:23 +00:00
christosts
531ff0e19d Add getMetrics() in MediaCodecAdapter
Before the introduction of the MediaCodecAdapter, users could get
access directly to the MediaCodec instance from
MediaCodecRenderer.getCodec() and then retrieve the codec metrics.

This change exposes MediaCodec.getMetrics() on the MediaCodecAdapter.

Issue: google/ExoPlayer#9766

#minor-release

PiperOrigin-RevId: 416343023
2022-01-05 10:17:49 +00:00
ibaker
1fa69a9080 Make DecoderCountersUtil error message clearer
By including the full counters in the failure message we have a clearer
insight into the cause of the failure.

PiperOrigin-RevId: 415982732
2022-01-05 09:55:44 +00:00
ibaker
d0c59eb5f1 Rename DecoderCounters#inputBufferCount to queuedInputBufferCount
This more accurately reflects the value stored in this field.

PiperOrigin-RevId: 414762892
2021-12-10 11:07:24 +00:00
krocard
341bb57498 Add a builder to DefaultAudioSink
`DefaultAudioSink` already has 3 telescoping
constructors and an other one would be have been
needed to add a buffer size tuning option.

PiperOrigin-RevId: 414703366
2021-12-07 17:37:45 +00:00
ibaker
dcc69056bf Fix how drop-to-keyframe events are recorded in DecoderCounters
The existing code creates an imbalance between `inputBufferCount` and
`droppedBufferCount` by adding 'dropped source buffers' to
`droppedBufferCount` but not to `inputBufferCount`. This results in
assertion failures in `DashTestRunner`.

PiperOrigin-RevId: 414672175
2021-12-07 17:37:45 +00:00
olly
f2ad8ccd3c Shorten log tags to 23 char limit
When calling Android's Log class directly, there's a LongLogTag
lint check that detects tags over the 23 char limit, however it
cannot detect long log tags in ExoPlayer due to the way that we
log via our own Log class. This commit adds @Size annotations to
enforce the same rule.

PiperOrigin-RevId: 413976364
2021-12-07 17:37:31 +00:00
Ian Baker
30caac6fc3 Merge pull request #9536 from TiVo:p-fix-issue-2882
PiperOrigin-RevId: 411056555
2021-11-22 17:00:01 +00:00
tonihei
9af85d9b25 Move DrmSessionManager initial player setup to its own method.
Currently, DrmSessionManager takes player specific values (= the
playback looper) through (pre)acquireSession calls and requires
the caller to pass in the same values every time.

Instead, we can configure the DrmSessionManager for playback with
a player once before it's being used. We can't simply extend the
prepare() method as prepare may be called before the player is
created to prewarm the DrmSessionManager.

The new method also takes a PlayerId which is bound to the lifetime
of the player similar to the playback looper.

To avoid breakage of custom MediaSources with DRM, we can keep the
old the SampleQueue.createWithDrm method as deprecated.

PiperOrigin-RevId: 410998240
2021-11-19 15:12:13 +00:00
ibaker
191185096c Remove null keys from DefaultHttpDataSource#getResponseHeaders
PiperOrigin-RevId: 410507648
2021-11-19 14:56:43 +00:00
tonihei
5d8bb7ddd2 Plumb PlayerId to MediaSource.
MediaSource can be reused with other Player instances after they
have been released, so we need to set the PlayerId when preparing
the source. Access can mostly be handled by the implementation in
BaseMediaSource.

PiperOrigin-RevId: 408878824
2021-11-19 14:35:52 +00:00
ibaker
f7bb6e0a23 Fix header name in WebServerDispatcher used for testing
HTTP header names are case-insensitive, but all the others in this file
are 'correctly' cased, so we might as well be consistent.

PiperOrigin-RevId: 408840566
2021-11-19 14:34:56 +00:00
ibaker
ded68ed981 Add contract tests for DataSource#getResponseHeaders
PiperOrigin-RevId: 408840409
2021-11-19 14:33:46 +00:00
ibaker
686f2ca96d Migrate usages of Window-based Player methods
Where this introduced an inconsistency (e.g. assigning to something
called `windowIndex`), I generally renamed the transitive closure of
identifiers to maintain consistency (meaning this change is quite
large). The exception is code that interacts with Timeline and Window
directly, where sometimes I kept the 'window' nomenclature.

#minor-release

PiperOrigin-RevId: 407040052
2021-11-09 10:07:30 +00:00