1418 Commits

Author SHA1 Message Date
sheenachhabra
8eb1390f80 Create FragmentedMp4Muxer class
This CL aims to separate Fragmented MP4 related logic in a separate public class.
Earlier all the logic was in a single class `Mp4Muxer`.

PiperOrigin-RevId: 619206661
2024-03-26 09:02:43 -07:00
tofunmi
f4fefd19f7 Document and test multi asset ultraHDR support
PiperOrigin-RevId: 619200688
2024-03-26 08:39:44 -07:00
tofunmi
65e94480f4 Transformer: add single-asset ultraHDR image to HLG HDR vid transcoding
PiperOrigin-RevId: 619138202
2024-03-26 04:06:41 -07:00
andrewlewis
c3c964627f Log internal Transformer lifecycle for debugging
Add logging similar to `ExoPlayerImpl` to make bug reports more useful.

PiperOrigin-RevId: 619117500
2024-03-26 02:31:31 -07:00
sheenachhabra
2eaece5ed9 Move setMaxDelayBetweenSamplesMs on Transformer builder
This property is transformer specific and does not belong to
muxer interface.
This is to eventually replace muxer interface in Transformer module with
muxer interface in Muxer module.

PiperOrigin-RevId: 618895836
2024-03-25 11:02:15 -07:00
sheenachhabra
483d2bb9e7 Add Muxer interface in muxer module
The immediate plan is to replace `Transformer Muxer interface`
with this one.
It was not straight forward to move/change `Transformer Muxer interface`
hence this intermediate step.
The follow up CL will also remove fragmented MP4 related code from
`Mp4Muxer` and move it into `FragmentedMp4Muxer implements Muxer`.

PiperOrigin-RevId: 618789265
2024-03-25 03:40:15 -07:00
huangdarwin
d165af9a85 Test: Use AssumptionViolatedException for format support detection.
This is the most widely-used test-skipping method I'm aware of, so I figured this
would be a great method to scale usage of AssumptionViolatedException.

PiperOrigin-RevId: 618160931
2024-03-22 06:41:18 -07:00
sheenachhabra
16aac07bce Add support for processing 3 byte NAL start code in Mp4Muxer
Issue: androidx/media#725

Ideally the test to transmux a `ts` file (having 3 bytes NAL start code)
should go into `Mp4MuxerEndToEndTest`but `Mp4MuxerEndToEndTest` uses `MediaExtractor` and `MediaExtractor` is returning samples with `4 byte NAL start code` which will not exercise the newly added code path.
Hence the test is added in `TransformerWithInAppMuxerEndToEndTest` which
internally uses `media3 extractor` and feeds samples with `3 bytes NAL start code`
only.

PiperOrigin-RevId: 617985866
2024-03-21 15:49:12 -07:00
kimvde
6fc4f0263f Add methods required for seek to AudioGraph
Seeking will consist of the following steps:
- Block the AudioGraph input data.
- Flush the AudioGraph.
- Seek the ExoPlayers.
- Unblock the AudioGraph input data.

PiperOrigin-RevId: 617868124
2024-03-21 09:31:51 -07:00
sheenachhabra
e14156aa3b Rename test classes having duplicate names
PiperOrigin-RevId: 616887534
2024-03-18 11:16:48 -07:00
huangdarwin
d2dc901b6a Test: Fix failing HDR sequence test by swapping assumption.
Oops, missed this one in 1adb2b270d

PiperOrigin-RevId: 616871770
2024-03-18 10:28:47 -07:00
huangdarwin
e446f20a70 Test: Remove nullness for testid
This also makes it more consistent with newer testId tests that don't have nullness, so tests don't look inconsistent, and was pretty easy to do :P

PiperOrigin-RevId: 616856888
2024-03-18 09:47:12 -07:00
huangdarwin
1adb2b270d Test: Fix failing HdrEditingTest by swapping assumption.
This was broken by 2fa38d15dd, which added an assumes
method, but missed the `!` operator for the tests where HDR is
unsupported. Add an assumes method that assumes a lack of support
for HDR.

Tested on the failing device (Pixel 7) and confirmed this fixes
the test on that device, to throw AssumptionViolatedException
instead of allowing test logic to run after failing the
assumption.

PiperOrigin-RevId: 616846588
2024-03-18 09:12:33 -07:00
huangdarwin
4c85a04d07 Test: Use AssumptionViolatedException for OpenGL Tone-map support.
PiperOrigin-RevId: 616827385
2024-03-18 08:00:02 -07:00
huangdarwin
0731b07954 Test: Use format arg for assumeDeviceSupportsHdrEditing.
PiperOrigin-RevId: 616825970
2024-03-18 07:53:23 -07:00
huangdarwin
2fa38d15dd Test: Use AssumptionViolatedException for HDR capability check.
Also, use a common util method

PiperOrigin-RevId: 616815502
2024-03-18 07:06:17 -07:00
tofunmi
d269b93755 Transformer: Take effects into account when signalling duration
PiperOrigin-RevId: 616224079
2024-03-15 13:21:12 -07:00
huangdarwin
3136deb9b3 Test: Remove extraneous testIds.
PiperOrigin-RevId: 616213378
2024-03-15 12:39:43 -07:00
tofunmi
fe640da5e8 Transformer: add speedChange API
PiperOrigin-RevId: 616163061
2024-03-15 10:02:37 -07:00
Googler
415d779c62 Explicitly check that AudioGraph input is PCM 16
AudioGraph implicitly assumes that input will be PCM 16 bit, and not float.
Make the check explicit.

PiperOrigin-RevId: 616149131
2024-03-15 09:14:04 -07:00
tofunmi
f39fe82bba Support ultra HDR in effect
adding sending gainmap to shader program and applying gainmap to base in shader

PiperOrigin-RevId: 616070582
2024-03-15 03:22:54 -07:00
kimvde
e40ce150bf Implement AudioGraph.flush()
When flushing the AudioGraph, the AudioMixer will be preserved but the
sources will be recreated. This is probably a bit less efficient but
makes the logic simpler. Indeed, if we had to keep the sources alive,
we would need to add a way to reconfigure them with a new timestamp for
seeking. We would also need to change the way sources are ended because
they are currently removed when they are ended. Also, it is acceptable
to have a small delay when seeking, which means that performance is less
critical than for playback.

PiperOrigin-RevId: 615775501
2024-03-14 07:49:07 -07:00
kimvde
3248b7962a Add clipFloatOutput parameter to AudioMixer
PiperOrigin-RevId: 615720340
2024-03-14 03:44:37 -07:00
huangdarwin
ca6031deab Update old method name.
getSupportedEncoderNamesForHdrEditing became getSupportedEncodersForHdrEditing at some point, but this comment wasn't updated before...

PiperOrigin-RevId: 615712707
2024-03-14 03:11:03 -07:00
sheenachhabra
668a172683 Rename MuxerWrapper.release() method
PiperOrigin-RevId: 615399319
2024-03-13 06:54:19 -07:00
sheenachhabra
aba395ca8b Add Mp4OrientationData class
Mp4Muxer now has a single method to accept different
types of metadata.

PiperOrigin-RevId: 614646331
2024-03-11 06:45:15 -07:00
kimvde
f02dc8e528 Implement AudioGraphInput.flush
PiperOrigin-RevId: 613563855
2024-03-07 06:33:02 -08:00
tofunmi
5b7774fcaf Composition: clarify javadoc to setTransmuxAudio\Video
Document that assoicated effects are ignored if these setters are set

PiperOrigin-RevId: 613518167
2024-03-07 02:58:30 -08:00
tofunmi
f8c407cfb6 TransformerInternal: pass outputformat to sampleExporter in image input
Pass firstAssetLoaderOutputFormat to videoSampleExporter for non-video use cases, so that the downstream components like the videoFrameProcessor can be set up with the right output color. Surface creation is still in the VSP so can't do this for all use cases currently.

also moves getDecoderOutputColor() to TransformerUtil, since it is used in multiple places and doesn't make sense for once to have reference to the other.

PiperOrigin-RevId: 613113958
2024-03-06 00:45:28 -08:00
Googler
e175a772db Move AudioGraph effects to configure method
Move old configure behavior to private configureMixer.
registerInput() is now required after reset().

PiperOrigin-RevId: 612795418
2024-03-05 04:46:36 -08:00
tofunmi
bcfad4b3b4 Move hdrMode from defaultAssetLoaderFactory constructors to create()
Plumbing hdrMode through the default asset loader factory via the constructor is problematic because it breaks API boundaries. It means there is another way to set hdrMode outside of Composition.java and TransformationRequest.java, which is error prone and cause problems if someone an app starts customizing the assetloaderfactory. It also means custom asset loaders can't receive this information without hacking around.

The introduction of the composition-level settings class makes this approach easily extensible for other settings applied on the composition level but use in an individual asset level basis (e.g. ultraHDR support).

PiperOrigin-RevId: 611466920
2024-02-29 07:41:18 -08:00
christosts
1355f4734d Composition preview tests with surfaces
Add abilitiy to use real surfaces in instrumentation tests
using the ActivityScenarioRule and an activity class for testing
purposes.

PiperOrigin-RevId: 611421490
2024-02-29 04:19:44 -08:00
Googler
08993b6fb1 Have VideoSampleExporter output orientation match input
This should enable trim optimization to work correctly in more cases.

PiperOrigin-RevId: 611096958
2024-02-28 07:40:53 -08:00
claincly
626a8adfd8 Test effect-enabled playback
This new test is for `ExoPlayer.setVideoEffects()`. It plays the
one-second-long video, applies an overlay that prints the video frame timestamp
onto the frame, captures the output frame and compares the captured output
frame with golden.

PiperOrigin-RevId: 610781590
2024-02-27 09:44:24 -08:00
Googler
6f28eeff31 Pick max H.264 level when trim optimizing
Instead of always starting with the transcoded H.264 level, take the maximum
from transcoded and transmuxed levels

PiperOrigin-RevId: 610759438
2024-02-27 08:27:38 -08:00
Googler
c3aec4f19d Comments for AudioGraph constructor
Add /*effects=*/ at callsites of AudioGraph constructor.

PiperOrigin-RevId: 610741692
2024-02-27 07:12:53 -08:00
sheenachhabra
94e0a27a81 Add unified addMetadata() method in Mp4Muxer
PiperOrigin-RevId: 610710011
2024-02-27 04:34:45 -08:00
Googler
0e0e1c4f1a Tests for composition audio effects
Add tests for the changes to AudioGraph that support composition audio effects

PiperOrigin-RevId: 610691768
2024-02-27 03:04:20 -08:00
Googler
477ace1be9 Composition audio effects
Implement composition-level audio effects in AudioGraph.

PiperOrigin-RevId: 610689632
2024-02-27 02:54:08 -08:00
tofunmi
0480bc31a8 Rename media/bitmap out of media and rename
PiperOrigin-RevId: 610418418
2024-02-26 08:40:19 -08:00
huangdarwin
e98858424a Test: Expand GL tone-map pixel difference threshold.
PiperOrigin-RevId: 610374358
2024-02-26 05:13:17 -08:00
sheenachhabra
a5f3db4cfe Fix java doc for setAudioProcessors and setVideoEffects method
PiperOrigin-RevId: 609778651
2024-02-23 11:05:12 -08:00
tofunmi
5a892509f7 remove media/bitmap/input_images
move the images into the respective places in the file extension directory so they file the pre-existing structure

PiperOrigin-RevId: 609744673
2024-02-23 09:07:03 -08:00
sheenachhabra
284d17cb13 Add release reason argument in the MuxerWrapper.release() method
Also called `muxer.release()` in other tests where it is
appropriate.

PiperOrigin-RevId: 609736956
2024-02-23 08:34:04 -08:00
huangdarwin
e4cf72db11 Test: Use TestName testId in TransformerSequenceEffectTest.
Some testcases that got through 0d1b35477d as they were submitted as that CL was in-progress.

PiperOrigin-RevId: 609659607
2024-02-23 02:17:59 -08:00
sheenachhabra
fd8f45b38e Add MdtaMetadataEntry constructor with default locale indicator
PiperOrigin-RevId: 609427529
2024-02-22 10:55:50 -08:00
huangdarwin
0d1b35477d Test: Use testId throughout media3 tests.
No more instances of this codesearch query after this CL in non-parameterized
tests:
`String\ testId\ \=\ \" f:media3`
PiperOrigin-RevId: 609364413
2024-02-22 07:28:55 -08:00
huangdarwin
fde6a32156 Transformer: Input decoder output color to VideoSampleExporter.
Previously, the track format was used in VideoSampleExporter. Now, we use a
simulated decoder output format.

As the last expected change for this bug, also adds release notes

PiperOrigin-RevId: 609080629
2024-02-21 12:15:11 -08:00
huangdarwin
2e9cc2784f Test: Add sequence effect test with bt601 image and bt709 video.
The lack of this test was the *real* root cause for our partner's regression :P

PiperOrigin-RevId: 608956530
2024-02-21 05:22:11 -08:00
Googler
dca7bae416 Allow mismatching H.264/AVC level for trimming or resuming
MediaCodec docs already allude to potentially mismatching H.264 level
between container and bitstream. Relax the initialization data check to
reflect this.

PiperOrigin-RevId: 608942322
2024-02-21 04:20:50 -08:00