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. The exception is
ExoPlayer.Builder.AnalyticsCollector which became nullable and is
initialized in ExoPlayer.Builder.build() in order to use any Clock
that has been set separately with ExoPlayer.Builder.setClock().
#minor-release
PiperOrigin-RevId: 406345976
This makes sure that #EXT-X-RENDITION-REPORT tags can be placed before the list of segments/parts as well. We were previously assuming that these come at the end, which naturally would make sense and is done like this in all examples, but it is not explicitly defined by the spec.
Issue: google/ExoPlayer#9592
PiperOrigin-RevId: 406329684
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
`checkNotNull` should be avoided where possible.
This change adds `@EnsuresNonNull` or `@EnsuresNonNullIf` to configuration methods for fields they initialize.
`checkNotNull` is now avoided for the `@MonotonicNonNull` formats by adding `@RequiresNonNull` annotations.
`checkNotNull` is now avoided for the encoder and decoder in `feedMuxerFromEncoder()`, `feedEncoderFromDecoder()`, `feedDecoderFromInput()`, etc. by creating local variables for `encoder` and `decoder` in `render` after the configuration method calls and passing these as non-null parameters.
PiperOrigin-RevId: 405893824
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
Test file produced with:
$ MP4Box -add "sample.mp4#video:colr=nclc,1,1,1" -new sample_18byte_nclx_colr.mp4
And then manually changing the `nclc` bytes to `nclx`.
This produces an 18-byte `colr` box with type `nclx`. The bitstream of
this file does not contain HDR content, so the file itself is invalid
for playback with a real decoder, but adding the box is enough to test
the extractor change in this commit.
(aside: MP4Box will let you pass `nclx`, but it requires 4 parameters, i.e. it
requires the full_range_flag to be set, resulting in a valid 19-byte colr box)
#minor-release
Issue: #9332
PiperOrigin-RevId: 405842520
- This CL does not introduce functional changes.
- This change will allow searching for the clli box while
parsing the mdcv box in order to construct the HDR
static info contained in ColorInfo.
#minor-release
PiperOrigin-RevId: 405656499
Also check that the output video MIME type is supported with the given container MIME type in `TranscodingTransformer` and `TransformerBaseRenderer`.
PiperOrigin-RevId: 405645362
This has a few benefits:
* Aligns the Builder constructors with the setters
(setRenderersFactory is missing, but can be easily added in a
follow-up change).
* Allows DefaultMediaSourceFactory to be stripped by R8 and
makes the shrinking dev guide for the cases of providing a custom
MediaSourceFactory or directly instantiating MediaSource instances
less weird too.
#minor-release
PiperOrigin-RevId: 405632981
When no encoder video MIME type is specified, the `TransformerTranscodingVideoRenderer` now uses the video MIME type of the input for the encoder format.
The input format is now read in a new method `ensureInputFormatRead` which is called before the other configuration methods. This removes the logic for reading the input format from `ensureDecoderConfigured`, because it is now needed for both encoder and decoder configuration but the encoder needs to be configured before GL and GL needs to be configured before the decoder, so the decoder can't read the format.
The width and height are now inferred from the input and the frame rate and bit rate are still hard-coded but set by the `MediaCodecAdapterWrapper` instead of `TranscodingTransformer`.
PiperOrigin-RevId: 405631263
The static and dynamic metadata now build up in a list, such that when
the MediaMetadata is built, they are applied in an event order. This
means that newer/fresher values will overwrite older ones. The MediaItem
values are then applied at the end, as they take priority over any other.
#minor-release
PiperOrigin-RevId: 405383177
This introduces a new option `setAudioMimeType` in `TranscodingTransformer.Builder` and a corresponding check whether the selected type is supported. This check is done using `supportsSampleMimeType` which is now part of the `Muxer.Factory` and `MuxerWrapper` rather than `Muxer`.
A new field `audioMimeType` is added to `Transformation` and the `TransformerAudioRenderer` uses this instead of the input MIME type if requested.
PiperOrigin-RevId: 405367817
Decoded video frames can be large and there is no need to retrieve the
corresponding ByteBuffer as we render the decoded frames on a surface
for better performance.
PiperOrigin-RevId: 405364950
The current API exposes an `ImmutableMap` of
`TrackGroup` -> `TrackSelectionOverride`.
This has several disadvantages:
- A difficult to use API for mutation
(`ImmutableMap.Builder` doesn't support key removal).
- There is no track selection specific methods,
how the generic map API mapps to the selection override is not complex
but to obvious for a casual reader.
- The internal data type is exposed, making internal refactor difficult.
This was done to have the API ready as quick as possible.
When transitioning the clients to the map API in <unknown commit>,
it became clear that the map API was too verbose and not mapping
to the clients needs, so utility methods
were added to make operations clearer and more concise.
Nevertheless, having to use utility method to use easily and correctly
an API is not the sign of a good API.
This cl refactors the track selection API for several improvements:
- Add a type `TrackSelectionParameters` that encapsulate the internal
data structure (map currently).
- For iteration, expose as a list.
- Add a `Builder` for easy mutable operations.
- Add track selection specific methods to avoid having utilities functions.
- Those operations are the same as `DefaultTrackSelector.Parameters`
for easier migration. (`setOverride` was renamed to `addOverride`)
- Move `TrackSelection` classes outside of `TrackSelectionParameters`
as their own top level classes.
The migration of the client code is straightforward as most of it
were already using the previously mentioned utility functions
that are now native methods.
The full migration has not been done yet, and is pending on this cl approval.
PiperOrigin-RevId: 405362719