22900 Commits

Author SHA1 Message Date
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
rohks
75607ac1eb Add tests for setDataSource APIs to MediaExtractorContractTest
Added remaining tests to cover all `setDataSource` APIs in `MediaExtractor`.

PiperOrigin-RevId: 725616816
2025-02-11 07:11:06 -08:00
Googler
a5e5374ba0 Enable ALL_CODECS MediaCodec list when decoding MV-HEVC video.
This is needed since MV-HEVC decoder is marked as a special codec in the media_codecs.xml file.

PiperOrigin-RevId: 725616290
2025-02-11 07:10:08 -08:00
rohks
a5689735a1 Replace assumeTrue with @SdkSuppress for SDK version checks
PiperOrigin-RevId: 725616043
2025-02-11 07:08:16 -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
Googler
fafd12bcfe Rollback of 4ed9abd05b
PiperOrigin-RevId: 725575345
2025-02-11 04:26:50 -08:00
kimvde
9f60eb3825 Fix TODOs formatting in Transformer
PiperOrigin-RevId: 725572106
2025-02-11 04:15:32 -08:00
dancho
5510635620 MCVR Parse AV1 sequence headers in onQueueInputBuffer
AV1 random access points (sync samples) contain updated sequence headers
that are needed for later frame parsing.

PiperOrigin-RevId: 725565810
2025-02-11 03:50:32 -08:00
Googler
50d4e66308 Add getInputFormat to Codec interface
PiperOrigin-RevId: 725552831
2025-02-11 02:58:55 -08:00
jbibik
d022b570f2 Upgrade Kotlin to 2.0.20
This upgrade allows us to use https://developer.android.com/develop/ui/compose/compiler as specified in https://developer.android.com/jetpack/androidx/releases/compose-kotlin#pre-release_kotlin_compatibility

kotlinOptions is considered deprecated in preference of kotlin.compilerOptions (https://kotlinlang.org/docs/gradle-compiler-options.html#how-to-define-options)

PiperOrigin-RevId: 725266131
2025-02-10 10:32:47 -08:00
andrewlewis
1a996d87ca Add MediaProjectionAssetLoader
The new asset loader is a wrapper around a provided `MediaProjection` and
`SurfaceAssetLoader`.

The test relies on automating the UI to get a `MediaProjection` instance, which
doesn't work reliably on all devices, so it's restricted to Pixel devices from
API 29 onwards.

For now only video is supported. The plan is to add support for audio playback
capture (also using `MediaProjection`) in a later change(s).

PiperOrigin-RevId: 725241962
2025-02-10 09:23:34 -08:00
kimvde
faf555e12b MultipleInputVideoGraph: Destroy EGL context on GL thread
PiperOrigin-RevId: 725159572
2025-02-10 04:25:32 -08:00
kimvde
cadecf0219 Add video prewarming to CompositionPlayer
PiperOrigin-RevId: 725153751
2025-02-10 04:04:19 -08:00
Googler
aa6183e883 Update EncoderPerformanceAnalysisTest
PiperOrigin-RevId: 725150395
2025-02-10 03:48:38 -08:00
Googler
0ba3bf66c6 Add raw audio support to Mp4Muxer.
The fourcc used is `sowt` for little endian 16 bit PCM and `twos` for big endian 16 bit PCM.

PiperOrigin-RevId: 724391195
2025-02-07 10:26:48 -08:00
tianyifeng
1190980616 Remove deprecated DownloadHelper constructor and util method
PiperOrigin-RevId: 724300907
2025-02-07 04:50:49 -08:00
dancho
65e7b599d8 AV1 treat show_existing_frame headers as not depended on
PiperOrigin-RevId: 724300793
2025-02-07 04:49:10 -08:00
claincly
babc2dd416 Match with ExoPlayer seeking when using CompositionPlayer
In a image sequence, seek to after the image duration should render the final
image frame. But currently it hangs as ConstantRateTimestampIterator doesn't
output any timestamp in this case

PiperOrigin-RevId: 724295475
2025-02-07 04:26:00 -08:00
ibaker
5e6fb88372 Add missing LINT.If/ThenChange comments
PiperOrigin-RevId: 724291745
2025-02-07 04:10:41 -08:00
claincly
d23d4fc314 Add more test cases to the seek test
This test also changes the image seeking behavior to match ExoPlayer: now if
seeking to after the end of the image, the last frame of the image would still
be presented.

PiperOrigin-RevId: 724054371
2025-02-06 13:35:40 -08:00
tianyifeng
d641f6a04c Allow setting byte range for progressive media in DownloadRequest
PiperOrigin-RevId: 723995315
2025-02-06 10:52:10 -08:00
ibaker
097771306d Remove LINT.IfChange comments with no following LINT.ThenChange
PiperOrigin-RevId: 723918659
2025-02-06 06:58:11 -08:00
kimvde
e229f957e6 A few nits
PiperOrigin-RevId: 723859603
2025-02-06 02:57:11 -08:00
dancho
a56a0bd928 MCVR: drop decoder input buffers when the decoder is late
* Add experimentalSetMinEarlyUsToDropDecoderInput to DefaultRenderersFactory
and MediaCodecVideoRenderer
* Enable dropping decoder input buffers inside MCVR.shouldIgnoreFrame
* Track consecutive dropped buffers via priority queue for reordering

PiperOrigin-RevId: 723837356
2025-02-06 01:40:28 -08:00
rohks
baf46d36d9 Bump Media3 version to 1.6.0-alpha03
#cherrypick

PiperOrigin-RevId: 723531635
2025-02-05 09:03:49 -08:00
rohks
6a4aa4515e Update release notes for Media3 1.6.0-alpha03 release
#cherrypick

PiperOrigin-RevId: 723512116
2025-02-05 08:03:50 -08:00
michaelkatz
edc44eefd2 Limit dynamic scheduling by the playing period transition point
In the case of replace stream media item transition, it is important that dynamic scheduling does not set the next work task later than the transition boundary.

#cherrypick

PiperOrigin-RevId: 723502204
2025-02-05 07:31:03 -08:00
Googler
85158ec841 Update operating rate adjustment visibility
PiperOrigin-RevId: 723501709
2025-02-05 07:27:57 -08:00
dancho
b90610b95a Force signal encoder end of stream after all output has been processed
Fixes a rare failure on some devices.
Only available when `experimentalSetMaxFramesInEncoder` is enabled.

PiperOrigin-RevId: 723498652
2025-02-05 07:15:23 -08:00
dancho
a80e7be029 MCVR support skipping parts of AV1 input buffers
AV1 input buffers contain multiple compressed pictures.
Enable skipping only the last showable frame, while leaving
any reference pictures to be decoded later, as part of
the next decoder input buffer.

Partial skipping of AV1 input buffer is only applied when:
* fewer than 8 OBUs are delayed
* there's likely to be enough capacity in the decoder input buffer
  for the next frame

PiperOrigin-RevId: 723496060
2025-02-05 07:09:20 -08:00
rohks
4f3ed2490a Rollback of 99f2a9f152
PiperOrigin-RevId: 723496012
2025-02-05 07:06:09 -08:00
dancho
2fe92bfca5 Use the AV1 sample dependency parser in MCVR
Parsing AV1 bitstreams allows us to identify frames that are
not used as reference, and improve seeking or frame dropping
behavior.

The AV1 bitstream format is relatively quick to parse

PiperOrigin-RevId: 723462680
2025-02-05 04:51:02 -08:00
shahddaghash
bcce7b5949 Pass the dataType to MediaItemInfo for Transformer
From the `sampleMimeType`, we can know whether the media item contains video data, image data, and audio data. This is done for input media items, and the output media item.

PiperOrigin-RevId: 723459732
2025-02-05 04:38:06 -08:00
michaelkatz
449b81d510 Fix ordering of MediaCodecRenderer.getDurationToProgressUs parameters
Parameter list should match the base Renderer.getDurationToProgressUs more closely.

#cherrypick

PiperOrigin-RevId: 723449756
2025-02-05 04:03:33 -08:00
kimvde
92a06606b4 Remove ability to run the DefaultVideoCompositor on its own GL thread.
- It's never used and handling multi-threading is costly.
- If the VideoCompositor and the VideoFrameProcessors use separate
threads and the same GlObjectsProvider, the GlObjectsProvider is
accessed from multiple threads. This class doesn't seem designed for
multi-threading.

PiperOrigin-RevId: 723448013
2025-02-05 03:55:42 -08:00
michaelkatz
4c163553e7 Remove pending adLoad timeout tasks when resuming content
When a timeline change occurs, the `AdTagLoader` will post an adLoad timeout task if currently waiting for an ad to load. Once sdk calls `loadAd`, any pending timeout tasks are removed. If the timeout occurs, the ad group is canceled and content will resume.

If the SDK proceeded to resume content without calling `loadAd`, then any pending timeout tasks should be removed or else a future ad group may error due to a previous timeout task.

PiperOrigin-RevId: 723442852
2025-02-05 03:31:13 -08:00
michaelkatz
97a1d31b5d Reset prewarming renderers when seek resets prewarming media period
Seeking will reset media periods following the current playing period. This includes resetting any current pre-warming media periods. Therefore while seeking, any current pre-warming should be disabled and reset.

#cherrypick

PiperOrigin-RevId: 723439145
2025-02-05 03:14:38 -08:00
dancho
f8f66bdfaa Mp4Muxer: disable sample batching and copying by default.
When sample batching is disabled, copying of the ByteBuffer data
is not necessary as samples are written as they arrive.
Copying of the BufferInfo is necessary because the info is needed
for writing the moov atom.

The input ByteBuffer can be in little endian order, or have its
position set. AnnexBUtils now ensures big endian order before
inspecting bytes, and supports reading from a non-zero position.

This change reduces the amount of memory allocations by Mp4Muxer
in its default configuration

PiperOrigin-RevId: 723401822
2025-02-05 01:05:22 -08:00
shahddaghash
05e66d9cf6 Fix metrics codec names collection
Previously, the codec names for the input were collected from `Format.codecs` which return the RFC 6381 string not the codec name used. This was changed to retain the decoder name from `ProcessedInput` instead.

PiperOrigin-RevId: 723129667
2025-02-04 10:05:37 -08:00
Copybara-Service
a19f68c87e Merge pull request #2107 from MGaetan89:issue_384699964
PiperOrigin-RevId: 723124733
2025-02-04 09:53:43 -08:00
sheenachhabra
ae3f962769 Extract "is last item in sequence" check
This improves readability.

PiperOrigin-RevId: 723116229
2025-02-04 09:27:48 -08:00
Gaëtan Muller
a4cc0f2384
Replace Util.MODEL with Build.MODEL 2025-02-04 15:34:33 +01:00
Gaëtan Muller
2aab921aa2
Replace Util.MANUFACTURER with Build.MANUFACTURER 2025-02-04 15:04:08 +01:00
Gaëtan Muller
d0a3d31e56
Replace Util.DEVICE with Build.DEVICE 2025-02-04 15:00:22 +01:00
tianyifeng
3e56d2a6fb Add ProgressiveMediaSource.Listener interface and onSeekMap event
This will allow the listeners who are interested in the `SeekMap` to get informed once the period has done the preparation.

PiperOrigin-RevId: 723027718
2025-02-04 04:30:29 -08:00
michaelkatz
decfb9b0a9 Refactor MediaCodecVideoRenderer to use a Builder
MediaCodecVideoRenderer is becoming unwieldy with the numerous constructors and optional settings. This refactors MediaCodecVideoRenderer to use a builder pattern for simplicity.

PiperOrigin-RevId: 723022129
2025-02-04 04:08:56 -08:00
shahddaghash
1431497e7f Pass output media item information to MediaItemInfo
PiperOrigin-RevId: 723007882
2025-02-04 03:10:24 -08:00
Googler
6e9a2cc0cd Rollback of 79b61d05a6
PiperOrigin-RevId: 722741988
2025-02-03 11:55:06 -08:00
Googler
aaa7e9e3cb Open visibility to HttpDataSourceTestEnv constants
PiperOrigin-RevId: 722712331
2025-02-03 10:37:43 -08:00