22230 Commits

Author SHA1 Message Date
sheenachhabra
86df7572d2 Create a private util method to create blank frame bitmap
This method will be reused when inserting gaps in
`GapSignalingAssetLoader` in upcoming CL.

PiperOrigin-RevId: 732896566
2025-03-03 06:14:06 -08:00
kimvde
1361d569cd Remove method VideoFrameReleaseControl.onDisabled
This method didn't have any effect because onEnabled, which also sets
the firstFrameState, should always be the next method being called.

PiperOrigin-RevId: 732846722
2025-03-03 02:41:46 -08:00
Googler
8ea49025aa FragmentedMp4Muxer: Update FragmentedMp4MuxerEndToEndTest
Update Test to test all supported mimeTypes in `FragmentedMp4Muxer`.

PiperOrigin-RevId: 732187238
2025-02-28 10:43:50 -08:00
tonihei
796df136d7 Update CapturingAudioSink to dump after audio processors
This ensures data modifications like channel mapping or
bitrate changes are correctly captured in the dump files.

PiperOrigin-RevId: 732129701
2025-02-28 07:21:54 -08:00
tonihei
2088697a19 Add util to obtain AudioManager
AudioManager internally assumes the thread is was created on can be
used as a callback thread. Since the AudioManager is only created
once in the lifetime of an app, we need to make sure its obtained
on a thread that stays alive.

#cherrypick

PiperOrigin-RevId: 732072255
2025-02-28 03:23:10 -08:00
rohks
5f1af46f56 Add contract test for getMetrics() to MediaExtractorContractTest
PiperOrigin-RevId: 732069514
2025-02-28 03:10:01 -08:00
ibaker
f8c3af52e9 Disable subtitlesRespectClipping_multiplePeriods test on API 21
PiperOrigin-RevId: 732065230
2025-02-28 02:54:45 -08:00
jbibik
66ef013cb8 [ui-compose] Better KDoc formatting
#cherrypick

PiperOrigin-RevId: 731712846
2025-02-27 07:07:54 -08:00
tonihei
1ac82d9824 Do not assume default callback for Audio focus requests is main looper
On API < 26, the callback thread couldn't be set and the current compat
code assumes it's always the main thread. This isn't true, however,
because AudioManager uses the thread on which it was first instantiated
anywhere in the app.

#cherrypick

PiperOrigin-RevId: 731696188
2025-02-27 06:03:25 -08:00
jbibik
b465cbc22c [ui-compose] Add KDoc to observe() methods for button states
#cherrypick

PiperOrigin-RevId: 731686021
2025-02-27 05:21:21 -08:00
Copybara-Service
c1a269b79f Merge pull request #2114 from MGaetan89:remove_player_deprecated_next_methods
PiperOrigin-RevId: 731651706
2025-02-27 03:00:46 -08:00
tonihei
a3c9060daa Work around SurfaceView creation issues on API<26 for tests
PiperOrigin-RevId: 731643287
2025-02-27 02:26:47 -08:00
jbibik
addf01b9a8 [ui-compose] Add PlaybackSpeedState to control playbackParameters.speed
A state holder that handles interaction with a UI component that toggles through a range of playback speeds.

[demo-compose] Use PlaybackSpeedState to create PlaybackSpeedTextButton

Add the button to the bottom extra controls.

PiperOrigin-RevId: 731449526
2025-02-26 14:09:12 -08:00
Copybara-Service
366e5eccf8 Merge pull request #2190 from nift4:main
PiperOrigin-RevId: 731316955
2025-02-26 07:57:38 -08:00
ibaker
ca80c001e2 Suppress UnnecessarilyFullyQualified lint in DefaultRenderersFactory
Also only fully-qualify the media3 types, since these are the ones that
are at risk of moving - I don't think `android.os.Handler` is going
anywhere, and doesn't need to be proguard-kept anyway.

PiperOrigin-RevId: 731315177
2025-02-26 07:50:18 -08:00
tianyifeng
e4369b2317 Allow setting time range for adaptive media in DownloadRequest
PiperOrigin-RevId: 731314103
2025-02-26 07:45:55 -08:00
ibaker
275e7d3dbd Rewrite ClearKey UUID to Common PSSH UUID in PSSH box on API < 27
Without this change, content that contains a PSSH box with only
the ClearKey UUID is not playable on devices with API < 27.

This includes our `sample_fragmented_clearkey.mp4` test content.

PiperOrigin-RevId: 731308444
2025-02-26 07:24:34 -08:00
simakova
5417279982 Add missing links to the effect demo README
PiperOrigin-RevId: 731305090
2025-02-26 07:12:40 -08:00
claincly
e3e9d88b04 Rename listener in FinalShaderProgramWrapper
This is to support adding more listener methods later for dynamic effect change

PiperOrigin-RevId: 731297518
2025-02-26 06:47:31 -08:00
ibaker
37aaef0b32 Upgrade to Gradle 8.10.2 and AGP 8.8.1
This resolves the jacoco log spam when running Robolectric tests on
JDK 21, and therefore unblocks bumping our Java language level to 21.

PiperOrigin-RevId: 731297393
2025-02-26 06:45:57 -08:00
nift4
b38d3f8f0d Reuse a variable in DefaultAudioSink 2025-02-26 14:44:12 +00:00
jbibik
afea6962c2 [ui-compose] Add default value to PlayerSurface's surfaceType
PlayerView's default surface type was also SURFACE_VIEW.

This allows for a simple `PlayerSurface(player)` usage by most developers.

The order of the arguments needs to be changed, because `modifier` should be the first default argument (https://android.googlesource.com/platform/frameworks/support/+/androidx-main/compose/docs/compose-component-api-guidelines.md#parameter)

PiperOrigin-RevId: 731294658
2025-02-26 06:36:04 -08:00
Copybara-Service
ac1cf206c8 Merge pull request #2180 from nift4:main
PiperOrigin-RevId: 731276598
2025-02-26 05:27:44 -08:00
sheenachhabra
d16fdcb8cc Reset maxTrackDurationUs when a new fragment is written
When there is both audio and video track, then fragment
creation is driven by video track (a combination of duration
so far + next key frame). But if there is no video track, then
the duration so far drives the fragment creation.

Due to bug, when there is only audio track, only first
fragment was created as expected and then a new fragment is
created for every audio sample.

#cherrypick

PiperOrigin-RevId: 731257696
2025-02-26 04:18:49 -08:00
ibaker
20ea05063b Suppress some instrumentation tests on older API levels
PiperOrigin-RevId: 731257575
2025-02-26 04:16:48 -08:00
claincly
5d9c2e309e Add APIs for redrawing effects.
PiperOrigin-RevId: 731255074
2025-02-26 04:08:32 -08:00
ibaker
a6debf4904 Rollback of 3b38a7a43b
PiperOrigin-RevId: 731248658
2025-02-26 03:44:47 -08:00
tonihei
4f039eaafa Add ClippingConfiguration.allowUnseekableMedia
PiperOrigin-RevId: 731240278
2025-02-26 03:11:19 -08:00
tonihei
676fe86028 Add DefaultPreloadManagerBinderStressTest
Based on the idea for the ExoPlayer stress tests, we can set up more
stress tests for other components that verify
the components do not use system binder calls on the main thread.

PiperOrigin-RevId: 730964902
2025-02-25 11:32:51 -08:00
tonihei
8937fb1df7 Add binder stress test for ExoPlayer setup
The test compares creating and interacting with the player
with and without additional binder stress on the system process.

If the ExoPlayer interactions do not use binder calls, the overall
runtime should be within the same range (allowing for some additional
leeway due to the generally increased CPU usage).

Verified the test passes 20/20 without flakes and fails 19/20 even
with a single binder call.

PiperOrigin-RevId: 730963633
2025-02-25 11:28:37 -08:00
tonihei
19c7b21275 Move audio focus management to ExoPlayerImplInternal
This ensures all AudioManager calls are moved off the main
thread.

Having the audio focus management on the playback thread
also allows future improvements like requesting audio focus
only just before the player becomes ready (which is recommended
but not currently done by ExoPlayer).

PiperOrigin-RevId: 730962299
2025-02-25 11:25:25 -08:00
Copybara-Service
2c866ce50b Merge pull request #2113 from colinkho:lastrebufferinssp
PiperOrigin-RevId: 730919539
2025-02-25 09:38:40 -08:00
ibaker
6ffa0854d5 Define how PBA.peekChar behaves for UTF-8 multi-byte characters
PiperOrigin-RevId: 730908033
2025-02-25 09:04:37 -08:00
bachinger
cecee3bdda Add explicit property windowStartTimeUs to TimelineWindowDefinition
Before this change constructors of `TimelineWindowDefinition` used
`windowOffsetInFirstPeriodUs` for both, `positionInFirstPeriodUs`
and `startTimeUs` of the exposed `Timeline.Window`.

Adding `windowStartTimeUs` differentiates these two properties which
allows using `FakeTimeline` for unit tests that emulate live streams
with a forward moving live window in the period like `HlsMediaSource`
constructs a `SinglePeriodTimeline` for live.

A `TimelineWindowDefinition.Builder` is added for API usability and
sanitation.

PiperOrigin-RevId: 730892809
2025-02-25 08:17:24 -08:00
Copybara-Service
57d4f8354a Merge pull request #2135 from bubenheimer:handleMoveMediaItems_docfix
PiperOrigin-RevId: 730886871
2025-02-25 08:00:35 -08:00
ibaker
c4eef6042b Bump play-services-cast-framework cast dependency to 21.5.0
This resolves an app crash on devices with Google Play Services
installed but disabled due to `FLAG_MUTABLE` on a `PendingIntent`.

Issue: androidx/media#2178

#cherrypick

PiperOrigin-RevId: 730885329
2025-02-25 07:54:54 -08:00
ibaker
ecb83f3b73 Add missing call to adjustUuid in FrameworkMediaDrm
Before API 27, the platform DRM components incorrectly expected
`C.COMMON_PSSH_UUID` instead of `C.CLEARKEY_UUID` in order to perform
ClearKey decryption. `FrameworkMediaDrm` is responsible for doing this
adjustment on these API levels, but this call was missed when
refactoring some DRM code in
c872af4bc0.

This led to `MediaCodec$CryptoException: Operation not supported in this
configuration` errors when doing ClearKey playback on devices with
API < 27. This was because the earlier, clearer error from the
`MediaCrypto` constructor was being swallowed and transformed to
`requiresSecureDecoder = true` by the `catch` logic in
`FrameworkMediaDrm.requiresSecureDecoder`.

This change also makes the error handling in
`FrameworkMediaDrm.requiresSecureDecoder` more robust by assuming
`requiresSecure = false` for ClearKey (and true for all other DRM
schemes), since we know that ClearKey never supports secure decoding.
This will help avoid more ClearKey playback failures if we see other,
unrelated, errors at this point.

Issue: androidx/media#1732

#cherrypick

PiperOrigin-RevId: 730882278
2025-02-25 07:42:52 -08:00
tianyifeng
d58740367b Add an option in DownloadHelper to log debug information
Add a debugLoggingEnabled parameter in DownloadHelper constructor and forMediaItem overloads. For backward compatibility, this is disabled by default. Currently the debug logging is for track selection results only.

PiperOrigin-RevId: 730881600
2025-02-25 07:41:10 -08:00
tonihei
a3f281dff8 Add kotlin-stdlib to aar workaround list
#cherrypick

PiperOrigin-RevId: 730880594
2025-02-25 07:38:02 -08:00
dancho
da402cfd64 Add experimentalSetCodecsToParseWithinGopSampleDependencies to HLS
HLS extractors were missing
experimentalSetCodecsToParseWithinGopSampleDependencies prior to this patch.

PiperOrigin-RevId: 730878460
2025-02-25 07:31:30 -08:00
ivanbuper
1399e77249 Add createShortBuffer() to TestUtil
PiperOrigin-RevId: 730875642
2025-02-25 07:20:13 -08:00
Ian Baker
51eb4d6504 Keep the old MidiRenderer constructor deprecated for now 2025-02-25 14:34:15 +00:00
Copybara-Service
cc44de8757 Merge pull request #2115 from MGaetan89:use_objects_equals
PiperOrigin-RevId: 730860597
2025-02-25 06:30:48 -08:00
Ian Baker
4f08312ea5 Add release note 2025-02-25 14:24:19 +00:00
Ian Baker
c950f1c5e3 Format with google-java-format 2025-02-25 14:22:52 +00:00
nift4
5b97ad71f4 Make MIDI renderer respect custom audio sink 2025-02-25 14:22:52 +00:00
Googler
3b38a7a43b Add CookieHandler support to HttpEngineDataSource.
The original behaviour of the `handleSetCookieRequests` is preserved.
A bug is addressed, where it woulld set `Set-Cookie` header in the client request (as opposed to the expected `Cookies`).

PiperOrigin-RevId: 730857996
2025-02-25 06:19:20 -08:00
Copybara-Service
85467b9b57 Merge pull request #2145 from v-novaltd:dsparano-exo328
PiperOrigin-RevId: 730853667
2025-02-25 06:05:18 -08:00
tonihei
94e8a64938 Add more dump file changes 2025-02-25 12:50:20 +00:00
sheenachhabra
bdbcdf1660 Implement blank frame insertion when video track goes missing
If an sequence has both audio and video tracks running but then
the next media item has only audio, then insert blank frames to
continue video track.

PiperOrigin-RevId: 730828269
2025-02-25 04:34:17 -08:00