4626 Commits

Author SHA1 Message Date
olly
8e7ab9c811 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 14:24:02 +00:00
olly
daf72f518c Flatten TrackSelectionParameters
PiperOrigin-RevId: 428747243
2022-02-17 14:24:02 +00:00
bachinger
940e934b58 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 14:24:02 +00:00
bachinger
3b39e3bd19 Do not manipulate the duration of SSAI periods in FakeTimeline
#minor-release

PiperOrigin-RevId: 428727560
2022-02-17 14:24:02 +00:00
olly
c90745d956 Add getFormat and length to TrackGroupInfo
PiperOrigin-RevId: 428520090
2022-02-17 11:51:07 +00:00
bachinger
3a7f73f1e2 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 11:44:22 +00:00
tonihei
7907f4e047 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 11:41:01 +00:00
olly
b6317837e2 Rewrite AnalyticsCollector to use new track APIs
PiperOrigin-RevId: 428455848
2022-02-17 11:34:08 +00:00
krocard
1087b2f6f6 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 11:27:07 +00:00
bachinger
a7b0202712 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 11:16:56 +00:00
tonihei
00dbb780f1 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 11:13:31 +00:00
tonihei
8be677a426 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 11:10:02 +00:00
krocard
e5f2e44c29 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 11:03:17 +00:00
tonihei
4b794e57ca 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:49:23 +00:00
krocard
173787e8ce Fix DefaultAudioTrackBufferSizeProvider test
And move them in separate top level classes so that presubmit runs them.

#minor-release

PiperOrigin-RevId: 427482430
2022-02-17 10:21:17 +00:00
tonihei
36ef3328d9 Add missing events to AnalyticsListener.
And also add a test that all Player.Listener events are forwarded
to AnalyticsListener.

The AnalyticsCollector also needlessly implemented
Video/AudioRendererEventListener, which is not needed because all of
the equivalent methods are called directly and never through the
interface.

#minor-release

PiperOrigin-RevId: 427478000
2022-02-17 10:17:50 +00:00
olly
d084a71278 Handle Choreographer.getInstance throwing RuntimeException
#minor-release

PiperOrigin-RevId: 427439588
2022-02-17 10:03:26 +00:00
tonihei
86afae9c3e Merge listeners in ExoPlayerImpl and add missing constants
There are two sets of listeners in ExoPlayerImpl at the moment,
which can be merged together to use a single ListenerSet. This has
the added advantage that the events that were previously sent
through the ArraySet get additional guarantees provided by ListenerSet
(e.g. correct event ordering and onEvents triggered).

Also add missing constants for onEvents to ensure all Player.Listener
methods have an corresponding constant.

#minor-release

PiperOrigin-RevId: 427415349
2022-02-09 10:27:55 +00:00
tonihei
db1762b417 Misc clean-up in ExoPlayerImpl.
This brings listener invocations closer together and removes
unnecessary methods.

Also fixes a bug where a change in track selection parameters only
queued a callback but never flushed it to actually inform the
listeners.

#minor-release

PiperOrigin-RevId: 427201691
2022-02-08 17:38:30 +00:00
tonihei
121013d35e Avoid special-casing AnalyticsCollector when informing listeners.
In some cases (whose where we previously used EventListener),
AnalyticsCollector is registered as a listener to receive updates,
in other cases it is called directly.

Avoid this inconsistent handling by registering it as normal listener
and removing all callbacks that are handled by the normal listener flow.

The remaining direct usages of AnalyticsCollector calls are those
callbacks that have no equivalent in Player.Listener.

#minor-release

PiperOrigin-RevId: 427201525
2022-02-08 17:34:57 +00:00
christosts
279fdb5227 Android 12L: Always set codec max output channels
With this change, MediaCodecAudioRenderer always configures MediaCodec
with max output channels set to 99 on API 32+.

#minor-release

PiperOrigin-RevId: 427192801
2022-02-08 17:31:14 +00:00
tonihei
17159f66db Remove self-listening from ExoPlayerImpl
SimpleExoPlayer used to register a listener on ExoPlayerImpl for
the old EventListener callbacks. Now both classes are merged, this is
no longer needed and should be removed in favor of calling methods
directly.

#minor-release

PiperOrigin-RevId: 427187875
2022-02-08 17:24:02 +00:00
tonihei
80cdfd0cf0 Fix delayed discontinuity for failed ad insertions.
We have logic to not immediately interrupt playback when an ad group
fails to load and instead let the current content play and transition
at the point where the ad group should have been.

This logic was broken by dcbdbe5341 because of one of the conditions
used MediaPeriodId.adGroupIndex, which is always -1 for content ids.
It still worked for the last ad group because the next ad group index
was C.INDEX_UNSET.

Fix the issue and amend the test that was meant to catch this to test
the ad failures for the last ad and previous ads.

Also fix the PositionInfo reported in such a case, which was also wrong.

Issue: google/ExoPlayer#9929

#minor-release

PiperOrigin-RevId: 427143223
2022-02-08 17:20:22 +00:00
tonihei
2e34f9d552 Add missing calls to AnalyticsCollector
PiperOrigin-RevId: 427133919
2022-02-08 12:34:07 +00:00
tonihei
d04ecb3cb7 Remove deprecated EventListener
PiperOrigin-RevId: 427133817
2022-02-08 12:34:07 +00:00
tonihei
c381ff25e1 Rollback of 03e645bab3
*** Original commit ***

Rollback of 9b8ed581d0

*** Original commit ***

Add missing imports to ExoPlayerImpl

These were missed in 3bb0210d22

#minor-release

***

***

PiperOrigin-RevId: 427131696
2022-02-08 12:34:06 +00:00
tonihei
17050e8b59 Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 12:34:06 +00:00
tonihei
8d9c4f4774 Rollback of b0abdade50
*** Original commit ***

Rollback of 08c5b1cb0a

*** Original commit ***

Wire up MediaMetricsListener and add configuration to disable it.

The listener will automatically forward diagnostics info to the
Android platform. ExoPlayer.Builder gets a new setter that allows
to disable this feature if required.

#...

***

PiperOrigin-RevId: 427131438
2022-02-08 12:34:06 +00:00
tonihei
ddbd9512da Rollback of 12be2bc357
*** Original commit ***

Rollback of 3bb0210d22

*** Original commit ***

Move SimpleExoPlayer logic into ExoPlayerImpl

This makes SimpleExoPlayer a simple forwarding wrapper which can be
removed in the future.

The changes are all purely mechanical with none of the potential further
simplifications made yet...

***

PiperOrigin-RevId: 427131338
2022-02-08 12:34:06 +00:00
olly
7682a6001f Rollback of 3bb0210d22
*** Original commit ***

Move SimpleExoPlayer logic into ExoPlayerImpl

This makes SimpleExoPlayer a simple forwarding wrapper which can be
removed in the future.

The changes are all purely mechanical with none of the potential further
simplifications made yet. The only exceptions are name clashes where
either EPI or SEP was calling a method in one of the classes and both
classes had different implementations for the same method name. In these
cases we needed to disambiguate between the two different
implementations (e

***

PiperOrigin-RevId: 426997821
2022-02-08 12:34:06 +00:00
olly
43b796b64d Rollback of 08c5b1cb0a
*** Original commit ***

Wire up MediaMetricsListener and add configuration to disable it.

The listener will automatically forward diagnostics info to the
Android platform. ExoPlayer.Builder gets a new setter that allows
to disable this feature if required.

#minor-release

***

PiperOrigin-RevId: 426997342
2022-02-08 12:34:06 +00:00
olly
2db8807aac Revert of b19ced30c4c2853b09af3382b86f84c31b3a5af5
PiperOrigin-RevId: 426996878
2022-02-08 12:33:53 +00:00
olly
2e4bcd47cd Rollback of 9b8ed581d0
*** Original commit ***

Add missing imports to ExoPlayerImpl

These were missed in 3bb0210d22

#minor-release

***

PiperOrigin-RevId: 426996503
2022-02-08 12:33:53 +00:00
olly
b946944eca Revert of cf1dcede591e3db5481ef578e0637e271be8f336
PiperOrigin-RevId: 426994820
2022-02-08 12:33:46 +00:00
olly
d2bc6dabde Revert of b27349385b61efa3576bb78b59cb07c93fc3a167
PiperOrigin-RevId: 426994559
2022-02-08 12:33:36 +00:00
ibaker
fa5ac86646 Remove deprecated DefaultRenderersFactory constructors
#minor-release

PiperOrigin-RevId: 426938026
2022-02-08 10:53:11 +00:00
ibaker
8374c63409 Remove deprecated ProgressiveMediaSource.Factory setters
#minor-release

PiperOrigin-RevId: 426909957
2022-02-08 10:46:27 +00:00
olly
b27349385b Add missing calls to AnalyticsCollector
PiperOrigin-RevId: 426892085
2022-02-08 10:42:52 +00:00
olly
cf1dcede59 Remove deprecated EventListener
PiperOrigin-RevId: 426876984
2022-02-08 10:39:28 +00:00
ibaker
9b8ed581d0 Add missing imports to ExoPlayerImpl
These were missed in 3bb0210d22

#minor-release

PiperOrigin-RevId: 426872386
2022-02-08 10:36:06 +00:00
ibaker
c235087c11 Remove deprecated ActionFile and ActionFileUpgradeUtil
#minor-release

PiperOrigin-RevId: 426868933
2022-02-08 10:26:35 +00:00
ibaker
b19ced30c4 Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 11:17:31 +00:00
ibaker
136c997d7b Add TYPE_USE to 'frequently used' IntDefs in a backwards-compatible way
This ensures Kotlin usages of these IntDef annotations in the 'old'
position will continue to compile.

'Frequently used' is a subjective judgement. I have a parallel change
that marks all the other public IntDefs in the library as TYPE_USE
(those that I've judged to be 'rarely used' by apps).

A follow-up change will fix the positions of existing usages to be as if
they're only TYPE_USE.

#minor-release

PiperOrigin-RevId: 426427334
2022-02-07 11:13:54 +00:00
ibaker
75932a0216 Mark all public 'rarely used' IntDefs as only TYPE_USE
This is a breaking change if the annotation itself is in use in Kotlin
code. It's judged that the IntDefs in this commit are unlikely to be
referred to often in Kotlin code. This is because they're either:
- Related to esoteric parts of the library, or
- In a common part of the library but only returned from methods (and
  never passed to callback methods).

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

#minor-release

PiperOrigin-RevId: 426410237
2022-02-07 11:10:11 +00:00
ibaker
975910a494 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 11:02:54 +00:00
ibaker
a506d245d1 Move @AudioFocusGain from C to AudioFocusManager and make it private
This is only used inside AudioFocusManager, it doesn't need to public.

Also mark it TYPE_USE and update the position to match.

#minor-release

PiperOrigin-RevId: 426407790
2022-02-07 10:59:11 +00:00
ibaker
15d50d0bf0 Remove @C.AudioManagerOffloadMode IntDef
This is only used in DefaultAudioSink, so we could move it there and
make it private - but at that point we might as well refer to the
underlying AudioManager constants instead.

#minor-release

PiperOrigin-RevId: 426407661
2022-02-07 10:55:25 +00:00
ibaker
0c2e77daca 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 15:07:19 +00:00
ibaker
6a269baeed Redefine the SSAI URI format with an "ssai" scheme instead of "imadai"
This allows us to remove the IMA naming from DefaultMediaSourceFactory's
SSAI integration.

#minor-release

PiperOrigin-RevId: 426346456
2022-02-04 14:49:52 +00:00
hschlueter
6c061894b0 Make GlProgram an outer class.
This change makes GlUtil.Program an outer class named GlProgram,
and also moves private static helpers as well as the inner classes
Attribute and Uniform which were only used by GlUtil.Program to
GlProgram. Other static utility methods remain in GlUtil.

No functional changes intended.

PiperOrigin-RevId: 426119299
2022-02-04 10:23:39 +00:00