1729 Commits

Author SHA1 Message Date
ivanbuper
d777a11840 Move createCodecProfileLevel() to MediaCodecUtil and simplify usages
This is a non-functional change.

PiperOrigin-RevId: 736534306
2025-03-13 09:34:10 -07:00
kimvde
03892cc1b5 VideoSink: merge setStreamStartPositionUs and onInputStreamChanged
setStreamStartPositionUs and onInputStreamChanged should both be called
when the stream changes.

PiperOrigin-RevId: 736121598
2025-03-12 07:17:41 -07:00
shahddaghash
1918a256cc Add a test for playing CompositionPlayer again after playback ends
A problem was discovered in Composition demo app where after playing a composition using CompositionPlayer, pressing the "play" button again would not restart the playback. This issue has been resolved, just adding a test to make sure we're not missing any regressions.

PiperOrigin-RevId: 735793488
2025-03-11 09:59:53 -07:00
michaelkatz
2729dbb8a9 Limit dynamic scheduling interval by the audio track buffer size
In certain bluetooth playback scenarios, it was found that the delta of audio duration written by the AudioSink from the current playback position was greater than the size of the audio track buffer, causing underruns.

The solution is to utilize the audio track buffer size as an upper limit for an audio renderer's getDurationToProgress.

PiperOrigin-RevId: 735761604
2025-03-11 08:16:22 -07:00
claincly
44b3a43652 Use VideoGraph as top level component
...and reduce the number of classes/interfaces

PiperOrigin-RevId: 735451687
2025-03-10 11:30:20 -07:00
kimvde
ce59680d0f Always call onProcessedStreamChanged for first stream for effects
Before this CL:
- MediaCodecVideoRenderer.onProcessedStreamChanged was called for the
  first stream in CompositionPlayer.
- MediaCodecVideoRenderer.onProcessedStreamChanged was NOT called for
  the first stream in ExoPlayer.setVideoEffects.

This discrepancy was adding some complexity to the code, making it less robust.

PiperOrigin-RevId: 735439320
2025-03-10 10:58:23 -07:00
shahddaghash
a110b02142 Move TestTransformerBuilder to test-util
This improves consistency by grouping it with other test builders and resolves a missing build rule, ensuring developers can properly use it for testing.

PiperOrigin-RevId: 735396181
2025-03-10 08:59:54 -07:00
sheenachhabra
66995a8816 Add checkNotNull for all getVideoCapabilities and similar calls
PiperOrigin-RevId: 735358217
2025-03-10 06:50:54 -07:00
kimvde
15fa27cd9a Split VideoSink.setStreamTimestampInfo
This is a step towards merging setStreamStartPositionUs with
onInputStreamChanged, which makes sense as the start position can only
change on stream change.

PiperOrigin-RevId: 735309009
2025-03-10 03:24:04 -07:00
shahddaghash
bf2e338fc2 Increase the buffer size for TestUtil.addAudioDecoders/Encoders
This is a step towards unifying ShadowMediaCodecConfig for ExoPlayer and Transcoding tests.

The buffer size for ExoPlayer's CodecConfig is set to 150_000. This is because some test media has samples larger than 100kB. We can increase the buffer size for Transcoding-related codec configurations.

PiperOrigin-RevId: 734297632
2025-03-06 14:54:07 -08:00
shahddaghash
cfbd6c5493 Add ability to force Transformer failure in Robolectric tests
When `forceTransformerToFail` is set to true, the builder will use a `FailingMuxerFactory` which creates a `FailingMuxer` that throws a `MuxerException` when attempting to write sample data. This ensures Transformer will fail as muxers are used for all cases (transmuxing and transcoding).

PiperOrigin-RevId: 734281681
2025-03-06 14:10:01 -08:00
shahddaghash
c030e49dd6 Refactor ShadowMediaCodec to be used for transcoding cases
This is a step towards unifying ShadowMediaCodecConfig for ExoPlayer and Transcoding tests.

This change includes extracting encoder/decoder configurtion logic to a static method that can be called by `ShadowMediaCodecConfig.CodecImpl#configure()` and `TestUtil#addCodec()`.

This is a non-functional refactor.

PiperOrigin-RevId: 734137675
2025-03-06 07:38:41 -08:00
sheenachhabra
06f340005f Add support for video gaps via addGap() API
The gap item earlier meant audio gap.
Now the gap item will be filled with audio, video
or both based upon what all tracks are present in the
Sequence.
If the very first item is a gap then it is filled with
audio only. Support for video gap at start will be added in
a follow up CL.
If the first item is a gap then `forceAudioTrack`
is set to true.

PiperOrigin-RevId: 733422557
2025-03-04 12:23:12 -08:00
ivanbuper
5a0f4c6b3f Add support for constant power mixing in DefaultAudioMixer
This change exposes a flag in `DefaultAudioMixer#Factory` to set whether
to upmix/downmix using constant power or constant gain mixing matrices.

This is a non-functional change.

PiperOrigin-RevId: 733339367
2025-03-04 08:31:40 -08:00
ivanbuper
c3d734066d Add support for audio fades and gain automation
This change introduces `GainProcessor` to apply gain automation over an
audio stream. The gain automation is defined with a `GainProvider`.
`DefaultGainProvider` implements a basic `GainProvider` that allows
populating a gain automation line additively by adding fade shapes
(`FadeProvider`) at specific positions with specific durations.
`DefaultGainProvider` also implements basic equal gain and equal power
fades.

The current `DefaultGainProvider` implementation does not support adding
fades at relative offsets from the stream end. Users must know the
stream duration in advance and add fades at absolute positions.

PiperOrigin-RevId: 733311314
2025-03-04 06:51:24 -08:00
Googler
b36d0483b2 Skip decode failures in audio fallback test
PiperOrigin-RevId: 733289692
2025-03-04 05:30:52 -08:00
dancho
7749ff23f6 Add frame extractor performance analysis test
PiperOrigin-RevId: 732972949
2025-03-03 10:32:36 -08:00
sheenachhabra
604a8cc0da Add assumeFormatSupported() check in video gaps test
PiperOrigin-RevId: 732928241
2025-03-03 08:13:59 -08:00
sheenachhabra
86df7572d2 Create a private util method to create blank frame bitmap
This method will be reused when inserting gaps in
`GapSignalingAssetLoader` in upcoming CL.

PiperOrigin-RevId: 732896566
2025-03-03 06:14:06 -08:00
kimvde
1361d569cd Remove method VideoFrameReleaseControl.onDisabled
This method didn't have any effect because onEnabled, which also sets
the firstFrameState, should always be the next method being called.

PiperOrigin-RevId: 732846722
2025-03-03 02:41:46 -08:00
tonihei
796df136d7 Update CapturingAudioSink to dump after audio processors
This ensures data modifications like channel mapping or
bitrate changes are correctly captured in the dump files.

PiperOrigin-RevId: 732129701
2025-02-28 07:21:54 -08:00
claincly
5d9c2e309e Add APIs for redrawing effects.
PiperOrigin-RevId: 731255074
2025-02-26 04:08:32 -08:00
Copybara-Service
cc44de8757 Merge pull request #2115 from MGaetan89:use_objects_equals
PiperOrigin-RevId: 730860597
2025-02-25 06:30:48 -08:00
sheenachhabra
bdbcdf1660 Implement blank frame insertion when video track goes missing
If an sequence has both audio and video tracks running but then
the next media item has only audio, then insert blank frames to
continue video track.

PiperOrigin-RevId: 730828269
2025-02-25 04:34:17 -08:00
shahddaghash
c90ca4e86e Enable metrics collection by default
PiperOrigin-RevId: 730383523
2025-02-24 03:47:05 -08:00
sheenachhabra
b6aa21a427 Move video track extraction method to AndroidTestUtil
The method can be reused in other tests as well

PiperOrigin-RevId: 729528829
2025-02-21 07:56:56 -08:00
shahddaghash
23ebea7ab4 Update exporter and muxer name to match expected pattern
If the name does not match patten, it gets skipped when reporting.

PiperOrigin-RevId: 729463344
2025-02-21 03:35:04 -08:00
Gaëtan Muller
a17a3ebc67 Replace usages of Util.areEqual() with Objects.equals() 2025-02-21 11:01:09 +00:00
shahddaghash
ae3eed2343 Verify each export had its own session
This is done by getting the session ID for the `EditingSession` and making sure it's unique from the other session ID.

PiperOrigin-RevId: 728680628
2025-02-19 08:18:34 -08:00
sheenachhabra
462533219d Create muxer specific BufferInfo class
Muxer does not use `offset` field, hence not added.

PiperOrigin-RevId: 728625538
2025-02-19 05:11:04 -08:00
Googler
525588eec5 Update performance parameter visibility
PiperOrigin-RevId: 728589755
2025-02-19 03:05:40 -08:00
shahddaghash
90844f11e8 Add test for usePlatformDiagnostics disabled
PiperOrigin-RevId: 728276994
2025-02-18 10:57:48 -08:00
shahddaghash
116fbeaa81 Add EditingMetricsCollector test for export cancellation
PiperOrigin-RevId: 727885381
2025-02-17 09:22:59 -08:00
shahddaghash
f8d5f5a828 Move FrameBlockingMuxer into AndroidTestUtil
This allows it to be reused in upcoming tests.

PiperOrigin-RevId: 727835985
2025-02-17 06:04:02 -08:00
shahddaghash
6f60aa2548 Add EditingMetricsCollector test for export error
PiperOrigin-RevId: 727835981
2025-02-17 06:02:06 -08:00
shahddaghash
3ce6a2e6b8 Add EditingMetricsCollector test for export success
PiperOrigin-RevId: 727826326
2025-02-17 05:19:16 -08:00
andrewlewis
2f9fcfd238 Remove unused experimental quality targeting mode
PiperOrigin-RevId: 727817967
2025-02-17 04:46:13 -08:00
shahddaghash
6d408c2d31 Create a new MetricsReporter.Factory
This includes creating a new Factory for `MetricsReporter` and adding it to Transformer. This is done as we need to create a new `MetricsReporter` for each export operation, so it makes sense to have a Factory.

PiperOrigin-RevId: 727798528
2025-02-17 03:34:57 -08:00
kimvde
c1eb381948 Transformer: fix gradle dependency type
PiperOrigin-RevId: 727760498
2025-02-17 01:23:21 -08:00
ibaker
12072f7248 Rename TestPlayerRunHelper.run(...) to advance(...)
This avoids a clash with the `run` keyword in Kotlin.

PiperOrigin-RevId: 726461032
2025-02-13 06:37:31 -08:00
andrewlewis
04d9a751c6 Add encoder setting to set frame repeat interval
This can be used for screen recording to produce files without large gaps
between frames.

PiperOrigin-RevId: 726451010
2025-02-13 06:05:52 -08:00
kimvde
2a91d47ea9 Add tests for prewarming disabled
PiperOrigin-RevId: 726411904
2025-02-13 03:49:14 -08:00
kimvde
cea67e8826 Do not record test skipped for tests skipped on emulator
AndroiTestUtil.recordTestSkipped is useful for MH tests

PiperOrigin-RevId: 726397349
2025-02-13 03:01:18 -08:00
kimvde
6e332e9b91 Do not fail the export in case of ExoPlayer release time out
PiperOrigin-RevId: 725996730
2025-02-12 04:13:27 -08:00
kimvde
be51913b81 Refactor GlObjectsProvider release logic
When possible, make it the caller's responsibility to release the
GlObjectsProvider. It's good practice that the class creating an object
also releases it. It avoids releasing the same object (here, the
GlObjectsProvider) multiple times, which was causing
DefaultVideoCompositorPixelTest to fail.

PiperOrigin-RevId: 725983417
2025-02-12 03:23:49 -08:00
Googler
1310496809 Revert DefaultEncoderFactory to previous defaults
Also changed encoder factory to not set operating rate or priority if they equal `RATE_UNSET` rather than `NO_VALUE`

PiperOrigin-RevId: 725964682
2025-02-12 02:11:39 -08:00
Googler
447d784636 Use encoder input format for sample rate fallback.
This ensures that when the input sample rate handled by the encoder differs from the output of the AudioGraph, that output audio will not be broken.

PiperOrigin-RevId: 725610384
2025-02-11 06:43:58 -08:00
shahddaghash
1b882fec0c Add unit tests for EditingMetricsCollector
The change includes adding a `MetricsReporter` interface with a default implementation to allow testing the `EditingMetricsCollector`.

PiperOrigin-RevId: 725607330
2025-02-11 06:33:39 -08:00
kimvde
9f60eb3825 Fix TODOs formatting in Transformer
PiperOrigin-RevId: 725572106
2025-02-11 04:15:32 -08:00
Googler
50d4e66308 Add getInputFormat to Codec interface
PiperOrigin-RevId: 725552831
2025-02-11 02:58:55 -08:00