4282 Commits

Author SHA1 Message Date
tofunmi
8feaf82768 UltraHdr: Fix calculations to apply gainmap
PiperOrigin-RevId: 636964921
2024-05-24 10:39:36 -07:00
ibaker
763a5f0272 Remove deprecated DrmSessionManager.DUMMY and getter method
Use `DRM_UNSUPPORTED` constant instead.

PiperOrigin-RevId: 636937592
2024-05-24 09:07:35 -07:00
ibaker
7fd8a06e08 Remove deprecated MediaCodecInfo.isSeamlessAdaptationSupported(...)
Use `MediaCodecInfo.canReuseCodec(...)` instead.

PiperOrigin-RevId: 636918479
2024-05-24 07:59:45 -07:00
ibaker
2ab1c75ca7 Remove deprecated DashMediaSource.DEFAULT_LIVE_PRESENTATION_DELAY_MS
Use `DashMediaSource.DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS` instead.

PiperOrigin-RevId: 636906922
2024-05-24 07:11:39 -07:00
ibaker
0f1f6bfa41 Remove deprecated DefaultHttpDataSource constructors
Use `DefaultHttpDataSource.Factory` instead.

PiperOrigin-RevId: 636875524
2024-05-24 05:03:05 -07:00
ibaker
4a16212fb3 Remove deprecated Timeline.Window.isLive field
PiperOrigin-RevId: 636870982
2024-05-24 04:37:04 -07:00
ibaker
08d1eb4376 Remove ShadowLog references from tests
These were accidentally submitted after being added for local debugging.

PiperOrigin-RevId: 636865825
2024-05-24 04:10:27 -07:00
tofunmi
db6144e7dd Maintain a consistent luminance range across HDR content in effects
PQ and HLG have different luminance ranges (max 10k nits and max 1k nits resp). In GL, colors work in a normalised 0 to 1 scale, so for PQ content, 1=10k nits and and for HLG content, 1=1k nits.

This cl scales and normalises PQ content appropriately so that all HDR content works in the HLG luminance range. This fixes two things

1. Conversions between HLG and PQ are "fixed" (before the output colors looked too bright or too dark depending on which way you are converting)
2. color-altering effects will be able to work consistently across HLG and PQ content

1 is tested in this cl. 2 will be tested when ultra HDR overlays are implemented, both cases have been manually tested to ensure the output looks correct on a screen.

PiperOrigin-RevId: 636851701
2024-05-24 03:05:34 -07:00
ibaker
cfd29e04f3 Remove PlayerMessage.setHandler(Handler)
Use `setLooper(Looper)` instead.

PiperOrigin-RevId: 636840566
2024-05-24 02:13:43 -07:00
ibaker
4fb2255eb9 Print underlying extractor name in UnrecognizedInputFormatException
If subtitle-parsing-during-extraction is enabled (now defaults to on),
the 'outer' extractor class name is often
`SubtitleTranscodingExtractor`, leading to some slightly useless error
messages like:

`None of the available extractors (FragmentedMp4Extractor, Mp4Extractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, TsExtractor, MatroskaExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, AviExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor, SubtitleTranscodingExtractor)`

PiperOrigin-RevId: 636834354
2024-05-24 01:44:12 -07:00
Copybara-Service
0a58832d85 Merge pull request #1315 from datdoantelus:ClosedCaption_708Decoder_bugfix
PiperOrigin-RevId: 636591170
2024-05-23 10:18:02 -07:00
ibaker
e150e0d39f Remove OkHttpDataSource constructors & OkHttDataSourceFactory
Use `OkHttpDataSource.Factory` instead.

PiperOrigin-RevId: 636585523
2024-05-23 10:03:12 -07:00
ibaker
4986fdd1a6 Remove deprecated setContentTypePredicate() methods
Use the suggested alternative on the respective
`XXXDataSource.Factory` instead.

PiperOrigin-RevId: 636560182
2024-05-23 08:32:26 -07:00
tonihei
7b352e1903 Add more details to thread assertion in onAudioCapabilitiesChanged
This helps to debug issues reported in https://github.com/androidx/media/issues/1191

PiperOrigin-RevId: 636545970
2024-05-23 07:37:04 -07:00
Ian Baker
3aebb38cd3 Rename and reshuffle tests 2024-05-23 15:27:19 +01:00
datdoantelus
ed5d47e856 Add cea708Decoder test for setPenLocation command and newline handling 2024-05-23 15:22:13 +01:00
datdoantelus
327d26cb32 remove test comment 2024-05-23 15:21:45 +01:00
datdoantelus
ec3065e981 revert rowLock and colomnLock changes since it will be done separately 2024-05-23 15:21:32 +01:00
datdoantelus
3b7ec52ca8 Ignore rowLock and numLock as define in CTA-708 spec.
Update current row value when new line is added.
2024-05-23 15:21:11 +01:00
andrewlewis
174d452bf7 Add missing module registrations
PiperOrigin-RevId: 636506860
2024-05-23 04:50:01 -07:00
samrobinson
414dbebc2b Assert file size in E2E android tests that claim to complete.
Remove redundant test logic to add file size to ExportResult because
the file size is already added to export result as part of an export
finishing.

PiperOrigin-RevId: 636499236
2024-05-23 04:17:19 -07:00
tonihei
08006651fa Update session module registration
PiperOrigin-RevId: 636482934
2024-05-23 03:11:51 -07:00
Googler
37c2d9957e Fragmented Mp4Muxer: add support to B-frame Muxing
Add composition time offset parameter to TRUN box to
support muxing of videos containing B-frames by FragmentedMp4Muxer.
Update TRUN box version from 0 to 1 in order to manage signed
composition time offset.

PiperOrigin-RevId: 636426397
2024-05-22 23:07:35 -07:00
Copybara-Service
1ffeafecc3 Merge pull request #1384 from trussellswitch:parse-dashif-laurl
PiperOrigin-RevId: 636205459
2024-05-22 10:06:52 -07:00
ibaker
8d515c8cdc MP3: Make a defensive copy of the header in XingFrame constructor
This is currently set from `Mp3Extractor.synchronizedHeader` which
gets overwritten every time we read a new frame. It seems safer to make
this defensive copy (and there will be at most one `XingFrame` instance
per-playback, so this is not prohibitively expensive).

PiperOrigin-RevId: 636181038
2024-05-22 08:48:35 -07:00
dancho
a74076f691 Trigger silence generation when end of stream is encountered
This change avoids a muxer deadlock when:
1. Sequence of items
2. First item has audio track that is shorter than video
3. Audio finishes, and muxer refuses to write more than 500ms of video
   consecutively.

SequenceAssetLoader fails to progress to the second item. A muxer
deadlock is possible when the audio of the first item finishes,
audio end-of-stream is not propagated through AudioGraph, and muxer blocks
video, preventing SequenceAssetLoader to move to the next item in sequence.

By triggering silence generation early as soon as audio EOS is
encountered, we ensure SequenceAssetLoader can progress to the next item.

PiperOrigin-RevId: 636179966
2024-05-22 08:44:28 -07:00
tonihei
9ccc4b27ef Add test and formatting changes 2024-05-22 15:08:52 +01:00
Trevor Russell
521c52fdb9 Parse dashif:Laurl license url in mpd 2024-05-22 15:08:52 +01:00
ibaker
5b3066f380 MP3: Derive duration and bitrate from frame count in Info header
`Info` header is used for CBR files, but in some cases not **every**
frame in these files is the same size. This change stops using the
single frame after the `Info` frame as the 'template' (and assuming all
subsequent frames are the same size/bitrate), and instead derives the
bitrate from fields in the `Info` header. This works for files which are
'almost' constant bitrate, like the one in Issue: androidx/media#1376 where every
frame is either 1044 or 1045 bytes except the one immediately after the
`Info` frame which is 104 bytes (32kbps), resulting in a wildly
incorrect duration calculation.

PiperOrigin-RevId: 636151605
2024-05-22 06:59:10 -07:00
dancho
c2fb2f1520 Work around 1080p export failures on certain devices
Fall back to using software decoder for 1920x1080 for certain
devices.

PiperOrigin-RevId: 636132298
2024-05-22 05:38:50 -07:00
tonihei
fb7cf154de Make getIconResIdForIconConstant public
This allows controller apps to map these constants to suitable
icons without creating a CommandButton instance first.

PiperOrigin-RevId: 636096841
2024-05-22 03:03:03 -07:00
Copybara-Service
d175223cc6 Merge pull request #1339 from colinkho:set-play-when-ready-load-control-branch
PiperOrigin-RevId: 636095759
2024-05-22 02:57:15 -07:00
kimvde
72ba3554a9 Set image duration on all media types
This was previously only set on images because it was not ignored on
other media types. This parameter was made no-op for non-images in
7b2a1b4443.

PiperOrigin-RevId: 636078142
2024-05-22 01:41:50 -07:00
kimvde
9506445148 Remove VideoFrameReleaseControl setter from SinkProvider
Move the parameter to the constructor instead.

PiperOrigin-RevId: 636077477
2024-05-22 01:38:56 -07:00
samrobinson
b6ce35d741 Migrate debug trace logs to track generic events for Muxer.
Track information is added to the details string where relevant.

PiperOrigin-RevId: 635815866
2024-05-21 08:33:12 -07:00
tofunmi
44f2f5056f Add new line between printing glsl source code in error
PiperOrigin-RevId: 635812838
2024-05-21 08:21:56 -07:00
ibaker
8fdf105ab4 Re-apply CEA-608 validDataChannelTimeoutMs assertion
This change was originally made in 379cb3ba54.

It was then accidentally lost in when `Cea608Parser` was merged back
into `Cea608Decoder` in 25498b151b.

This was spotted when re-doing a similar lost change to `Cea708Decoder`,
reported in https://github.com/androidx/media/pull/1315.

See reasoning on e2847b3b80
about why this is the only 'lost' CEA-608 change.

PiperOrigin-RevId: 635803536
2024-05-21 07:45:35 -07:00
ibaker
e2847b3b80 Re-apply CEA-708 rowLock/columnLock fix
This change was originally made in 6f8249184b

It was then accidentally lost in when `Cea708Parser` was merged back
into `Cea708Decoder` in 51b4fa2cc8.

This is the only change made to the actual 'decoding' logic in
`Cea708Parser` between it being split from `Cea708Decoder` and merged
back in again, all the other changes in this period relate to the
implementation of the `SubtitleParser` interface, so don't need to be
preserved in `Cea708Decoder`:
51b4fa2cc8/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea708Parser.java

`Cea608Parser` was also merged back into `Cea608Decoder` in
25498b151b
and so is vulnerable to the same risk of accidental loss of changes. To
be sure, I also checked the history of this file:
25498b151b/libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea608Parser.java

The only 'decoding logic' change there is 379cb3ba54,
which was also lost in 25498b151b.
I will send a separate change to resolve this.

PiperOrigin-RevId: 635796696
2024-05-21 07:16:04 -07:00
ibaker
17bf47ed24 MP3: Add test CBR sample with 'too small' PCUT frame
This shows ExoPlayer currently wrongly reports the duration of this
sample, because it assumes every frame is 32kbps (104 bytes) due to the
`PCUT` frame immediately after the `Info` frame.

A follow-up change will modify `Info` frame handling to resolve this
issue.

This sample was crafted using a hex editor to insert the additional
`PCUT` frame (the pattern of `null` and `x` is taken from the sample
file in Issue: androidx/media#1376, the header is modified to set the channel count
to 1 to match the rest of the file), and then update the frame count
and data size of the `Info` header to match.

Issue: androidx/media#1376
PiperOrigin-RevId: 635772837
2024-05-21 05:31:44 -07:00
samrobinson
8e4d82b012 Assert file exists before trying to re-decode for test assertions.
PiperOrigin-RevId: 635748820
2024-05-21 03:41:48 -07:00
andrewlewis
2585051294 Move license to top for consistency
PiperOrigin-RevId: 635742699
2024-05-21 03:16:30 -07:00
claincly
e637ccd4aa Fix javadoc formatting
PiperOrigin-RevId: 635737466
2024-05-21 02:53:43 -07:00
dancho
ae240606db Move bitmap coordinate flip out of fragment shader
Fragment shaders in OpenGL ES shader language aren't guaranteed
to support highp, required to correctly represent pixel coordinates
inside large images (e.g. 1920x1080).
This change moves coordinate mirroring for images out of fragment shader.

Fixes http://Issue: androidx/media#1331

PiperOrigin-RevId: 635732208
2024-05-21 02:31:43 -07:00
dancho
b047e81e02 Work around SurfaceTexture implicit scale
If MediaCodec allocates passes an image buffer with a cropped region,
SurfaceTexture.getTransformMatrix will cut off 2 pixels from each dimensions.
The resulting videos will appear a little stretched.

This patch inspects the SurfaceTexture transform matrix, and guesses what the
unscaled transform matrix should be.
Behind experimentalAdjustSurfaceTextureTransformationMatrix flag

PiperOrigin-RevId: 635721267
2024-05-21 01:46:21 -07:00
tofunmi
c409623ca0 Create equals method for gainmaps
Gainmaps don't currently have an equals override, only reference equality is checked by Objects.equals(gainmap1, gainmap2). Create an equals method for gainmaps with the fields we care about to ensure we don't incur false positives in our equality checks.

PiperOrigin-RevId: 635510451
2024-05-20 11:06:03 -07:00
samrobinson
c9854cd695 Make flag for debug traces in logcat private and final.
PiperOrigin-RevId: 635465538
2024-05-20 08:38:33 -07:00
samrobinson
07ddc0fca5 Add debug trace for Muxer completely ending.
PiperOrigin-RevId: 635459757
2024-05-20 08:12:57 -07:00
tonihei
c46bb24264 Move parameters inside LoadControl and use it for shouldStartPlayback
+additional formatting and Javadoc changes
2024-05-20 15:53:07 +01:00
Colin Kho
be5cf6b5fd Allow LoadControl.shouldContinueLoading accept playWhenReady as a parameter 2024-05-20 15:48:14 +01:00
claincly
dc4f20ed84 Fix image seeking
Queue image again after position reset, and reset timestamp iterator.

PiperOrigin-RevId: 635049953
2024-05-18 07:41:14 -07:00