22394 Commits

Author SHA1 Message Date
ybai001
2500d91848 Add KEY_PROFILE, KEY_LEVEL support for AC-4 2025-04-10 09:39:23 +08:00
ybai001
28feb7bab5
Merge pull request #17 from androidx/main
Merge from androidx/main
2025-04-02 11:31:17 +08:00
sheenachhabra
cf3faf9cff Validate gap at start when building sequence
PiperOrigin-RevId: 742710209
2025-04-01 08:31:37 -07:00
kimvde
812e078310 Make sure ExoPlayerAssetLoader's progress is not more than 100
PiperOrigin-RevId: 742710076
2025-04-01 08:29:44 -07:00
bachinger
3fddf4376c Resolve asset list and populate ad playback state
PiperOrigin-RevId: 742705857
2025-04-01 08:17:43 -07:00
tianyifeng
ce3754a740 Add PlaybackParameters.withPitch() method
Issue: androidx/media#2257
PiperOrigin-RevId: 742693410
2025-04-01 07:42:27 -07:00
sheenachhabra
209ecce6b3 Change getVideoTrackOutput() to getTrackOutput()
The updated method can be used for audio as well.

PiperOrigin-RevId: 742673561
2025-04-01 06:36:03 -07:00
bachinger
c95544156d Clip live periods that get a duration and end position
When an ad is inserted into a live period with an unset
duration, the live period needs to be wrapped with a
`ClippingMediaPeriod` and then actually be clipped to
the end position when the duration gets known. Without
this the renderers will never see an EOS which prevents
the reading/playing period from advancing.

In the case of a server side inserted ad on the other
hand, the actual clipping needs to be prevented to
keep the current behavior for SSAI streams. In an SSAI
stream, an ad inserted before the current position should
not produce a snap back to the newly inserted ad. This is
currently prevented in both places, when the updated
timeline is handled to not disable the renderers, and when
the `mediaPeriodQueue` updates the queued periods. This
behaviour is preserved to not create side effects of this
change.

PiperOrigin-RevId: 742642715
2025-04-01 04:46:31 -07:00
kimvde
f2d644b7b4 PlaybackVideoGraphWrapper: update listener logic for multi sequence
- Only have the primary sequence renderers listen to
PlaybackVideoGraphWrapper events. These events only need to be
forwarded to a single ExoPlayer instance.
- Set the DefaultVideoSinkListener only once.

PiperOrigin-RevId: 742636455
2025-04-01 04:18:39 -07:00
kimvde
595b75b7d3 Deduplicate some of the calls to DefaultVideoSink methods
Some DefaultVideoSink methods are called once per sequence, but this
doesn't make sense as the DefaultVideoSink is connected to the
VideoGraph output. This CL calls the DefaultVideoSink method only for
the primary sequence.

The other problematic DefaultVideoSink method calls will be moved in
follow-up CLs.

This is part of the effort to prepare PlaybackVideoGraphWrapper for
multi-sequence.

PiperOrigin-RevId: 742625589
2025-04-01 03:42:22 -07:00
sheenachhabra
2141d9ef9c Make forceAudioTrack flag mandatory when gap is at start
Earlier when gap is at the start of a sequence
it was automatically filled with silent audio.
Now setting forceAudioTrack flag is mandatory to
indicate that the gap at the start of a sequence
must be filled with silent audio.

PiperOrigin-RevId: 742625236
2025-04-01 03:40:41 -07:00
ibaker
3ab484d93f Stabilize various setUserAgent() and Util.getUserAgent() methods
Issue: androidx/media#2286
PiperOrigin-RevId: 742367539
2025-03-31 13:05:42 -07:00
sheenachhabra
8508e12001 Rename TransformerVideoGapsTest to TransformerGapsTest
This will allow keeping both audio and video gap test
in the same class.

PiperOrigin-RevId: 742291252
2025-03-31 09:27:57 -07:00
kimvde
f8b1dcc33b Move VideoSink config to dedicated method
This is  to improve readability of MediaCodecVideoRenderer.onEnabled

PiperOrigin-RevId: 742246092
2025-03-31 06:40:12 -07:00
sheenachhabra
25c1760b17 Add VIDEO_APV mimetype to FrameworkMuxer supported types
Came up in github issue https://github.com/androidx/media/issues/2275.

PiperOrigin-RevId: 742233737
2025-03-31 05:44:06 -07:00
claincly
9254efd8da Add pixel test for replaying
I could've add another test that seeks into the media before replying, but I
don't think fundamentally it's different from the one added.

I wish I could add one that replays while playing, but it'd be hard to match
the frames perfectly.

I'll add more timestamp based tests

PiperOrigin-RevId: 742229436
2025-03-31 05:22:31 -07:00
claincly
ff6537d69b Fix a bug that video effects are added twice
The tests passed because of an issue in chaining. The chaining listener allows
self-looping, i.e. the producer and the consumer of a frame could be the same
instance. Like an effect chain of `a -> a -> b` This didn't fail any test
before, because the chaining is rectified when connecting a to b, but it should
have failed when connecting a to a.

PiperOrigin-RevId: 742215700
2025-03-31 04:22:18 -07:00
dancho
73fa820828 Skip decoder input buffers for encrypted content
Previous assertion was incorrect. Per-frame initialization
vectors are written to the output stream in
`FragmentedMp4Extractor`

PiperOrigin-RevId: 742203717
2025-03-31 03:34:09 -07:00
kimvde
427daef350 Remove VideoSink.setWakeUpListener
This is the last Renderer reference in VideoSink

PiperOrigin-RevId: 742189332
2025-03-31 02:26:56 -07:00
tianyifeng
72f5df582a Improve the precision of percentDownloaded in Downloaders
We don't require high precision in the calculation of `percentDownloaded` for `Downloader.ProgressListener.onProgress` though, when `byteCached == contentLength`, we hope the `percentDownloaded` to be `100f` (rather than `99.99999f`). The result of `byteCached * 100f` can be less precise as the floating-point numbers are sparser when the value is far from zero. For example, if `byteCached == 812345L`, then the `byteCached * 100f` will become `81234496` (value checked by `BigDecimal`).

PiperOrigin-RevId: 741895445
2025-03-29 16:47:31 -07:00
sheenachhabra
c858abda5d Remove usage of Composition.Builder#experimentalSetForceAudioTrack
This CL removes all usages within media3.

PiperOrigin-RevId: 741469343
2025-03-28 03:51:27 -07:00
michaelkatz
a4f5f67d7e Fix media period mismatch during recoverable renderer error processing
If a recoverable renderer error occurred just before playing period transition(aka media item transition) then the player may enter a continuous loop of retrying to play the previous media item.

This was most easily reproduced in an audio offload scenario where init in offload mode always fails. In initializing the following media, the process would fail with recoverable error to try in non-offload mode. The player would try to recover with playing the previous media item. Most times it would skip to the next track but not always.

Issue: androidx/media#2229
PiperOrigin-RevId: 741213293
2025-03-27 11:03:49 -07:00
tonihei
f74abed984 Add missing 1.6.0 entry to GH bug template
PiperOrigin-RevId: 741120336
2025-03-27 05:48:34 -07:00
Copybara-Service
f2fa0f7b2a Merge pull request #2253 from nirb999:main
PiperOrigin-RevId: 741092998
2025-03-27 03:50:08 -07:00
Googler
10fd1ee270 Minor cleanup to separate content progress provider interface
PiperOrigin-RevId: 740901722
2025-03-26 14:23:11 -07:00
sheenachhabra
87e0d7b95a Add setForceAudioTrack method on EditedMediaItemSequence
PiperOrigin-RevId: 740808813
2025-03-26 10:04:14 -07:00
ibaker
0d60c5bf25 MP4: Parse alternate_group and expose it in Format.metadata
Issue: androidx/media#2242
PiperOrigin-RevId: 740794206
2025-03-26 09:21:21 -07:00
ibaker
96bb777484 Add VideoFrameMetadataListener calls to FakeVideoRenderer
This change also tightens `FakeVideoRenderer` to only 'handle' buffers
that are close to the current playback position.

This condition controls whether the renderer fires `onVideoSizeChanged`
and `onRenderedFirstFrame`, both of which should only be fired once the
frame has been 'released' to the screen, which in a real renderer
happens much closer to 'current position' than the existing 250ms of
`FakeRenderer.SOURCE_READAHEAD_US`.

A later change uses `VideoFrameMetadataListener` to test ExoPlayer
behaviour in scrubbing mode.

PiperOrigin-RevId: 740763283
2025-03-26 07:44:38 -07:00
Rohit Singh
916ffcfe5f Add RELEASENOTES entry 2025-03-26 14:12:55 +00:00
Copybara-Service
95fbecd076 Merge pull request #2260 from MGaetan89:audiomanagercompat_log
PiperOrigin-RevId: 740752418
2025-03-26 07:06:39 -07:00
Rohit Singh
5594dddc99 Fix not sent for manifest requests in HLS and SS 2025-03-26 14:04:08 +00:00
kimvde
12b4c7d780 Remove unused param from VideoSink
PiperOrigin-RevId: 740739740
2025-03-26 06:15:03 -07:00
Googler
a24d1d41d9 BoxParser: Update Dolby Vision codec support.
1. Append initialization data of Dolby Vision codec to list of initialization data.
2. Parse `dwcC` box in BoxParser.

PiperOrigin-RevId: 740737770
2025-03-26 06:07:33 -07:00
kimvde
3d5e650980 Improvements to VideoSink.Listener
- Remove unused VideoSink parameter
- Make methods default so that implementations don't have to override
them all

PiperOrigin-RevId: 740715000
2025-03-26 04:28:07 -07:00
Gaëtan Muller
14b4a9ff32 Use the existing TAG constant in AudioManagerCompat
This also addresses the `Private field 'TAG' is never used` warning.
2025-03-26 11:13:33 +00:00
kimvde
d4ea3ad932 PlaybackVideoGraphWrapper: fix inputType discrepancy
PiperOrigin-RevId: 740699944
2025-03-26 03:29:43 -07:00
Googler
598ec00c5d DolbyVisionConfig: Move file to the container library.
For usage of instance of `DolbyVisionConfig` used in Muxer to support Dolby Vision codec, move `DolbyVisionConfig` file from extractor library to container library.

PiperOrigin-RevId: 740689000
2025-03-26 02:43:37 -07:00
kimvde
6cd15fb4b0 Remove PlaybackVideoGraphWrapper param from its listener methods
It's unclear why the listeners would need access to the
PlaybackVideoGraphWrapper as there should always be only one. Also,
it's not common practice to pass the parent object to the listener in
media3 (see Player.Listener for example).

PiperOrigin-RevId: 740686007
2025-03-26 02:32:51 -07:00
kimvde
0ad7ceadb3 Remove references to Renderers from VideoSink
Remaining references will be removed in follow-up changes

PiperOrigin-RevId: 740362812
2025-03-25 08:43:44 -07:00
ibaker
4338355422 Use dumper.addIfNonDefault in CapturingAudioSink
If encoded audio is dumped, some of these values may not be set.

Also add a related TODO

PiperOrigin-RevId: 740357230
2025-03-25 08:24:44 -07:00
michaelkatz
6e510c26df Set that any error during pre-warming disables and resets pre-warming
For now, even if a recoverable error occurs during pre-warming, the current process will be that pre-warming is disabled until subsequent media item transition.

PiperOrigin-RevId: 740349517
2025-03-25 08:02:42 -07:00
kimvde
2642d895bd Remove VideoSink.onRendererEnabled
This is part of the effort to make VideoSink independent from renderers.

PiperOrigin-RevId: 740344126
2025-03-25 07:44:50 -07:00
michaelkatz
a220b0cb5e Add support for RTSPT scheme in RtspMediaSource.Factory
If the `RtspMediaSource.Factory` is provided a `MediaItem` containing a uri with the scheme `rtspt`, then the factory will create its `RtspMediaSource` configured to use TCP.

Issue: androidx/media#1484
PiperOrigin-RevId: 740340604
2025-03-25 07:32:58 -07:00
ibaker
0cba160c22 Add non-raw MIME type to audio sink dumps
We currently don't have audio sink dumps for non raw audio, but this
change will make it more clear if we do in future (e.g. for testing
audio offload).

PiperOrigin-RevId: 740330118
2025-03-25 06:52:32 -07:00
Googler
6034a3c3d6 Tone map in CompositionPlayer if surface can't display HDR
PiperOrigin-RevId: 740290183
2025-03-25 04:17:50 -07:00
tianyifeng
a1738f96f9 Add a Factory for DownloadHelper and deprecate forMediaItem() methods
PiperOrigin-RevId: 739909021
2025-03-24 06:03:24 -07:00
Googler
ae563dbab0 Update Lanczos Effect to support different orientations
PiperOrigin-RevId: 739884019
2025-03-24 04:08:04 -07:00
ibaker
75a067a223 Add unsuitable audio output to to-string logic in EventLogger
PiperOrigin-RevId: 739875995
2025-03-24 03:35:09 -07:00
shahddaghash
d5dcbf4a12 Extract CodecInfo from CodecImpl and expose default CodecInfo configs
This is a step towards unifying ShadowMediaCodecConfig structure to accommodate both ExoPlayer and Transcoding codecs configuration.

This change abstracts the codec information to a separate `CodecInfo` class. This allows having codecs with the same information configured with different configurations (passthrough/frame-dropping, decoder/encoder). It also does the following:
* Replaces the map of default codecs with public static final CodecInfo constants for each codec.
* Modifies the ShadowMediaCodecConfig constructor to accept a set of CodecImpls instead of mime types.
* Updates factory methods to reflect the constructor change.
* Updates addSupportedMimeTypes to addDecoder, taking a CodecInfo instead of a mimeType.

This is a non-functional change.

PiperOrigin-RevId: 739857883
2025-03-24 02:17:06 -07:00
tonihei
a472300c7a Use getAchievableFrameRatesFor to find approximate SW codec limits
We currently assume SW codecs are capable of playing all resolutions
and frame rates up to their declared supported maximum values, even
though the are likely not able to keep up playback smoothly for higher
resolutions. For HW codecs we can check PerformancePoints to declare
them as EXCEEDS_CAPABILITIES if they technically support a format but
are not performant enough. We can do the same for SW codecs by
checking getAchievableFrameRatesFor.

PiperOrigin-RevId: 739253653
2025-03-21 11:57:55 -07:00