3943 Commits

Author SHA1 Message Date
tofunmi
f4fefd19f7 Document and test multi asset ultraHDR support
PiperOrigin-RevId: 619200688
2024-03-26 08:39:44 -07:00
ibaker
d00ca1e343 Plumb MP3 average bitrate from metadata frames into Format
Issue: androidx/media#1081

#minor-release

PiperOrigin-RevId: 619185083
2024-03-26 07:40:08 -07:00
tonihei
6e0f8e3b0d Remove decode-only flag
No known component is using this flag anymore and it has been
deprecated for a while for custom renderers and decoders.

PiperOrigin-RevId: 619154299
2024-03-26 05:28:27 -07:00
tofunmi
ef2314c404 Move bitmap decoding out of datasource util
PiperOrigin-RevId: 619139208
2024-03-26 04:10:38 -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
tonihei
0f42dd4752 Use output start time instead of deprecated isDecodeOnly in CeaDecoder
PiperOrigin-RevId: 619133908
2024-03-26 03:47:18 -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
Googler
f4e444bdd2 Internal change
PiperOrigin-RevId: 618879473
2024-03-25 10:12:34 -07:00
tonihei
ab0391167c Include nullness of MediaMetadata.extras in equals method
This ensures MediaMetadata with just non-null extras is not
considered equal to MediaMetadata.EMPTY. This makes sure the
contents are bundled when a controller sets the extras in a
new MediaItem

Issue: androidx/media#1176

#minor-release

PiperOrigin-RevId: 618876642
2024-03-25 10:05:15 -07:00
ibaker
fd268eed46 Remove unecessary re-setting of group from session Gradle files
These TODOs precede <unknown commit> when the group was set in the top-level
`build.gradle` file.

Issue: androidx/media#1215
PiperOrigin-RevId: 618835040
2024-03-25 07:33:05 -07:00
ibaker
d997ba367c Rollback of 7cffae9cd0
PiperOrigin-RevId: 618799275
2024-03-25 04:30:55 -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
tonihei
ed505df2ca Partial revert of 3a7d31a599
The original change did not set the color info in the codec
for standard SDR infos. This was meant to help with consistency
to avoid a situation where the information is partially set and
later the bitstream provides slightly different values (all in
standard SDR though).

We can revert this part because the bitstream may change anyway
and the decoder needs to handle this internally. And more
importantly, it also avoids removing this information when encoding
the format again in Transformer.

PiperOrigin-RevId: 617582066
2024-03-20 11:51:25 -07:00
sheenachhabra
2491dd07e1 Process all samples before writing them to mdat
This refactoring is required to support 3 byte NAL start code, in which
the sample ByteBuffer might change after AnnexB to Avcc conversion.
This would required changes in the corresponding BufferInfo as well.

PiperOrigin-RevId: 617538338
2024-03-20 09:33:10 -07:00
tonihei
3a7d31a599 Don't set codec color info for default SDR
Some media can read color info values from the bitstream
and may partially set some of the SDR default values in
Format.ColorInfo. Setting these default values for SDR can
confuse some codecs and may also prevent adaptive ABR
switches if not all ColorInfo values are set in exactly the
same way.

We can avoid any influence of HDR color info handling by
disabling setting the color info MediaFormat keys for SDR
video and also avoid codec reset at format changes if both
formats are SDR with slightly different ColorInfo settings.

To identify "SDR" ColorInfo instances, we need to do some
fuzzy matching as many of the default values are assumed to
match the SDR profile even if not set.

Issue: androidx/media#1158
PiperOrigin-RevId: 617473937
2024-03-20 04:58:13 -07:00
sheenachhabra
3272ad50f3 Skip AnnexB to Avcc conversion for AV1 video format
The AV1 video stream does not contain NAL unit which is a concept
specific to H.264/H.265.
This was not caught before muxer does an in place replacement of
`NAL start code` with `NAL length`. In the absence of `NAL start code`
it was automatically a no-op.

PiperOrigin-RevId: 617193317
2024-03-19 09:18:44 -07:00
sheenachhabra
e14156aa3b Rename test classes having duplicate names
PiperOrigin-RevId: 616887534
2024-03-18 11:16:48 -07:00
huangdarwin
33a87a451c Test: Remove EnsuresNonNull from media3 editing tests.
nullness checks were removed a while ago from editing, so no need for them now.

Bit neater to have less code to parse too.

Also, removes RequiresNonNull

PiperOrigin-RevId: 616887502
2024-03-18 11:13:10 -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
claincly
e8612a0c02 Add warning log if no output is set
PiperOrigin-RevId: 616796787
2024-03-18 05:33:17 -07:00
tianyifeng
2c8d07c2dd Inform DefaultPreloadManager when player uses PreloadMediaSource
Add a new method `onUsedByPlayer(PreloadMediaSource)` for `PreloadMediaSource.PreloadControl`, which will be invoked when the player starts to use the `PreloadMediaSource`, or calling `PreloadMediaSource.preload` while the player is already using that source. `DefaultPreloadManager` will immediately preload the next source when receiving `onUsedByPlayer` event.

PiperOrigin-RevId: 616789121
2024-03-18 04:54:49 -07:00
tonihei
87f4a3ca71 Add some clarifications around CommandButton.iconUri to Javadoc
PiperOrigin-RevId: 616775044
2024-03-18 03:43:36 -07:00
huangdarwin
cbc654a721 GL: Use GLES20.GL_FALSE and GL_TRUE instead of hardcoded value.
PiperOrigin-RevId: 616759833
2024-03-18 02:35:55 -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
4d1ede5432 Ultra HDR: release texture after use
PiperOrigin-RevId: 616209205
2024-03-15 12:23:45 -07:00
tofunmi
fe640da5e8 Transformer: add speedChange API
PiperOrigin-RevId: 616163061
2024-03-15 10:02:37 -07:00
tofunmi
762065fae0 Add api to find duration after an effect is applied
PiperOrigin-RevId: 616157067
2024-03-15 09:41:40 -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
b9843af6a0 SpeedChangingAudioProcessor: process all callbacks after audio ends
PiperOrigin-RevId: 616143969
2024-03-15 08:54:26 -07:00
huangdarwin
b126bae93d Effect: Add EGL_EXT_gl_colorspace_bt2020_hlg support, on API 34+
Confirmed that the HLG extension displays properly on Pixel 7 Pro, API 34 and Samsung S24, API 34. On these devices, this fixes the washed out HLG preview issue on API 34, where the PQ ext had a washed out look, and where the HLG ext is supported (this bug didn't occur on API 33, only 34).

More info on manual tests done to sanity-check:
* Test cases: Transformer debug SurfaceView and ExoPlayer.setVideoEffects
* Test inputs: HLG and PQ
* Test devices: Pixel 7 Pro (API 33 & 34), Samsung Galaxy S24 (API 34)
* Added debugging: Logging colorInfo used in GlUtil.createEglSurface

No regressions were seen. HLG extension is used more in API 34, and behavior stays the same on API 33. Only human-visible change without logging is that HLG content looks better on API 34, for Samsung S24 and Pixel 7 Pro.

PiperOrigin-RevId: 616131192
2024-03-15 08:06:49 -07:00
tofunmi
c0ffc94d15 Add GlEffect that asynchronously adjusts input presentation times
Single asset export only effect.

PiperOrigin-RevId: 616114153
2024-03-15 06:56:25 -07:00
ibaker
48cffc849a Fix proguard rule for DefaultVideoFrameProcess.Factory.Builder.build()
Issue: androidx/media#1187

#minor-release

PiperOrigin-RevId: 616112879
2024-03-15 06:50:16 -07:00
ibaker
e9ed874e51 Don't emit a CuesWithTiming for zero-duration Subtitle events
It's a bit arguable whether the `Subtitle` implementation supports
zero-duration events, since `getEventTimeCount` is documented as
effectively "the number of times the cues returns by `getCues(long)`
changes", and zero-duration events violate that. However, the current
`WebvttSubtitle` impl **does** produce zero-duration events, so it
seems safer to handle them gracefully here and then, as a possible
follow-up, fix the `WebvttSubtitle` impl (or remove it completely).

Issue: androidx/media#1177

#minor-release

PiperOrigin-RevId: 616095798
2024-03-15 05:26:21 -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
Copybara-Service
e9a28beb44 Merge pull request #1117 from loliball:dev_wav_align_fix
PiperOrigin-RevId: 615820438
2024-03-14 10:17:49 -07:00
Rohit Singh
c84a3279d3 Add unit test 2024-03-14 16:12:40 +00: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
sheenachhabra
80247bc32c Remove deprecated methods from Mp4Muxer class
PiperOrigin-RevId: 615736494
2024-03-14 04:59:02 -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