227 Commits

Author SHA1 Message Date
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
olly
c007068ddb Expect PresentationTime Discontinuity During Stream Transitions
PiperOrigin-RevId: 440378974
2022-04-26 14:21:36 +01:00
huangdarwin
9a7b71b7c2 Media Solutions: Fix misspelling for "roboletric"
roboletric -> robolectric

PiperOrigin-RevId: 440101421
2022-04-26 14:16:37 +01:00
olly
eb038265f3 Make MediaCodecVideoRenderer.getCodecMaxInputSize public.
PiperOrigin-RevId: 439866306
2022-04-26 14:12:25 +01:00
Ian Baker
ea61511a24 Merge pull request #10047 from LuGO0:9432/added-filtering-for-forced-text-tracks
PiperOrigin-RevId: 439262085
2022-04-06 11:50:35 +01:00
olly
f8f8b75500 Exclude TrackGroup fields/methods from the stable API
App code should get all of this information from TrackGroupInfo,
and should only need TrackGroup as a key to use for overrides.

PiperOrigin-RevId: 438840925
2022-04-06 11:46:49 +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
ibaker
9d48cff9ff Remove IntDef warning suppression from DefaultTrackSelector
The problem is not the IntDef array, it's the fact the lint tool
is unable to correctly infer the annotations on the lambda parameters
without them being explicitly annotated. It seems explicitly annotating
is better than suppressing all IntDef warnings in the whole method.

PiperOrigin-RevId: 437969271
2022-04-06 11:17:06 +01:00
andrewlewis
c87d16ca63 Handle non-standard MIME type on LG AC3 decoder
PiperOrigin-RevId: 437057336
2022-03-25 14:06:06 +00:00
ibaker
fe8996e634 Allow stable API users to customise the DataSource used
Also stabilise the 3 HTTP-based DataSource implementations:
* DefaultHttpDataSource
* OkHttpDataSource
* CronetDataSource

PiperOrigin-RevId: 436690643
2022-03-23 10:05:27 +00:00
ibaker
534bc5ad9d Deprecate DefaultDrmSessionManager#setDrmUserAgent
PiperOrigin-RevId: 436521418
2022-03-22 18:13:26 +00:00
ibaker
54d3e45473 Switch DRM and download components from HttpDataSource to DataSource
All the (Http)DataSource interactions can be done with the DataSource
interface and don't need HttpDataSource.

PiperOrigin-RevId: 436520898
2022-03-22 18:11:31 +00:00
olly
5d8ac644a6 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
aquilescanta
1a6e176873 Rework if condition to avoid NewApi lint error
Some infra thinks the if does not protect against API incompatibilities
(example: Android's soong build system). AndroidStudio 2021.3.1 also
signals a warning.

#minor-release

PiperOrigin-RevId: 435027073
2022-03-16 13:01:35 +00:00
olly
298e61398e Improve EventLogger metadata logging
1. Fix indentation
2. Fix intention to only log one Metadata block

PiperOrigin-RevId: 434818209
2022-03-15 19:02:41 +00:00
olly
2ea902c1b2 Move TrackSelection back to ExoPlayer module
PiperOrigin-RevId: 433729648
2022-03-24 17:21:11 +00:00
ibaker
50efd86619 Rollback of d5482fe343
*** Original commit ***

Don't call MediaDrm.setLogSessionId in FrameworkMediaDrm

This method throws an UnsupportedOperationException on some Android 12
devices.

***

PiperOrigin-RevId: 433708582
2022-03-24 17:19:59 +00:00
bachinger
e5d1466731 Avoid rebuffering at the end of SSAI post-rolls
When the start position of a MediaPeriodInfo is equal or higher than the duration,
we set the start position to `duration - 1` to end on the last frame. With server
side inserted ad streams, this has the effect that we actually need to seek back to
the last content frame after a post-roll.

This is desirable when actually ending on that frame but produces a BUFFERING event
when transitioning from an SSAI stream with a post-roll to the next media item in
the playlist. This change sets the start position to the duration when we are
clipping the last content period of an SSAI stream that is played in a playlist.

PiperOrigin-RevId: 433445680
2022-03-09 12:22:02 +00:00
bachinger
c7c7517322 Ignore MetadataRenderer when evaluating SSAI period transitions
This makes the reading period advance early as expected at the end of an ad
period. Before this change the reading position of the metadata renderer
prevented advancing the period until metadata arrived after the start position of
the following period. Only then the reading position of the metadata renderer
is updated and beyond the start position of the following period which is a
condition to advance the reading period.

Because transitioning to the next period is a virtual transition and the
SharedMediaPeriod keeps reading from the same underlying sample streams, the
metadata renderer can safely be ignored for this check.

#minor-release

PiperOrigin-RevId: 432646037
2022-03-05 14:16:43 +00:00
olly
fdbae6379d Simplify application of track overrides
PiperOrigin-RevId: 432485797
2022-03-04 18:54:25 +00:00
olly
23db11453d DownloadHelper: Add getTracksInfo
We will be migrating our track selection UI components to be
based on TracksInfo. We need DownloadHelper to expose TracksInfo
to make it compatible with such components.

PiperOrigin-RevId: 432474487
2022-03-04 18:10:45 +00:00
olly
0206622370 DownloadHelper: Support multiple track selection overrides
addTrackSelectionForSingleRenderer takes a list of legacy overrides,
which are then set on the supplied parameters one at a time to run
track selection. This allows multiple overrides for a single track
type to be applied in the download use case, despite it not being
possible to place such overrides directly into a single parameters.

For new style overrides, multiple overrides for the same track type
can be placed directly into a single parameters. Therefore we'll be
able to replace use of addTrackSelectionForSingleRenderer with use
of addTrackSelection, which is a much cleaner API. For this to work,
we need to make DownloadHelper apply multiple overrides in this case.

PiperOrigin-RevId: 432459834
2022-03-04 17:06:26 +00:00
andrewlewis
a73a9e9ca5 Fix E-AC3 output capability check without sample rate
#minor-release

PiperOrigin-RevId: 432189509
2022-03-07 11:29:06 +00:00
ibaker
232f2d815d Deprecate SingleSampleMediaSource.Factory#setTrackId
This method is no longer needed since we added SubtitleConfiguration#id
in 59d98b9a4e.

Issue: google/ExoPlayer#10016

#minor-release

PiperOrigin-RevId: 432169262
2022-03-07 11:28:25 +00:00
olly
2d3eea1e24 DownloadHelper: Accept generic TrackSelectionParameters
DownloadHelper is in the ExoPlayer module, so there's no reason
why it can't use ExoPlayer specific track selections. That said,
we want our UI components to operate on generic
TrackSelectionParameters, and we want such UI components to be
useful for selecting tracks for download. To keep this interop,
it's necessary to have DownloadHelper accept generic
TrackSelectionParameters, or to require application code to
convert them. The first approach seems preferable!

PiperOrigin-RevId: 432158846
2022-03-03 12:17:33 +00:00
olly
6c6e256cfb TrackSelectionOverride: Remove select-all-tracks constructor
This constructor always does the wrong thing for non-adaptive groups
containing more than 1 track, because it'll incorrectly generate an
adaptive selection. Replace it with a constructor for specifying a
single track within the group instead.

PiperOrigin-RevId: 431673458
2022-03-03 12:14:42 +00:00
olly
68c310a94a TrackSelectionParameters: Simplify disabling of track types
As evidenced by the somewhat awkward logic in PlayerControlView, the
previous design wasn't very friendly to expected usage. There will be
more usage when the track selection dialog components are migrated,
which would be similarly awkward without this change.

PiperOrigin-RevId: 431407675
2022-03-01 09:45:38 +00:00
Ian Baker
c961ea1ca7 Merge pull request #10011 from tonykwok:dev-v2
PiperOrigin-RevId: 431395359
2022-03-01 09:44:52 +00:00
ibaker
9748695e03 Rollback of 99d2b11329
*** Original commit ***

Rollback of caf62842c4

*** Original commit ***

Rollback of c2cb22a056

*** Original commit ***

Rollback of 1521e50307

*** Original commit ***

PiperOrigin-RevId: 430905772
2022-03-01 09:36:50 +00:00
christosts
4703ac80f6 Remove experimental flag for AsynchronousMediaCodecAdapter
The AsyncronousMediaCodecAdapter should call MediaCodec.start()
on the same thread it calls MediaCodec.flush(), i.e. the playback
thread. This change removes the experimental flag that allowed
calling MediaCodec.start() from the callback thread.

The flag was flipped to true already.

PiperOrigin-RevId: 430689665
2022-03-01 09:35:04 +00:00
ibaker
d5482fe343 Don't call MediaDrm.setLogSessionId in FrameworkMediaDrm
This method throws an UnsupportedOperationException on some Android 12
devices.

PiperOrigin-RevId: 430647264
2022-03-01 09:33:05 +00:00
ibaker
42340bf5ac Fix DefaultAnalyticsCollectorTest failure when run with JaCoCo
#minor-release

PiperOrigin-RevId: 430189385
2022-02-22 17:01:55 +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
ibaker
99d2b11329 Rollback of caf62842c4
*** Original commit ***

Rollback of c2cb22a056

*** Original commit ***

Rollback of 1521e50307

*** Original commit ***

Wire up MediaMetricsListener and add configuration to...

***

PiperOrigin-RevId: 429585773
2022-02-22 10:28:20 +00:00
Ian Baker
38717ce969 Reformat some javadoc 2022-02-18 14:54:02 +00:00
olly
265dd079e9 Move track type from TrackGroupInfo to TrackGroup
The track type is derived solely from the content. It does
not depend on any runtime properties such as the player's
capabilities of user track selection. Hence it belongs in
TrackGroup rather than TrackGroupInfo.

Note that this avoids TrackSelectionOverride from having to
re-derive the track type internally.

PiperOrigin-RevId: 429303312
2022-02-17 16:14:16 +00:00
olly
9137947797 Add TracksInfo methods for track selection UI
We need TracksInfo.hasTracksOfType to determine which tabs to
display in TrackSelectionDialog.

We need TrackGroupInfo.isAdaptiveSupported to determine whether
to allow multiple selection (check boxes) or not (radio buttons).

PiperOrigin-RevId: 428793739
2022-02-17 11:52:23 +00:00
olly
8b01d07512 Flatten TrackSelectionParameters
PiperOrigin-RevId: 428747243
2022-02-17 11:52:23 +00:00
bachinger
d681e264aa Skip played server side inserted ads in a single period window
This change makes sure played server side ads are skipped in a single period
timeline. It avoids creating an ad-MediaPeriodInfo for played postrolls and
creates a content info instead. It also sets the end position for content infos
that terminate the stream before the stream is actually finished. This prevents
the player from continue playing the remaining media delivered by the
MediaPeriod.

We also make sure that the discontinuity of played ads are not reported because
there is actually no discontinuity.

#minor-release

PiperOrigin-RevId: 428734387
2022-02-17 11:52:23 +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
olly
76839a02d6 Add getFormat and length to TrackGroupInfo
PiperOrigin-RevId: 428520090
2022-02-17 10:37:20 +00:00
bachinger
28b8ae7076 Seek to start position when reusing the last used shared period
The last used shared media period is reused after all media periods have been
released. In case the sample streams are already filled up, they need to be
reset or they download samples from the current position up to the seek
position. This causes long buffering states or load stuck exceptions.

A seek when reusing the shared period takes care for reseting the period or
internally seeks to the current position in the already available samples.

#minor-release

PiperOrigin-RevId: 428484187
2022-02-17 10:35:31 +00:00
tonihei
6048ca2faa Make usage of live minDurationForQualityIncrease more consistent
We have two ways to choose the minDurationForQualityIncreaseMs value in
AdaptiveTrackSelection: use the configured value for non-live or when
enough buffered data is available, or use a fraction of the available
duration to allow switching when playing close to the live edge.

The decision point when to use which value isn't quite consistent because
we compare against availableDurationUs before making the adjustments. This
means there is range of values where no up-switching is possible despite
perfect buffering. Fix this by choosing the minimum of both values.

Issue: google/ExoPlayer#9784

#minor-release

PiperOrigin-RevId: 428474332
2022-02-17 10:34:42 +00:00
olly
f3a9c6f539 Rewrite AnalyticsCollector to use new track APIs
PiperOrigin-RevId: 428455848
2022-02-17 10:32:55 +00:00
krocard
743a46e1b2 Do not reference AnalyticsCollector in common constructor
This prevents it to be stripped by R8 if a custom one is
passed.

#minor-release

PiperOrigin-RevId: 428034999
2022-02-17 10:30:59 +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
4ef007cae7 Add some missing thread verifications
This adds some missing calls to verifyApplicationThread to
ExoPlayerImpl.

Now all public methods start with this call, except listener
registrations because registration after construction on a background
thread is allowed and supported.

PiperOrigin-RevId: 428009498
2022-02-17 10:26:09 +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
27383068bd Make ExoPlayerImpl an ExoPlayer implementation
All the functionality of SimpleExoPlayer has moved to ExoPlayerImpl.
Hence, ExoPlayerImpl can fulfil its own name and become an ExoPlayer
implementation. As a result, ExoPlayer.Builder can return ExoPlayerImpl
directly without using SimpleExoPlayer at all.

#minor-release

PiperOrigin-RevId: 427947028
2022-02-17 10:19:06 +00:00