Document that apps should retain `GlUtil.Program` while the program is in use,
and keep a reference to attributes/uniforms within the program to make sure
they don't get GC'd causing any allocated buffers passed to GL to become
invalid.
Tested manually by running gldemo and transformer.
PiperOrigin-RevId: 411516894
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
We verified there is a race condition in the
AsynchronousMediaCodecAdapter when flushing the adapter
multiple times. The race condition results in calling MediaCodec.start()
and MediaCodec.flush() in parallel and that makes the MediaCodec
raise an exception.
This changes the default behavior to call MediaCodec.start() on the
same thread after MediaCodec.flush() to avoid the race condition.
#minor-release
PiperOrigin-RevId: 410509388
Currently, TrackSelectionOverrides are documented as being applied
per track type, meaning that one override for a type disables all
other selections for the same track type. However, the actual
implementation only applies it per track group, relying on the
track selector to never select another renderer of the same type.
This change fixes DefaultTrackSelector to fully adhere to the
TrackSelectionsOverride definition. This solves problems when
overriding tracks for extension renderers (see Issue: google/ExoPlayer#9675)
and also simplifies a workaround added to StyledPlayerView.
#minor-release
PiperOrigin-RevId: 409121711
The asynchronous MediaCodec adapter queues input buffers in a
background thread. If a codec queueuing operation throws an exception,
the buffer enqueuer will store it as a pending exception and re-throw it
the next time the adapter will attempt to queue another input buffer.
The buffer enqueuer's flush() and shutdown() may throw an exception if
the pending error is set. This is subject to a race-condition in which
the pending error can be set while the adapter is flushing/shutting down
the enqueuer, e.g., if an input buffer is still being queued and the
codec throws an exception. As a result, the adapter cannot flush or
shutdown gracefully.
This change makes the buffer enqueuer to ignore any pending error
when flushing/shuttinf down so that the adapter can flush/release
gracefully even if a queueing error was detected.
PiperOrigin-RevId: 409113054
The Javadoc of DefaultTrackSelector can be shortened as it's not the
right place to document detailed options of the Player track selection
parameters.
The documentation page about track selection is updated to the new
APIs and extended with most relevant options and information needed
to work with ExoPlayer's track selection API.
#minor-release
PiperOrigin-RevId: 409088989
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
The setters in the Builder are already deprecated and using the
old getter is error-prone as they only return the overrides set
with the deprecated setters.
Issue: google/ExoPlayer#9665
PiperOrigin-RevId: 408817640
We can rename the existing setIndex method to a more generic init
as this method is only called by EPII and implemented by BaseRenderer
anyway.
PiperOrigin-RevId: 408616055
The platform class is only available from API 31, so we need
a generic wrapper that can be used on all API levels. The wrapper
essentially provides an identifier for a player instance, so naming
it accordingly.
PiperOrigin-RevId: 408292802
And in a couple of related places.
This is for consistency with the rest of the codebase where
we exclusively use indices.
#minor-release
PiperOrigin-RevId: 408273372
When operating the MediaCodec in asynchronous mode, after a
MediaCodec.flush(), we start MediaCodec in the callback thread,
which might trigger errors in some platforms. This change adds an
experimental flag to move the call to MediaCodec.start() back to the
playback thread.
PiperOrigin-RevId: 407801013
When we have multiple overrides for TrackGroups associated with
one renderer, we need to look at all of them to find the non-empty
one. Empty ones should only be used to remove previously selected
tracks for this group and otherwise be ignored.
Currently this is broken because the first override (no matter if
it's empty or not) is used as the final selection for this renderer.
Issue: google/ExoPlayer#9649
#minor-release
PiperOrigin-RevId: 407792330
* Remove GlUtil.Program String[] constructor to unify and just use the
String constructor.
* Add getAttributeArrayLocationAndEnable() to simplify things a tiny bit.
* Increase usage of constant values.
PiperOrigin-RevId: 407570340
Add protected method DefaultRenderersFactory.getCodecAdapter(), so that
subclasses of DefaultRenderersFactory that override
buildVideoRenderers() or buildAudioRenderers() can access the
DefaultRenderersFactory codec adapter factory and pass it to
MediaCodecRenderer instances they may create.
#minor-release
PiperOrigin-RevId: 407345431
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
The return values of AudioManager.getPlaybackOffloadSupport are the same as the values defined in C.AudioManagerOffloadMode.
PiperOrigin-RevId: 406817413
Currently, clipping errors are never thrown if we already have a
MediaPeriod. This may happen for example for ProgressiveMediaSource
where we need to create a MediaPeriod before knowing whether clipping
is supported. Playback will still fail, but with unrelated assertion
errors that are hard to understand for users.
Fix this by setting the pending error on the ClippingMediaPeriod.
#minor-release
Issue: Issue: google/ExoPlayer#9580
PiperOrigin-RevId: 406809737
This helps to prevent issues where decoders can't handle negative
timestamps. In particular it avoids issues when the media accidentally
or intentionally starts with small negative timestamps. But it also
helps to prevent other renderer resets at a later point, for example
if a live stream with a large start offset is enqueued in the playlist.
#minor-release
PiperOrigin-RevId: 406786977
Initialize default components lazily in ExoPlayer.Builder to avoid
redundant component instantiations, useful in cases where apps
overwrite default components with ExoPlayer.Builder setters.
The fields in ExoPlayer.Builder are wrapped in a Supplier (rather than
just making then nullable and initializing them in
ExoPlayer.Builder.build()) so that we maintain the proguarding
properties of this class.
PiperOrigin-RevId: 406345976
Only deprecated references remain.
Usages of the deprecated methods will be migrated in a follow-up change.
#minor-release
PiperOrigin-RevId: 405927141
Also add a setRenderersFactory() method, so that all constructor-provided
components can also be passed via setters.
This comment already appears on the constructor that takes all
components, but it applies to these ones as well.
PiperOrigin-RevId: 405917343
Our package-info.java files are annotated with @NonNullApi which results
in everything being non-null by default, so this annotation is never
needed.
#minor-release
PiperOrigin-RevId: 405864737