22114 Commits

Author SHA1 Message Date
bachinger
bb358241b9 Make setSessionActivity accept null
Issue: androidx/media#2109
PiperOrigin-RevId: 728160580
(cherry picked from commit 2b8700beaaabd51365daf9099c42bfa64a2dd4fe)
1.6.0-beta01
2025-02-18 14:11:51 +00:00
tonihei
bc872503b9 Ignore .kotlin directory
#cherrypick

PiperOrigin-RevId: 728119609
(cherry picked from commit 0a50741abec718c09e52c5f00cc241a00eeba23d)
2025-02-18 14:09:17 +00:00
tonihei
b49374c8fe Remove unreleased section from RELEASENOTES 2025-02-18 09:51:26 +00:00
tonihei
3f10fa92bb Version bump for Media3 1.6.0-beta01
#cherrypick

PiperOrigin-RevId: 727889651
(cherry picked from commit 78cf53c0b2f604b4d04ab749250f4e4fe88e240f)
2025-02-18 09:42:24 +00:00
Googler
625ff234e4 Update CSD and apvC box logic
Update the CSD to contain only the APVDecoderConfigurationRecord and the apvC box to be a full box. The apv clip is also updated to be consistent with the new [specification](https://github.com/AcademySoftwareFoundation/openapv/blob/main/readme/apv_isobmff.md#isobmff-binding-for-apv).

The clip is provided by the openAPV team under BSD-3 license.

PiperOrigin-RevId: 727868656
(cherry picked from commit 653470f73be98e01e972513ec80e58c2d36cbb3a)
2025-02-18 09:42:24 +00:00
tonihei
88e7636ae0 Use different authorities for AssetContentProvider
Otherwise it's impossible to install the androidTest apk
of both lib-datasource and lib-exoplayer on the same device

#cherrypick

PiperOrigin-RevId: 727867871
(cherry picked from commit 527e1d52aedbff53e3ba670d2b6a3cf0b0a84abb)
2025-02-18 09:42:24 +00:00
tonihei
57bbb6c5c6 Update release notes for 1.6.0-beta01
#cherrypick

PiperOrigin-RevId: 727862233
(cherry picked from commit 18f38647732c7fbbafce30d99ab8062da6be2aff)
2025-02-18 09:42:23 +00:00
kimvde
9ad06570b5 Transformer: fix gradle dependency type
PiperOrigin-RevId: 727760498
(cherry picked from commit c1eb381948d5e936bdc9cfb37ca529b816bfcc1b)
2025-02-18 09:42:23 +00:00
tonihei
7db4802f02 Update ignore files for most recent FLAC extension code
Following the README, a libflac directory is created, which
needs to be ignored in VCSs

#cherrypick

PiperOrigin-RevId: 727103140
(cherry picked from commit b306b1059772c2e279020f65ac60ae975fca3fbf)
2025-02-18 09:42:23 +00:00
tonihei
1ceafc7a61 Add timeout to foreground service handling
Currently, as soon as the playback is considered disengaged (not
ready and playing), the foreground service is stopped.
This causes problems if the app or the user attempts to restart
playback after a short amount of time, where apps may run into
foreground service start restrictions.

Almost all of these short-term interaction issues can be solved
by keeping the foreground service running for an additional
timeout period, which is chosen to be 10 minutes to match the
behavior of future Android system enforcements. For any longer
term interactions, apps need to implement playback resumption
paths that can restart the service with the previous playback.

One caveat is that we currently use player.pause() as a way to
stop the foreground service in onTaskRemoved() if the app wants
to abandon playback at this point. With the timeout, the service
can no longer be stopped immediately just by calling pause(),
so we need to explicitly disable the timeout in the corresponding
helper method.

Issue: androidx/media#1928
Issue: androidx/media#111
PiperOrigin-RevId: 726942625
(cherry picked from commit 8a888d0d1801ce018b5bca5dbab78be44507286e)
2025-02-14 18:41:15 +00:00
tonihei
3b897241d2 Increase timeout for AudioPositionAdvancingTest
500ms may not be enough to start playback on a slow device

#cherrypick

PiperOrigin-RevId: 726940099
(cherry picked from commit 792a2ae05dbade27d9cd5a8923a1f3cebf083a91)
2025-02-14 18:41:15 +00:00
tonihei
2a3e733161 Post initial media button preferences update
Controller and browsers are typically obtained with
Futures.addCallback(future, getMainExecutor()), which triggers
the onSuccess callback with a message post. We currently send
the initial media button preferences inline, causing the callback
in MediaController.Listener.onMediaButtonPreferencesChanged to
arrive before the FutureCallback.onSuccess callback.

In the test controller app, which causes crashed when
connecting to existing sessions for example. We can make this
more robust by also posting the initial update of the media button
preferences.

PiperOrigin-RevId: 726923498
(cherry picked from commit d5df227b3ae4d87ec4876cc19ecca814c91c5fd7)
2025-02-14 18:41:15 +00:00
tonihei
22e5f25648 Refine logic to set and interpret ACTION_PAUSE/ACTION_PLAY
We currently set both actions depending on the playWhenReady state
and we require both actions when converting a platform session to
a Media3 session (if ACTION_PLAY_PAUSE isn't set anyway).

This causes problems in two situations:
 - A controller using the platform ACTION_PAUSE/ACTION_PLAY to
   determine which button to show in a UI. This needs to be aligned
   to the existing Util.shouldShowPlayButton we already use when
   setting the PlaybackStateCompat state.
 - A session only setting either ACTION_PAUSE or ACTION_PLAY
   depending on its state. We should check if the action triggered
   by setPlayWhenReady(...) is possible and allow COMMAND_PLAY_PAUSE
   accordingly.

PiperOrigin-RevId: 726916720
(cherry picked from commit 28bfb27fb59ceb0cd209ac1eebd803d31f78afa4)
2025-02-14 18:41:15 +00:00
tonihei
71a2b7d72d Refine conversion logic from platform to Media3 state for STATE_ENDED
When converting to platform states, STATE_ENDED is mapped to
STATE_STOPPED, but the reverse mapping always assumes STATE_STOPPED
means STATE_IDLE at the moment. We can use the same logic we already
apply for STATE_PAUSED to figure out if we are ended.

PiperOrigin-RevId: 726902064
(cherry picked from commit 982403a0ccab31de1f293fb0b8591e2132e11dd2)
2025-02-14 18:41:15 +00:00
tonihei
89b5420bc8 Show notification even in STATE_IDLE
Currently the notification disappears immediately when the player
enters an error or stopped state, but still has its media and
could resume on user request.

This can be fixed by only checking the existence of media and not
the state when deciding to show a notification.

PiperOrigin-RevId: 726901050
(cherry picked from commit f0da364d3fdd8574c8506f0682a7d2ecf8135ad8)
2025-02-14 18:41:15 +00:00
rohks
d14807c836 Add contract tests for DRM and logging to MediaExtractorContractTest
Added tests for APIs `getDrmInitData()`, `getPsshInfo()`, `getLogSessionId()` and `setLogSessionId(LogSessionId)`.

The Widevine encrypted sample was created from already existing `sample_fragmented.mp4` using `mp4encrypt`.

PiperOrigin-RevId: 726881977
(cherry picked from commit e9df85b48d5c8c0727146ace4528293e3f6ecfd5)
2025-02-14 18:41:15 +00:00
tonihei
be76766f95 Add dedicated EPII method to set volume
This means the volume is available in the internal player,
which is a preparation step to moving the audio focus
handling to the internal player too.

PiperOrigin-RevId: 726880098
(cherry picked from commit ef9b6d212e74c304730161434200244183ae23e6)
2025-02-14 18:41:15 +00:00
tonihei
8bd1db5f2c Move DefaultSuitableOutputChecker operations to playback thread
PiperOrigin-RevId: 726879236
(cherry picked from commit e0ef6e51829dd1627d952d2677f532230cb2dbc9)
2025-02-14 18:41:15 +00:00
tonihei
41af00f100 Move unsuitable output path logic <API31 into SuitableOutputChecker
This avoids distributing the logic between multiple classes and
keeps ExoPlayerImpl simpler.

PiperOrigin-RevId: 726874038
(cherry picked from commit 1015ef8b565ed04e88a9c596798d294327d05536)
2025-02-14 18:41:15 +00:00
tonihei
841e27ae5c Move MediaMetricsListener creation and reporting off main thread
The creation can be moved to the playback thread (to guarantee it
happens in sync other initialization after playback start) and the
potentially blocking calls to the reporting methods can be moved
to the generic shared BackgroundExecutor (it can't use the playback
thread because it no longer exists when the session is ended after
the player is released).

PiperOrigin-RevId: 726872818
(cherry picked from commit d386e002d2b34817178d088f277ced3bf3943ef2)
2025-02-14 18:41:15 +00:00
tonihei
cd6e61d856 Send renderer settings messages to secondary renderers in ExoPlayer
They are currently only sent to the primary renderer.

PiperOrigin-RevId: 726864595
2025-02-14 04:06:36 -08:00
tonihei
12afdfbaea Improve placeholder value in StreamVolumeManager for muting
The mute value usually changes in line with volume == 0.

Also update the test to provide better coverage of the
immediate and delayed state changes.

PiperOrigin-RevId: 726839927
2025-02-14 02:28:34 -08:00
tonihei
dfd2b75720 Stablize command button icons
These are the preferred replacement for custom icon res ids.

PiperOrigin-RevId: 726821168
2025-02-14 01:24:18 -08:00
tonihei
385498c24e Move audio session id generation to playback thread
PiperOrigin-RevId: 726556015
2025-02-13 10:57:19 -08:00
dancho
22853a5c4c MCVR: fix dropped input buffer count
updateDroppedBufferCountersWithInputBuffers should receive
buffer timestamps before adjusting offset

PiperOrigin-RevId: 726473967
2025-02-13 07:17:41 -08:00
ibaker
12072f7248 Rename TestPlayerRunHelper.run(...) to advance(...)
This avoids a clash with the `run` keyword in Kotlin.

PiperOrigin-RevId: 726461032
2025-02-13 06:37:31 -08:00
andrewlewis
9e22f03718 Add support for screen recording to the Transformer demo
Screen recording continues even if the transformer activity is backgrounded,
to support recording other apps.

PiperOrigin-RevId: 726454538
2025-02-13 06:16:54 -08:00
andrewlewis
04d9a751c6 Add encoder setting to set frame repeat interval
This can be used for screen recording to produce files without large gaps
between frames.

PiperOrigin-RevId: 726451010
2025-02-13 06:05:52 -08:00
kimvde
2a91d47ea9 Add tests for prewarming disabled
PiperOrigin-RevId: 726411904
2025-02-13 03:49:14 -08:00
Googler
f5e583332b Copy the isPlaceholder flag into CurrentMediaItemOnlyTimeline
PiperOrigin-RevId: 726405776
2025-02-13 03:32:08 -08:00
kimvde
cea67e8826 Do not record test skipped for tests skipped on emulator
AndroiTestUtil.recordTestSkipped is useful for MH tests

PiperOrigin-RevId: 726397349
2025-02-13 03:01:18 -08:00
sheenachhabra
56bd32da96 Add Lint.IfChange/ThenChange for muxer codec support logic
Updating the list of supported codec in Mp4Muxer and
FragmenetdMp4Muxer is often missed when a new codec is added
in Boxes.java.

PiperOrigin-RevId: 726397337
2025-02-13 02:59:20 -08:00
dancho
38cfd7dc36 Add dropped input buffers to DebugTextViewHelper
The field is more relevant with the
`experimentalSetLateThresholdToDropDecoderInputUs` API.

PiperOrigin-RevId: 726383978
2025-02-13 02:10:57 -08:00
dancho
b9ef0353cf Reduce memory allocations of AnnexBToAvccConverter
Add a new ByteBufferAllocator interface, with a simple
LinearByteBufferAllocator implementation that supports basic memory
allocations and reuse.

Add an AnnexBToAvccConverter.process override that takes a custom allocator

PiperOrigin-RevId: 726380184
2025-02-13 01:59:02 -08:00
ibaker
ee4f9d9140 Remove media1 dependency from media3-ui lib
Also remove deprecated
`PlayerNotificationManager.setMediaSessionToken(MediaSessionCompat)`
method.

PiperOrigin-RevId: 726159462
2025-02-12 12:46:27 -08:00
ibaker
2155c37b08 Switch most intra-lib deps from implementation to api
In all these cases I found at least one public method that takes or
returns a type from the dependency, or a type that inherits from a type
defined in the dependency.

PiperOrigin-RevId: 726130595
2025-02-12 11:29:50 -08:00
kimvde
6e332e9b91 Do not fail the export in case of ExoPlayer release time out
PiperOrigin-RevId: 725996730
2025-02-12 04:13:27 -08:00
bachinger
813973bb58 Explicitly test custom extra entries for legacy conversions
Issue: androidx/media#2127
PiperOrigin-RevId: 725984132
2025-02-12 03:25:22 -08:00
kimvde
be51913b81 Refactor GlObjectsProvider release logic
When possible, make it the caller's responsibility to release the
GlObjectsProvider. It's good practice that the class creating an object
also releases it. It avoids releasing the same object (here, the
GlObjectsProvider) multiple times, which was causing
DefaultVideoCompositorPixelTest to fail.

PiperOrigin-RevId: 725983417
2025-02-12 03:23:49 -08:00
ibaker
5de3ee86e3 Remove the lib-exoplayer dep from lib-common-ktx
This dependency is not used.

PiperOrigin-RevId: 725983258
2025-02-12 03:21:31 -08:00
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