4412 Commits

Author SHA1 Message Date
kimvde
d27549d29a Skip 4K export test on Pixel 3a
PiperOrigin-RevId: 644659699
2024-06-19 01:18:05 -07:00
tonihei
66c19390e2 Audio focus player command clean up
The 'player commands' returned to ExoPlayerImpl instruct the
player on how to treat the current audio focus state.

The current return value when playWhenReady==false is misleading
because it implies we are definitely not allowed to play as if
we've lost focus. Instead, we should return the actual player
command corresponding to the focus state we are in.

This has no practical effect in ExoPlayerImpl as we already
ignore the 'player command' completely  when playWhenReady=false.

To facilitate this change, we also introduce a new internal
state for FOCUS_NOT_REQUESTED to distinguish it from the state
in which we lost focus.

#cherrypick

PiperOrigin-RevId: 644416586
2024-06-18 09:42:26 -07:00
kimvde
048d71e392 Change muxer video duration unit to microseconds
PiperOrigin-RevId: 644402109
2024-06-18 08:56:26 -07:00
kimvde
ada7271974 Add a method to change the frame rate strategy from the VideoSink
PiperOrigin-RevId: 644373231
2024-06-18 07:11:58 -07:00
samrobinson
1d8b2e3f43 Migrate ParameterizedInputSequenceExportTest to AssetInfo for images.
PiperOrigin-RevId: 644363298
2024-06-18 06:31:56 -07:00
michaelkatz
c07bbd333c Version bump to media3:1.4.0-beta01
#cherrypick

PiperOrigin-RevId: 644352776
2024-06-18 05:52:03 -07:00
tonihei
e20e94fde2 Improve audio focus handling tests with ExoPlayer
There are a lot of tests for AudioFocusManager in isolation,
but almost none for the handling in ExoPlayer.

Add test coverage for all the common cases, including some
currently broken behavior that is indicated by TODOs.

PiperOrigin-RevId: 644319251
2024-06-18 03:24:21 -07:00
samrobinson
21ad768628 Add AndroidTestUtil missing asset Format info.
Also adds basic support for canDecode receiving an image Format.

PiperOrigin-RevId: 644300521
2024-06-18 02:06:59 -07:00
kimvde
f0aa30555a Remove calls to VideoFrameReleaseControl.join in CompositionPlayer
These calls have no effect because the VideoFrameReleaseControl of
CompositionPlayer is created with allowedJoiningTimeMs set to 0.

PiperOrigin-RevId: 644274524
2024-06-18 00:22:25 -07:00
samrobinson
2698f3ffc2 Migrate performance tests to use AndroidTestUtil constants.
PiperOrigin-RevId: 644058273
2024-06-17 10:38:23 -07:00
samrobinson
2b55a5bc2d Create an AssetInfo class for AndroidTestUtil test asset information.
This is an internal refactor with no logic changed.

There is a duplication in information and a lack of consistency around
the use of test assets in transformer androidTest. This change
refactors each asset to be defined as its own AssetInfo, with the other
relevant parts stored alongside the uri.

Once this is in place, we can consider other useful functionality, such
as having boolean flags for what tracks an asset has, helper methods
for whether an asset is local or remote, and more. This will reduce the
manual overhead necessary to use more assets in tests, and in
particular leads towards easily using new & existing assets in
parameterized tests.

PiperOrigin-RevId: 644040595
2024-06-17 09:47:56 -07:00
ibaker
d0815d3f7b Deprecate Util.areEqual in favour of Objects.equals
`Objects.equals` has been available since API 19.

PiperOrigin-RevId: 644026884
2024-06-17 09:04:48 -07:00
Copybara-Service
67a7b41fa7 Merge pull request #1437 from MGaetan89:add_exoplayer_setMaxSeekToPreviousPosition
PiperOrigin-RevId: 643987403
2024-06-17 06:38:02 -07:00
samrobinson
6dcbafad21 Use AndroidTestUtil constants so test asset information is consistent.
PiperOrigin-RevId: 643984158
2024-06-17 06:23:22 -07:00
sheenachhabra
ded1adc092 Change sample duration type from Long to Integer
In muxer only 32-bit sample duration is supported. Earlier the duration was type
casted at different places.

PiperOrigin-RevId: 643954226
2024-06-17 04:13:00 -07:00
kimvde
eedfb9960e Reset release control from video sink when enabled
PiperOrigin-RevId: 643950097
2024-06-17 03:58:13 -07:00
sheenachhabra
aeb8fd134b Write moov box at the start of the file if possible
This is done by reserving some space for moov box at the start of the file and writing it there if it fits. If it doesn't fit, then it is written at the end of the file.

PiperOrigin-RevId: 643944698
2024-06-17 03:38:11 -07:00
tonihei
cd2250b5fa Formatting fixes and additional plumbin in legacy controller 2024-06-14 17:47:03 +01:00
Gaëtan Muller
63103978be Make MediaControllerImplLegacy.getMaxSeekToPreviousPosition() return the correct value 2024-06-14 16:21:31 +01:00
Gaëtan Muller
424d2a52fe Support setting the max seek to previous position on CastPlayer 2024-06-14 16:21:30 +01:00
Gaëtan Muller
6153b6d740 Add the ExoPlayer.Builder.setMaxSeekToPreviousPosition(long) method
This method allows customizing the maximum position when using `Player.seekToPrevious()`.

This commit also adds two new methods to `TestExoPlayerBuilder`:
- `setMaxSeekToPreviousPosition(long)`
- `getMaxSeekToPreviousPosition()`
2024-06-14 16:21:30 +01:00
samrobinson
4109e2edd9 Add more cases for parameterized video android tests.
PiperOrigin-RevId: 643346610
2024-06-14 08:04:13 -07:00
bachinger
872d8f078b Rollback of cd9b914c42
PiperOrigin-RevId: 643329324
2024-06-14 06:42:31 -07:00
tonihei
4cd8d64446 Image support in PlayerView
Images are rendered into an ImageView (on top of the video shutter).
The image view is set to the images emitted by ExoPlayer's ImageOutput
and cleared when there is no longer a selected image track.

In order to keep the existing behavior of video tracks to only clear
the old output once the new first frame is rendered (avoiding short
periods of black between playlist items), we have to reorder this code
slightly to make it work for video and images. Both are treated in the
same way. If both are enabled, video takes precedence.

As the UI module only depends on the common module, we can't direcly
add the ImageOutput to ExoPlayer. This is done via reflection if
the provided Player is an ExoPlayer.

#cherrypick

PiperOrigin-RevId: 643320666
2024-06-14 05:33:23 -07:00
bachinger
cd9b914c42 Remove PreloadConfiguration from public API
This feature isn't completed, so we should remove
the public facing API to avoid confusion.

#minor-release

PiperOrigin-RevId: 643318692
2024-06-14 05:23:53 -07:00
ibaker
93af537af7 Parse 'max num reorder samples' values from h.264 and h.265 videos
This value is used in a follow-up change to re-order SEI messages
containing CEA-6/708 data from decode order to presentation order.

PiperOrigin-RevId: 643296338
2024-06-14 03:31:38 -07:00
tofunmi
174c49313c support hdr text overlays
adds luminance multiplier to allow the luminance (i.e. brightness) over a text overlay to be scaled

PiperOrigin-RevId: 643047928
2024-06-13 10:41:09 -07:00
tofunmi
81f15dbd37 SpeedChangingAP: synchronize fields accessed from multiple threads
PiperOrigin-RevId: 643046385
2024-06-13 10:36:49 -07:00
rohks
df5352752f Add a drop-in replacement for MediaExtractor in Media3
This change introduces a new class in Media3 `MediaExtractorCompat`, designed to be a drop-in replacement for platform `MediaExtractor`. While not all APIs are currently supported, the core functionality for the most common use cases of `MediaExtractor` is now available. Full API compatibility will be achieved in the future.

PiperOrigin-RevId: 643045429
2024-06-13 10:33:38 -07:00
samrobinson
e985603e0a Refactor mixedInput E2E test to use parameterized logic.
This CL is a pure refactor of the existing tests, iterative changes
will be done in follow-ups.

The only logic change is having all MP4 assets have the presentaton of
height=360. The old code had some with height 480.
PiperOrigin-RevId: 643020773
2024-06-13 09:17:58 -07:00
sheenachhabra
a39a7f06cf Remove the code to restore current output position
Muxer never uses latest output position but always writes to
a specific location, so restoring its position does not add any
value.

PiperOrigin-RevId: 642996941
2024-06-13 08:07:16 -07:00
claincly
206d2ce8b8 Effect: Delay end of stream until all frames are rendered.
Previously, if renderFramesAutomatically = false, DefaultVideoFrameProcessor
may call onInputStreamProcessedListener after all frames have been
onOutputFrameAvailableForRendering, but before they had all been rendered and
freed.

Delay onInputStreamProcessedListener being called and subsequent DVFP
reconfiguration of effects, until all frames are rendered.

Tested using exoplayer setVideoEffects demo with playlist

PiperOrigin-RevId: 642963100
2024-06-13 06:22:03 -07:00
andrewlewis
a0312615f2 Fix AVI extractor WAVE format extraction
Allow `WAVEFORMAT` (in addition to `WAVEFORMATEX`), which omits initialization
data.

Fix reading of bits per sample to use little endian byte order like the other
reads. See also the wave format docs linked from
https://learn.microsoft.com/en-us/windows/win32/directshow/avi-riff-file-reference#avi-stream-headers.

PiperOrigin-RevId: 642962893
2024-06-13 06:19:10 -07:00
rohks
d4802a429b Fix bug where enabling CMCD for HLS live streams causes error
Determine `nextMediaSequence` and `nextPartIndex` based on the last `SegmentBaseHolder` instance, as it can update `mediaSequence` and `partIndex` depending on whether the HLS playlist has trailing parts or not.

Issue: androidx/media#1395
PiperOrigin-RevId: 642961141
2024-06-13 06:12:08 -07:00
tianyifeng
86a60e6ec2 Schedule refresh for all the playing playlists for HLS live stream
Issue: androidx/media#1240
PiperOrigin-RevId: 642927082
2024-06-13 03:52:16 -07:00
tonihei
ca51ed649b Fix single sample handling ProgressiveMediaPeriod when disabling tracks
When deselecting the single sample track and later re-selecting this
track, the current shortcuts in ProgressiveMediaPeriod don't handle
this case correctly and cause assertion failures.

In particular, this change fixes 3 issues:
 1. When re-selecting the single sample track, we have cleared the
    SampleQueue and need to reload the sample. The existing shortcut
    should only be applied to avoid the reload when starting from a
    non-zero position.
 2. When de-selecting the track, ProgressiveMediaPeriod is left in
    an inconsistent state where the sample queues are empty but
    loadingFinished is still true. Fix this by resetting
    loadingFinished to false.
 3. When seeking, we avoid reloading the stream if we can keep
    inside the existing samples. This logic assumes that all
    remaining samples will continue to be loaded in the queue.
    This condition isn't true though for single sample tracks
    that have been de-selected. They appear to support the seek
    inside the queue (=no seek necessary, always supported), but
    still require a new load if there is no ongoing one to load
    the sample. Fix this by checking this implicit assumption
    (still loading, or loading finished).

PiperOrigin-RevId: 642650248
2024-06-12 10:08:10 -07:00
sheenachhabra
94dff1f349 Split muxer android tests between parameterized and non parameterized
This will be helpful for adding more tests which need not to
be parameterized.

PiperOrigin-RevId: 642638702
2024-06-12 09:29:22 -07:00
tonihei
54f58cafed Clarify semantics of MSG_SET_IMAGE_OUTPUT
The value can be null, which isn't mentioned in the docs yet

PiperOrigin-RevId: 642622583
2024-06-12 08:30:31 -07:00
tonihei
ebe74daaec Add image samples and track selection to demo app
Also move the track selection header strings to the demo app
as they are only used there (except for audio, which stays in UI)

PiperOrigin-RevId: 642616037
2024-06-12 08:02:52 -07:00
kimvde
6234a8bede Move usages of allowReleaseFirstFrameBeforeStarted inside sink
PiperOrigin-RevId: 642611061
2024-06-12 07:39:53 -07:00
sheenachhabra
0b2bca02ca Make nit improvements in muxer code
PiperOrigin-RevId: 642599475
2024-06-12 06:46:28 -07:00
claincly
0da892d935 Refactors the seek test and add more test cases
PiperOrigin-RevId: 642597298
2024-06-12 06:34:43 -07:00
bachinger
011ed909c0 Sync and map fatal and non-fatal errors from and to the legacy session
A fatal `PlaybackException` is mapped to a legacy playback state
in state `STATE_ERROR` with error code, message and extras. A
non-fatal error sent to controllers with `MediaSession.sendError`
is synced to the legacy session by setting error code and message
and merging the extras while preserving the rest of the state in
sync with the session player.

Vice versa, a `MediaController` connected to a legacy session receives
fatal errors through `Player.onPlayerErrorChanged()` and non-fatal errors
through `MediaController.Listener.onError()`.

Error codes are mapped in `LegacyConversions`. Values of error codes
in `@SessionError.ErrorCode` come from `@PlaybackExceptino.ErrorCode`
with the exception of `@SessionError.ERROR_IO` and
`@SessionError.ERROR_UNKNOWN`. These already exist in
`@PlaybackException.ErrorCode` and are mapped accordingly to avoid
semantic duplicates.

PiperOrigin-RevId: 642595517
2024-06-12 06:26:00 -07:00
claincly
f2bdc08b24 Fix minor timestamp handling issue
- Video release should check for buffer timestamp (which is renderer-offsetted), rather than the frame timestamp
- ImageRenderer should report ended after all of it's outputs are released, rather than when finished consuming its input.

Add tests for timestamp handling

PiperOrigin-RevId: 642587290
2024-06-12 05:43:22 -07:00
tonihei
8bd6e5d10a Suppress warning about unused return value
The return value is intentionally unused because the check
is only done to see if the reflection operation succeeds.

PiperOrigin-RevId: 642579373
2024-06-12 05:01:23 -07:00
tonihei
27e6395dbc Make ImageOutput clearable
It's currently not possible to remove a previously set image output
on ExoPlayer, although the underlying renderer already supports
receiving null to clear the output. Marking the parameter as
nullable allows apps to clear it as well.

PiperOrigin-RevId: 642569081
2024-06-12 04:03:32 -07:00
tofunmi
20d56341fc Remove useHdr from overlaySettings
useHdr is unused option and doesn't make sense is the dynamic range of the overlay and video must match

Also reorders and adds javadoc in line with coding conventions

PiperOrigin-RevId: 642555396
2024-06-12 02:52:36 -07:00
kimvde
5a24f40a66 Pass clock to release control from sink provider
In order to do that, make the VideoSink nullable in MCVR.

We want to avoid calling VideoFrameReleaseControl.setClock directly
from MCVR when the sink is enabled. The goal is to handle all the
communication with the release control from the sink/sink provider.

PiperOrigin-RevId: 642542063
2024-06-12 01:51:27 -07:00
sheenachhabra
859ef082d4 Make ExportResult.processedInputs package private
Rational for keeping field package private:
Since the overall export already very complex, by looking at the output file
its hard to know if the desired processing happened or not. Since we now
support sequences with "n" media items, its even more important to know if all
the media items were processed or not.
Although the field exposes implementation details, it seems ok as we get benefit of detailed testing.

PiperOrigin-RevId: 642337888
2024-06-11 11:40:36 -07:00
ibaker
2416ec1cb5 Update @UnstableApi docs with a link to DAC
The code snippets in javadoc don't render correctly due to
https://issuetracker.google.com/342557694

PiperOrigin-RevId: 642309632
2024-06-11 10:18:13 -07:00