327 Commits

Author SHA1 Message Date
hschlueter
35c891a7bf Merge transformer video renderers.
This change merges `TransformerMuxingVideoRenderer` and
`TransformerTranscodingVideoRenderer` into `TransformerVideoRenderer`.
Besides all features supported by `TransformerTranscodingVideoRenderer`
the new merged `TransformerVideoRenderer` also supports SEF slow motion
flatting without re-encoding like the `TransformerMuxingVideoRenderer`.
To do this, it uses a `SefSlowMotionVideoSampleTransformer` with
the `PassthroughPipeline`.

PiperOrigin-RevId: 410531478
2021-11-19 15:02:23 +00:00
huangdarwin
46e3337bbb Transformer: Rename setOutputMimeType() to setContainerMimeType().
This mime type is technically for the Muxer, and determines
the container used. In the context of the transformer, this can
be thought of more as a container mime type, to avoid confusion
with the video mime type and audio mime type.

Deprecates setOutputMimeType().

PiperOrigin-RevId: 410530707
2021-11-19 15:01:28 +00:00
andrewlewis
f10b705b61 Update transformer error codes bug references
PiperOrigin-RevId: 410216171
2021-11-19 14:52:46 +00:00
huangdarwin
79f03bb135 Transformer GL: Add setResolution() API.
Simple, initial implementation to allow setResolution()
to set the output height, for downscaling/upscaling.

Per TODOs, follow-up CLs may change layering, add UI,
or allow querying decoders for more resolution options.

PiperOrigin-RevId: 410203343
2021-11-19 14:50:36 +00:00
hschlueter
c5904cfb46 Move OpenGL usage from VideoSamplePipeline to new OpenGlFrameEditor.
The decoder writes to `OpenGlFrameEditor`'s input `Surface`
and the `OpenGlFrameEditor` writes to the encoder's input `Surface`.

PiperOrigin-RevId: 409931796
2021-11-19 14:45:27 +00:00
samrobinson
52cd543689 Setup the initial instrumentation tests for transformer.
Due to sharding, each test should be in a separate class.

PiperOrigin-RevId: 409142436
2021-11-19 14:41:22 +00:00
hschlueter
a2cf38c67d Split VideoSamplePipeline from TransformerTranscodingVideoRenderer.
The `VideoSamplePipeline` handles all steps from decoding to
re-encoding that where previously in
`TransformerTranscodingVideoRenderer`. The renderer is now only
responsible for reading the format, reading input, passing it to the
pipeline and passing the pipeline's output to the muxer.

When no transformations are needed, decoding and re-encoding is
skipped using the `PassthroughPipeline`.

PiperOrigin-RevId: 408619407
2021-11-19 14:28:03 +00:00
hschlueter
f80e87b571 Refactor buffer duration calculation for clarity.
Follow-up to address comments from d8b9d378d9.

PiperOrigin-RevId: 408600470
2021-11-19 14:25:52 +00:00
hschlueter
d8b9d378d9 Accumulate remainder in buffer duration calculations.
When dropping the remainder, the decoder and encoder timestamps start diverging after a few buffers when no speed changes are supposed to occur. Tracking the remainder keeps them in sync.

PiperOrigin-RevId: 408341074
2021-11-19 14:22:24 +00:00
hschlueter
64466356b2 Add PassthroughSamplePipeline for audio.
When no transformation is needed, the passthrough pipeline allows us to skip decoding and re-encoding.

PiperOrigin-RevId: 407789767
2021-11-09 10:10:10 +00:00
huangdarwin
edc4bd5be1 GL: Misc GL refactoring.
* 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
2021-11-09 10:10:10 +00:00
hschlueter
b87f26490b Separate TransformerAudioRenderer and new AudioSamplePipeline.
`TransformerAudioRenderer` reads input and passes `DecoderInputBuffer`s
to the `AudioSamplePipeline`. The `AudioSamplePipeline` handles all
steps from decoding to encoding. `TransformerAudioRenderer` receives
`DecoderInputBuffer`s from the `AudioSamplePipeline` and passes their
data to the muxer.

`AudioSamplePipeline` implements a new interface `SamplePipeline`.
A pass-through pipeline will be added in a future cl.

PiperOrigin-RevId: 407555102
2021-11-09 10:09:26 +00:00
hschlueter
52c330c1d7 Write sample size to dumpfile in transformer tests.
If the number of samples changes, the sizes will help us to verify
whether they are just split differently or extra data was added.

PiperOrigin-RevId: 407346280
2021-11-09 10:09:13 +00:00
samrobinson
9c32d5ac46 Fix END_OF_STREAM transformer timestamp matching previous.
This cause the muxer to fail to stop on older devices/API levels.

#minor-release

PiperOrigin-RevId: 407309028
2021-11-09 10:09:13 +00:00
samrobinson
04efc03d4b Update the TransformerMediaClock trackTime before deducting the offset.
#minor-release

PiperOrigin-RevId: 407086818
2021-11-09 10:09:12 +00:00
huangdarwin
4f46e679a6 Transformer GL: Undo accidental setResolution changes().
Accidental changes were introduced in c07c4cc95d

PiperOrigin-RevId: 406858888
2021-11-09 10:07:30 +00:00
samrobinson
c3fbe2e1d3 Allow remove video transformer option.
PiperOrigin-RevId: 406849436
2021-11-09 10:07:30 +00:00
tonihei
90f74dc7a1 Suppress lint warning about wrong IntDef in FrameworkMuxer
The values are equivalent and we can suppress the warning.

PiperOrigin-RevId: 406839242
2021-11-09 10:07:30 +00:00
tonihei
10dcdd1df5 Add large renderer position offset.
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
2021-11-09 10:07:00 +00:00
huangdarwin
bf18aae99d GL: Make ProjectionRenderer's GL Program @MonotonicNonNull.
PiperOrigin-RevId: 406385758
2021-11-09 10:07:00 +00:00
samrobinson
51aee84d13 Change Transformer to use Player.Listener.
AnalyticsListener should not be used for non-analytical actions.

PiperOrigin-RevId: 406355758
2021-11-09 10:07:00 +00:00
ibaker
a60843ead5 Migrate callers of deprecated C.java methods to Util.java
#minor-release

PiperOrigin-RevId: 406166670
2021-11-08 15:17:26 +00:00
huangdarwin
7f64a5a1aa Transformer GL: Simplify GL program handling.
Relanding 9788750ddb, with some changes
applied to improve primarily readability, naming,
and nullness checks.

PiperOrigin-RevId: 406101742
2021-11-08 15:15:02 +00:00
hschlueter
399172d63f Refactor nullness checks in renderers.
`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
2021-10-27 17:51:40 +01:00
samrobinson
031f26ba61 Migrate SegmentSpeedProviderTest off deprecated method.
PiperOrigin-RevId: 405841397
2021-10-27 13:03:48 +01:00
olly
aff15ae9ee Set assumedVideoMinimumCodecOperatingRate for all playbacks
PiperOrigin-RevId: 405736227
2021-10-27 09:23:28 +01:00
Andrew Lewis
933e207b3e Update to androidx.media3
PiperOrigin-RevId: 405656499
2021-10-27 09:12:46 +01:00