20226 Commits

Author SHA1 Message Date
michaelkatz
688622eb47 Keep stream offset alive in ImageRenderer until stream transition
Fix modeled after OutputStreamInfo usage for stream offset in `MediaCodecRenderer`

PiperOrigin-RevId: 601109900
2024-01-24 07:10:04 -08:00
tofunmi
b94c7d08c1 MuxerWrapper rotation degree fix
Allow setAdditionalRotationDegrees to be called with same rotation after tracks added. This is needed for processes that mux files partially trim optimization so they don't error out after hitting the check state

Manually tested to ensure trim optimization succeeds, automated test added here as well

PiperOrigin-RevId: 601081778
2024-01-24 04:44:28 -08:00
ibaker
e5621cc709 Add proguard keep rules for ExoPlayer.setVideoEffects
These symbols in `lib-effect` are referenced via reflection from
`CompositingVideoSinkProvider` in `lib-exoplayer` in order to avoid
a hard dependency from `lib-exoplayer` to `lib-effect`. Without this
keep rule, the symbols can get renamed by R8 resulting in the
invocations failing.

#minor-release

PiperOrigin-RevId: 601074636
2024-01-24 04:08:40 -08:00
timpeut
9c1aaa7c43 Suppress nullability warnings
PiperOrigin-RevId: 600891113
2024-01-23 13:34:14 -08:00
tianyifeng
35ac46b92e Change the behaviour in MediaMetadata.Builder.populate
Populate both `artworkUri` and `artworkData` in
`MediaMetadata.Builder.populate(MediaMetadata)` when at least one of them is non-null.

Issue: androidx/media#964
PiperOrigin-RevId: 600826103
2024-01-23 10:08:33 -08:00
sheenachhabra
b98e5ac0d4 Suppress lint warning about missing POST_NOTIFICATIONS permission
For media session related notifications, permission is not required.
https://developer.android.com/develop/ui/views/notifications/notification-permission#exemptions-media-sessions

#minor-release

PiperOrigin-RevId: 600819251
2024-01-23 09:46:50 -08:00
sheenachhabra
4c1581a175 Process all tracks before writing fragment in fragmented MP4
Earlier implementation processed each track (pending sample's buffer info)
individually when writing their corresponding "traf" box in a fragment.
The change involves processing all tracks before start writing "traf" boxes.

#minor-release

PiperOrigin-RevId: 600811093
2024-01-23 09:20:52 -08:00
tonihei
b64d754670 Add setRemotePlaybackInfo to MediaStyle
This method is needed for some system apps to override the
output switcher when MediaRouter2 can't be used.

PiperOrigin-RevId: 600807119
2024-01-23 09:06:37 -08:00
siroberts
1f78aa5b2a Change type of setCustomLayout in MediaSession.resultBuilder to List
PiperOrigin-RevId: 600801528
2024-01-23 08:46:30 -08:00
tonihei
9448f939f4 Use Media3 MediaStyle instead of legacy one
The default notification provider was still using the legacy
compat MediaStyle instead of our own Media3 one. They are fully
equivalent in their implementation and API and can be swapped out
easily.

PiperOrigin-RevId: 600797920
2024-01-23 08:34:06 -08:00
tianyifeng
0c0b19e26e Internal change
PiperOrigin-RevId: 600784733
2024-01-23 07:41:15 -08:00
ibaker
a53f3451dd Test parsing-during-extraction in ClippedPlaybackTest
We keep the previous parsing-during-rendering tests, even though they
can be a bit flaky, because this is an important regression test. The
regression risk is lower for this instrumentation test compared to
robolectric tests with different `ShadowLooper` behaviour.

#minor-release

PiperOrigin-RevId: 600781035
2024-01-23 07:27:11 -08:00
tofunmi
acc78125d2 Update METADATA to add clang-format requirement for glsl files
also ran clang-format for good measure

PiperOrigin-RevId: 600759938
2024-01-23 05:49:38 -08:00
tofunmi
cc62f0556c BaseGlShaderProgram: Remove redundant NoSuchElementException catching
PiperOrigin-RevId: 600738198
2024-01-23 03:52:49 -08:00
ibaker
ca61ac6ca3 Release MediaSession and ExoPlayer in MediaControllerStubTest
Due to poor isolation between the session tests, in particular the
static state in `MediaSession.SESSION_ID_TO_SESSION_MAP`, an unreleased
session at the end of one test can cause subsequent tests to fail with
obscure errors like `Session ID must be unique`.

#minor-release

PiperOrigin-RevId: 600737697
2024-01-23 03:50:04 -08:00
tofunmi
94ce356bc1 Transformer demo: support selecting all media MIME types
It's useful for development and debugging to select a local image
or audio (only) file as well as a video file in the transformer demo
app.

I tested manually that you can select a local video, audio and image
but not e.g. a pdf with the main "choose local file" picker and only
an image with the choose local image picker for the bitmap overlay
demo.

PiperOrigin-RevId: 600722622
2024-01-23 02:35:19 -08:00
tofunmi
5863ce7dd5 Trim optimization fix: check if audio is removed when comparing formats
#minor-release

PiperOrigin-RevId: 600493390
2024-01-22 10:14:11 -08:00
tonihei
c6bf380d50 Fix cleared metadata when repeating the same item
Issue: androidx/media#1007

#minor-release

PiperOrigin-RevId: 600477540
2024-01-22 09:20:36 -08:00
sheenachhabra
94bf9fa81d Do not write empty track (with no samples) in a non fragmented MP4
PiperOrigin-RevId: 600453680
2024-01-22 07:44:55 -08:00
tonihei
81615dd5b5 Catch exceptions when retrieving current device from audio manager
We can just continue to assume that we don't know the current device.
This case happens on the latest Robolectric release where this method
call isn't implemented yet. As we not generally assume that the
method can throw, this workaround can be removed once Robolectric
is updated again.

#minor-release

PiperOrigin-RevId: 600426851
2024-01-22 05:22:50 -08:00
christosts
9e9c3cbe5e SimpleBasePlayer: add protected method for thread verification
Add protected method in SimpleBasePlayer for thread verification to help
subclasses verify thread access for additional methods they define and
still report the same message to the user.

Also, remove the DAC link pointing to the ExoPlayer-specific
documentation from the exception message. Users who extend
SimpleBasePlayer have access to the class' javadoc.

PiperOrigin-RevId: 600426692
2024-01-22 05:20:34 -08:00
andrewlewis
6029521898 Prevent using high profile on problematic devices
[Android best
practices](https://developer.android.com/media/optimize/sharing#android_8_81_and_9)
recommend disabling B-frames on API 27, but some devices output B-frames anyway
when H.264/AVC High profile is selected. Add a workaround to force these
devices not to use high profile, to prevent B-frames being output.

`MediaMuxer` likely handles B-frames on these specific devices, but this change
allows the migration to default to in-app muxing to take place without
introducing errors, and it's a temporary workaround until B-frames are properly
supported in the in-app muxer.

PiperOrigin-RevId: 600422238
2024-01-22 04:55:54 -08:00
tonihei
c64b271f07 Check int and float parameters from external apps for validity
Some player method calls sent from MediaControllers accept int
or float values with a very clear API contract that disallows
some values. Filtering by these values early avoids calling a
Player implementation with invalid values.

PiperOrigin-RevId: 600413993
2024-01-22 04:08:42 -08:00
ibaker
999e154b2a Disable 'skip buffers with identical release times' in GTS tests
This optimization always reports buffers as 'skipped' (i.e. deliberately
not shown), which makes sense for the target case of high FPS content on
a lower refresh rate screen, when lots of the frames will **never** be
shown.

However the optimization also results in reporting buffers as 'skipped'
when decoding is a bit slow, resulting in a frame being released one
vsync late, which then means we have two frames to release in the same
vsync (when the previous vsync was empty). In this case, it would be
more correct to report this as a 'dropped' frame (since it was due to
slow decoding).

Until we can change the logic to distinguish these cases and report them
separately, this CL disables the optimization completely in GTS tests.
This is needed because we often assert there were zero skipped frames,
so slight decoding slowness can cause spurious/flaky test failures (our
threshold for dropped frames is non-zero).

#minor-release

PiperOrigin-RevId: 600406443
2024-01-22 03:27:17 -08:00
tonihei
b84104e7a1 Add TODO about known feature gap in ImageRenderer
PiperOrigin-RevId: 600404546
2024-01-22 03:16:34 -08:00
andrewlewis
e82393ed41 Skip 1080p test on Nexus 7, API 21
This device doesn't seem to be capable of simultaneous encode/decode at this
resolution. We don't have a good way to check the capability (we are already
checking separate decode/encode capability) so just skip this test to save time
triaging its failures.

PiperOrigin-RevId: 600399564
2024-01-22 02:52:25 -08:00
christosts
d1d03189eb Rollback of e364510937
PiperOrigin-RevId: 600393114
2024-01-22 02:19:01 -08:00
tonihei
b1c954fa84 Use routed device in AudioCapabilities
From API 23, we may have a preferred device that is most likely used
as the output device.
From API 24, the AudioTrack tells us the actual routed device that is
used for output and we can listen to changes happening mid-playback.
From API 33, we can directly query the default device that will
be used for audio output for the current attributes.

If the routed device is known by any of the methods above, we can add
more targeted checks in methods like isBluetoothConnected to avoid
iterating over all devices that are not relevant.

The knowledge about the routed device will also be useful to check
advanced output capabilities in the future (e.g. for lossless
playback)

PiperOrigin-RevId: 600384923
2024-01-22 01:40:50 -08:00
huangdarwin
cb0f5a7fff Previewing: set VideoFrameReleaseControl after CVSP is created.
This allows us to inject a videoFrameProcessorFactory into
MediaCodecVideoRenderer, without issues about creating the
VideoFrameReleaseControl in the MediaCodecVideoRenderer.

Unfortunately, this does result in more complex CVSP state, where
VideoFrameReleaseControl is no longer final, may be null, and may potentially
change. However, this tries to be careful with assertions to guarantee good
state, and is cleaner than modifying the long-standing MediaCodecVideoRenderer
interface.

Tested that this works on the ExoPlayer demo with setVideoEffects applied, and
using a playlist with SDR->HDR and HDR->SDR items.

PiperOrigin-RevId: 599823412
2024-01-19 07:08:23 -08:00
samrobinson
e364510937 Remove thread blocking for TransformerInternal#getProgress.
Thread-safe interactions with state and value.

PiperOrigin-RevId: 599810672
2024-01-19 06:04:27 -08:00
Copybara-Service
c403df116b Merge pull request #973 from jan-varecka-signageos-io:feat/extractTsAudioType
PiperOrigin-RevId: 599547201
2024-01-18 10:25:47 -08:00
ibaker
34a08e13fc Rollback of 406c0a15be
PiperOrigin-RevId: 599546140
2024-01-18 10:21:53 -08:00
Rohit Singh
50385be7ff Changes based on internal review 2024-01-18 17:25:36 +00:00
ibaker
2e8a81cd4d Update Util.moveItems to explicitly T extends @NonNull Object
PiperOrigin-RevId: 599516707
2024-01-18 08:35:04 -08:00
sheenachhabra
36e99f5264 Remove unnecessary passing around of class variable
PiperOrigin-RevId: 599507570
2024-01-18 08:01:33 -08:00
samrobinson
3e3c746368 Add javadoc to the TransformerState's for pause & resume.
Although not public, documenting what happens in each state allows for
better code understanding at a glance.

As part of this, refactored the #getProgress method to highlight that
the other options are "non standard".

PiperOrigin-RevId: 599505369
2024-01-18 07:52:02 -08:00
sheenachhabra
4b0ff48ca9 Fix release notes
PiperOrigin-RevId: 599499930
2024-01-18 07:25:44 -08:00
tonihei
59dc5b6692 Add missing null and Bundle checks in MediaSession/ControllerStub
PiperOrigin-RevId: 599477547
2024-01-18 05:29:39 -08:00
huangdarwin
616cb943f0 Previewing: Allow inputColorInfo to change, from SDR to HDR.
This also fixes issue introduced by frames being released from a prior version of a
GlShaderProgram

Tested by seeking within a playlist with one SDR then one HDR video.

PiperOrigin-RevId: 599475959
2024-01-18 05:20:18 -08:00
christosts
0e66197419 Rename TimestampIterator argument name in queueInputBitmap()
#minor-release

PiperOrigin-RevId: 599460771
2024-01-18 04:01:27 -08:00
tofunmi
5eb1f4043b disallow go links in Media3 open source code
PiperOrigin-RevId: 599455204
2024-01-18 03:28:31 -08:00
tonihei
e730feb98a Add missing IntDef annotation
PiperOrigin-RevId: 599414024
2024-01-18 00:16:59 -08:00
huangdarwin
1ec193883c HDR: Propagate PQ to SDR OOTF to internal input.
Previously, 8f69bb0d9d updated external input (video input)
but not internal input (image/texture input). Update internal input as
well to match.

PiperOrigin-RevId: 599235813
2024-01-17 11:27:38 -08:00
sheenachhabra
666685bd85 Use 4 Byte size field in fMP4 mdat boxes
Since mdat box can be huge so there is a provision to use 64 bit size field.
In case of fragmented MP4, individual fragments should not have large mdat box
so a 32 bit size field should be sufficient.

PiperOrigin-RevId: 599219041
2024-01-17 10:36:47 -08:00
ibaker
406c0a15be CompositeSequenceableLoader: Prefer buffered position of A/V tracks
Preferring audio and video tracks matches logic we already have in
[`ProgressiveMediaPeriod.getBufferedPositionUs`](f6fe90f30b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ProgressiveMediaPeriod.java (L403)).

PiperOrigin-RevId: 599154217
2024-01-17 06:33:14 -08:00
Rohit Singh
32576be3e3 Add release note 2024-01-17 13:26:17 +00:00
ibaker
80bfa819c0 Add method to TextRenderer to control whether decoding is done or not
When we default to 'parse during extraction', we will flip the default
of this, to ensure that apps know they are using an
incompatible/deprecated flow for subtitle handling.

PiperOrigin-RevId: 599109304
2024-01-17 02:51:48 -08:00
Rohit Singh
7e21da8b73 Format with google-java-format 2024-01-17 10:51:28 +00:00
Jan Vařečka
286b1f52d9 Add test for MPEG audio with audio type 2024-01-17 10:22:55 +00:00
Jan Vařečka
a83662b8e1 Extract audio type from TS descriptors
The audio type of the stream is defined by ISO/IEC 13818-1 in section 2.6.18.
2024-01-17 10:22:52 +00:00