22134 Commits

Author SHA1 Message Date
Daniele Sparano
dbf864fd69 Handle 4 byte start code prefix, ensure non empty samples, fix timestamp on very last sample on synthesized empty pusi 2025-02-21 11:46:08 +00:00
shahddaghash
23ebea7ab4 Update exporter and muxer name to match expected pattern
If the name does not match patten, it gets skipped when reporting.

PiperOrigin-RevId: 729463344
2025-02-21 03:35:04 -08:00
tonihei
72c85aa483 Ensure DataSource is closed in CacheWriter at non-IOException
We currently only catch IOExceptions to close the opened data source.
This means any other type of exception leaves the data source open,
which can caused SimpleCache to be blocked forever when another
data source tries to access the same cache area (which is still
locked by the open data source).

This problem was the cause for flakiness in DownloadManagerDashTest.

#cherrypick

Issue: google/ExoPlayer#9760
PiperOrigin-RevId: 729441817
2025-02-21 02:11:21 -08:00
tianyifeng
a5ffae17c3 Enable DownloadHelper to create DownloadRequest with byteRange
This change only enable the partial support for progressive stream. For now, creating `DownloadRequest` for partial adaptive media will result in an `IllegalStateException`.

PiperOrigin-RevId: 729100584
2025-02-20 07:15:51 -08:00
tianyifeng
daf8f9ff58 Mask ExoPlayer.isLoading when it transitions to IDLE or ENDED states
In some cases, the ExoPlayer immediately transitions to `STATE_IDLE` or `STATE_ENDED` on application thread, while `isLoading` can still remain as `true` before it is finally updated from playback thread.

Issue: androidx/media#2133

#cherrypick

PiperOrigin-RevId: 728724157
2025-02-19 10:31:43 -08:00
shahddaghash
ae3eed2343 Verify each export had its own session
This is done by getting the session ID for the `EditingSession` and making sure it's unique from the other session ID.

PiperOrigin-RevId: 728680628
2025-02-19 08:18:34 -08:00
sheenachhabra
462533219d Create muxer specific BufferInfo class
Muxer does not use `offset` field, hence not added.

PiperOrigin-RevId: 728625538
2025-02-19 05:11:04 -08:00
Googler
1461e9e93a Update the list of supported video mimetypes.
Add VP9 and APV codecs to the list of supported video mimetypes for Mp4Muxer and Fragmented Mp4Muxer.

PiperOrigin-RevId: 728603222
2025-02-19 03:53:47 -08:00
Googler
525588eec5 Update performance parameter visibility
PiperOrigin-RevId: 728589755
2025-02-19 03:05:40 -08:00
jbibik
4045acd13b Fix Shuffle and Repeat references in tests
PiperOrigin-RevId: 728309204
2025-02-18 12:14:18 -08:00
shahddaghash
90844f11e8 Add test for usePlatformDiagnostics disabled
PiperOrigin-RevId: 728276994
2025-02-18 10:57:48 -08:00
tonihei
f1c62c1239 Make SimpleBasePlayer.State public
This ensures it's easier to handle these State updates in other
helper classes if needed.

Issue: androidx/media#2128

#cherrypick

PiperOrigin-RevId: 728264396
2025-02-18 10:28:05 -08:00
tonihei
4b991ad42f Decouple gradle publish task from lint and test
The publish task currently forces to run lint and test
even though there is no technical dependency. If a
process (e.g. releasing a new library) wants to verify
lint and test work, it should run these steps explicitly.

#cherrypick

PiperOrigin-RevId: 728234811
2025-02-18 09:11:29 -08:00
michaelkatz
75ac9cd191 Supply MediaPeriodId in ExoPlaybackExceptions thrown from Renderers
PiperOrigin-RevId: 728177353
2025-02-18 06:06:17 -08:00
bachinger
2b8700beaa Make setSessionActivity accept null
Issue: androidx/media#2109
PiperOrigin-RevId: 728160580
2025-02-18 05:06:06 -08:00
sheenachhabra
abe836d9cd Add sample_no_bframes.mp4 to FragmentedMp4MuxerEndToEndTest
This adds a test coverage for the case when sample size changes
after AnnexB to Avcc conversion.

PiperOrigin-RevId: 728121319
2025-02-18 02:48:12 -08:00
tonihei
0a50741abe Ignore .kotlin directory
#cherrypick

PiperOrigin-RevId: 728119609
2025-02-18 02:41:26 -08:00
tonihei
78cf53c0b2 Version bump for Media3 1.6.0-beta01
#cherrypick

PiperOrigin-RevId: 727889651
2025-02-17 09:43:14 -08:00
shahddaghash
116fbeaa81 Add EditingMetricsCollector test for export cancellation
PiperOrigin-RevId: 727885381
2025-02-17 09:22:59 -08:00
Googler
653470f73b 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
2025-02-17 08:11:00 -08:00
tonihei
527e1d52ae 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
2025-02-17 08:08:57 -08:00
tonihei
18f3864773 Update release notes for 1.6.0-beta01
#cherrypick

PiperOrigin-RevId: 727862233
2025-02-17 07:47:07 -08:00
shahddaghash
f8d5f5a828 Move FrameBlockingMuxer into AndroidTestUtil
This allows it to be reused in upcoming tests.

PiperOrigin-RevId: 727835985
2025-02-17 06:04:02 -08:00
shahddaghash
6f60aa2548 Add EditingMetricsCollector test for export error
PiperOrigin-RevId: 727835981
2025-02-17 06:02:06 -08:00
shahddaghash
3ce6a2e6b8 Add EditingMetricsCollector test for export success
PiperOrigin-RevId: 727826326
2025-02-17 05:19:16 -08:00
andrewlewis
2f9fcfd238 Remove unused experimental quality targeting mode
PiperOrigin-RevId: 727817967
2025-02-17 04:46:13 -08:00
shahddaghash
6d408c2d31 Create a new MetricsReporter.Factory
This includes creating a new Factory for `MetricsReporter` and adding it to Transformer. This is done as we need to create a new `MetricsReporter` for each export operation, so it makes sense to have a Factory.

PiperOrigin-RevId: 727798528
2025-02-17 03:34:57 -08:00
kimvde
c1eb381948 Transformer: fix gradle dependency type
PiperOrigin-RevId: 727760498
2025-02-17 01:23:21 -08:00
tonihei
b306b10597 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
2025-02-14 16:35:24 -08:00
tonihei
8a888d0d18 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
2025-02-14 08:46:29 -08:00
tonihei
792a2ae05d Increase timeout for AudioPositionAdvancingTest
500ms may not be enough to start playback on a slow device

#cherrypick

PiperOrigin-RevId: 726940099
2025-02-14 08:37:44 -08:00
tonihei
d5df227b3a 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
2025-02-14 07:39:37 -08:00
tonihei
28bfb27fb5 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
2025-02-14 07:13:55 -08:00
tonihei
982403a0cc 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
2025-02-14 06:20:00 -08:00
tonihei
f0da364d3f 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
2025-02-14 06:17:19 -08:00
rohks
e9df85b48d 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
2025-02-14 05:05:51 -08:00
tonihei
ef9b6d212e 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
2025-02-14 04:59:19 -08:00
tonihei
e0ef6e5182 Move DefaultSuitableOutputChecker operations to playback thread
PiperOrigin-RevId: 726879236
2025-02-14 04:56:22 -08:00
tonihei
1015ef8b56 Move unsuitable output path logic <API31 into SuitableOutputChecker
This avoids distributing the logic between multiple classes and
keeps ExoPlayerImpl simpler.

PiperOrigin-RevId: 726874038
2025-02-14 04:36:45 -08:00
tonihei
d386e002d2 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
2025-02-14 04:33:36 -08: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