21983 Commits

Author SHA1 Message Date
ibaker
1772050ece Remove confusing null from ParserException.getMessage()
When reading quickly this suggests something 'real' was null (similar to
a `NullPointerException`), but it's actually just the message from the
superclass.

Seen in stack trace in Issue: androidx/media#2074:

```
Caused by: androidx.media3.common.ParserException: null {contentIsMalformed=true, dataType=1}
```

PiperOrigin-RevId: 719240235
2025-01-24 03:55:19 -08:00
shahddaghash
382f30616a Rollback of b25d6ef249
PiperOrigin-RevId: 719238418
2025-01-24 03:46:54 -08:00
dancho
dddcdf1613 AV1 sequence header parsing
PiperOrigin-RevId: 719200478
2025-01-24 01:25:58 -08:00
ibaker
a7a5d6e92b Suppress (and log) subtitle errors in SubtitleTranscodingTrackOutput
This is equivalent to the error suppression for legacy subtitles in
`TextRenderer`:
76088cd6af/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/text/TextRenderer.java (L357-L359)

This new suppression only affects errors thrown from files with
subtitles muxed together with audio/video. Standalone subtitle
files, and containers containing only text tracks, are handled
by the existing error suppression/reporting added in
49dec5db8b.

Issue: androidx/media#2052
PiperOrigin-RevId: 718930243
2025-01-23 10:49:23 -08:00
claincly
6b54372df8 Have Sequence Player end as audio sink position is passed
The fix is to update `AudioGraphInputAudioSink.lastHandledPositionUs` when a buffer is handled, and end the `AudioGraphInputAudioSink` as the final audio sink plays out further than this position.

PiperOrigin-RevId: 718901825
2025-01-23 09:38:19 -08:00
Copybara-Service
c1242ffef1 Merge pull request #1235 from DolbyLaboratories:dlb/dovi-transformer/dev
PiperOrigin-RevId: 718856455
2025-01-23 07:26:21 -08:00
dancho
61b7dfd7ba Add ObuParser to split a ByteBuffer into AV1 OBUs
PiperOrigin-RevId: 718813571
2025-01-23 04:46:38 -08:00
Copybara-Service
916018d9fe Merge pull request #1936 from colinkho:eval-buf
PiperOrigin-RevId: 718809019
2025-01-23 04:27:16 -08:00
microkatz
b6d4886887 Reevaluate ongoing chunk loading when pausing 2025-01-22 16:23:55 +00:00
ibaker
9bb254f697 Skip SSA cues where end time is before or equal to start time
The file in Issue: androidx/media#2052 contains a cue with the following timecode:

```
0:00:00:00,0:00:00:00
```

The content of this cue seems to be some 'converted by' metadata, i.e.
it's basically a comment and clearly not intended to be shown on
screen (since it has zero duration).

There is some fiddly logic later in `SsaParser` to support overlapping
cues with the old `Subtitle` structure [1], and this logic gets tripped
up by the start and end time being equal, which results in a
**single**, empty `List<Cue>` being added - which trips up another
assumption that every SSA cue line results in at least two `List<Cue>`
entries (one containing the cue text, and another containing an empty
list to signal the end of the cues).

This fiddly logic is no longer required, because overlapping
`CuesWithTiming` objects can now be merged in `TextRenderer`, so there
is a possible future simplification to `SsaParser` which removes a lot
of this complexity.

[1] Added in <unknown commit>

PiperOrigin-RevId: 718380386
2025-01-22 07:41:24 -08:00
Colin Kho
8b0cfda178 Move queue reevaluate buffer to only execute when playWhenReady is set to false 2025-01-22 15:18:16 +00:00
Colin Kho
15bdbf735d Reevaluate buffer during a playWhenReady change 2025-01-22 15:18:16 +00:00
sheenachhabra
431efc9c50 Skip exportTranscodeBt2020Sdr test on sm-a325f API 33
The decode over reports its resolution capabilities and
decoder initialization eventually fails.

PiperOrigin-RevId: 718294047
2025-01-22 02:37:15 -08:00
kimvde
635e699965 Various improvements to BufferingVideoSink
PiperOrigin-RevId: 717807436
2025-01-21 01:54:45 -08:00
ibaker
5421a74d06 Tighten two MediaCodecRenderer fields to @MonotonicNonNull
Remove some `checkNotNull` calls that are no longer needed.

PiperOrigin-RevId: 717597046
2025-01-20 12:14:56 -08:00
sheenachhabra
7c10ef03e4 Check full format support in decoder for Transformer
For the case where a hardware decoder does not fully
support the requested format, a software decoder will
be preferred.

PiperOrigin-RevId: 717584768
2025-01-20 11:27:13 -08:00
sheenachhabra
6fe011beb4 Make Mp4Muxers and FragmentedMp4Muxers implement AutoCloseable
PiperOrigin-RevId: 717549236
2025-01-20 09:02:25 -08:00
sheenachhabra
a31c7ad9a8 Move Muxer.java interface into transformer module
Muxer interface is used only in transformer.

PiperOrigin-RevId: 717538306
2025-01-20 08:13:42 -08:00
sheenachhabra
fb58bdfd52 Refactor: Mp4Muxer and FragmentedMp4Muxer no longer implement Muxer
Mp4Muxer and FragmentedMp4Muxer has different contracts
and they can not implement same interface.

PiperOrigin-RevId: 717526288
2025-01-20 07:20:48 -08:00
sheenachhabra
c22798f99c Removing redundant call to setLastSampleDurationBehavior on muxer
The default value is already
LAST_SAMPLE_DURATION_BEHAVIOR_SET_FROM_END_OF_STREAM_BUFFER_OR_DUPLICATE_PREVIOUS

PiperOrigin-RevId: 717497116
2025-01-20 05:14:47 -08:00
kimvde
8abd36fb27 Simplify MediaCodecRenderer.maybeInitializeProcessingPipeline
PiperOrigin-RevId: 717466577
2025-01-20 03:07:59 -08:00
tonihei
190563b8eb Move StreamVolumeManager system calls to playback thread
This requires some additional state handling to update the full
state atomically and guess placeholder states while updates are
in progress, using the newly added BackgroundThreadStateHander.

Some tests also needed to be adjusted to account for the fact
that the actual audio system change doesn't happen inline
anymore.

PiperOrigin-RevId: 716702141
2025-01-17 09:47:33 -08:00
sheenachhabra
c797249998 Move supported sample mime types list in specific muxer
This will reduce the risk of list becoming stale
(its already stale, to be fixed).

PiperOrigin-RevId: 716685242
2025-01-17 08:51:44 -08:00
claincly
a0618eb0ec Adds a test on using composition level effects
Also simplifies the test a bit.

PiperOrigin-RevId: 716683585
2025-01-17 08:46:44 -08:00
sheenachhabra
4ac4f7e2e0 Split InAppMuxer into InApp Mp4Muxer and FragmentedMp4Muxer
This is pre work required to remove `Muxer.java` interface
from the muxer module.
`Mp4Muxer` and `FragmentedMp4Muxer` will no longer implement
the `Muxer` interface.

PiperOrigin-RevId: 716669531
2025-01-17 08:01:28 -08:00
tonihei
a4d9a3e096 Move Wake/WifiLockManager system calls to playback thread
PiperOrigin-RevId: 716235808
2025-01-16 07:58:32 -08:00
tonihei
297b2b9956 Add util to handle background state updates and placeholder states.
This is a common pattern in media3 libraries where tasks are handled on a
background thread, but the calling thread sees an immediate state update
with a best-guess placeholder. This makes the integration for the caller
very easy as the API surface appears to be synchronous.

This util is a helper class to handle this logic and test it separately.

PiperOrigin-RevId: 716233966
2025-01-16 07:53:15 -08:00
Copybara-Service
fda8b8a35d Merge pull request #2023 from DolbyLaboratories:dlb/dovi-format/dev
PiperOrigin-RevId: 716226613
2025-01-16 07:26:46 -08:00
tonihei
4328d29f34 Lazily initialize current audio capabilities in DefaultAudioSink
PiperOrigin-RevId: 716224052
2025-01-16 07:17:26 -08:00
claincly
1732892927 Add tests for multi input video
PiperOrigin-RevId: 716208222
2025-01-16 06:19:47 -08:00
kimvde
b2c31b0743 Small nits in SequenceRenderersFactory
PiperOrigin-RevId: 716187537
2025-01-16 04:56:49 -08:00
claincly
0d8e42238e Stop checking all inputs ended when releasing compositor
This could happen when the player is released before ending so not all input
has ended.

PiperOrigin-RevId: 716173884
2025-01-16 04:11:21 -08:00
shahddaghash
f5f5b63bf7 Pass video data space to MediaItemInfo
The `DataSpace` contains the Color Standard, Range, and Transfer. These values were mapped as follows:
* Standard: From `@C.ColorSpace` to `@DataSpace.DataSpaceStandard`
* Range: From `@C.ColorRange` to `@DataSpace.DataSpaceRange`
* Transfer: From `@C.ColorTransfer` to `@DataSpace.DataSpaceTransfer`

PiperOrigin-RevId: 716157142
2025-01-16 03:03:19 -08:00
simakova
22142e0db3 Add keepScreenOn flag in Composition demo
PiperOrigin-RevId: 716139653
2025-01-16 01:57:53 -08:00
Googler
492574bded Rollback of 871381288c
PiperOrigin-RevId: 715891934
2025-01-15 12:08:40 -08:00
shahddaghash
e9b82ee951 Pass video frame rate and video size to MediaItemInfo
The frame rate, height, and width are extracted from the format of processedInput.

PiperOrigin-RevId: 715843086
2025-01-15 10:09:12 -08:00
shahddaghash
04c2d22178 Pass containerMimeType and sampleMimeType to MediaItemInfo
If a format is passed to `ExportResult.ProcessedInput`, the `containerMimeType` and `sampleMimeType` are extracted from the Format and passed inside the `MediaItemInfo` object.

PiperOrigin-RevId: 715840400
2025-01-15 10:03:57 -08:00
bachinger
b49eaf9e87 Add two MetadataRenderer instances by default
To receive multiple schemes of metadata emitted by a stream, multiple
`MetadataRenderer` instances need to be used. This change makes
`DefaultRenderersFactory` add two metadata renderers by default.

PiperOrigin-RevId: 715790821
2025-01-15 07:31:13 -08:00
dancho
0936b549ae Enable non-reference frame skipping in FrameExtractor
Speed up FrameExtractor for videos with non-ref frames

PiperOrigin-RevId: 715789816
2025-01-15 07:27:54 -08:00
kimvde
c5feb28838 Increase FrameExtractorTest timeout
FrameExtractorTest.extractFrame_pastDuration_returnsLastFrame is
sometimes timing out on emulator because it's too slow.

PiperOrigin-RevId: 715771071
2025-01-15 06:18:10 -08:00
michaelkatz
fa4cc7c65c Reduce flakiness for MediaCodecAudioRendererTests past SDK 30
PiperOrigin-RevId: 715770321
2025-01-15 06:15:26 -08:00
michaelkatz
62341f31f9 Reduce flakiness for MediaCodecVideoRendererTests past SDK 30
PiperOrigin-RevId: 715761006
2025-01-15 05:37:40 -08:00
tonihei
a2016f03c6 Remove ExoPlayer components
They have been deprecated since ExoPlayer 2.16.0 and can be easily
replaced by the exact same call in ExoPlayer directly.

PiperOrigin-RevId: 715755105
2025-01-15 05:11:09 -08:00
dancho
ee4a0ea3df Remove deprecated experimentalParseWithinGopSampleDependencies
Remove deprecated API in favor of
experimentalSetCodecsToParseWithinGopSampleDependencies.

PiperOrigin-RevId: 715731718
2025-01-15 03:43:55 -08:00
ibaker
736c7528cb Ignore EOS buffer timestamps in CeaDecoder.queueInputBuffer
This is aligned with the documentation of `MediaCodec` which says the
timestamp of a buffer with `BUFFER_FLAG_END_OF_STREAM` should be
ignored:
https://developer.android.com/reference/android/media/MediaCodec#end-of-stream-handling

Add a test that exercises this by clipping off the end of a sample with
CEA-608 captions, because this creates an EOS-flagged buffer with a
non-EOS timestamp.

Also add a straightforward playback test for the
`fragmented_captions.mp4` sample.

PiperOrigin-RevId: 715716036
2025-01-15 02:40:07 -08:00
Googler
2b9c7f8392 Add minimum size for OpusDecoder's streamMap.
PiperOrigin-RevId: 715453498
2025-01-14 11:17:09 -08:00
shahddaghash
465399b57e Disable default collection of platform diagnostics
This is to prevent facing errors in apps using Transformer. It will be enabled again once the project is done and comprehensive tests are added.

PiperOrigin-RevId: 715435613
2025-01-14 10:33:50 -08:00
sheenachhabra
1b2e391971 Change muxer instrumentation tests to robolectric
These tests were earlier using `MediaExtractor`, hence
they were in androidTest. Now `MediaExtractor` has been
replaced with `media3 MediaExtractorCompat` so these
test can be robolectric.

PiperOrigin-RevId: 715424470
2025-01-14 10:09:25 -08:00
kimvde
fbf9be2f00 Fix composition player repeat mode
Some checks in SingleInputVideoGraph were causing CompositionPlayer to
throw for a single media item sequence when repeat mode was enabled. The
reason was that, in this case, no new input stream is registered to the
VideoFrameProcessor.

PiperOrigin-RevId: 715409509
2025-01-14 09:20:14 -08:00
michaelkatz
2361624222 Make MediaCodecAudioRenderer.getDurationToProgressUs protected
This method is not intended to be exposed as 'public' as it was meant
to be internal to the class/subclasses.

PiperOrigin-RevId: 715402007
2025-01-14 09:00:37 -08:00