20051 Commits

Author SHA1 Message Date
Googler
994e2fc317 Rollback of f9eb8626eb
PiperOrigin-RevId: 601912101
2024-01-26 17:55:30 -08:00
Googler
9e48fcb8fb Rollback of 2e6982be2c
PiperOrigin-RevId: 601911260
2024-01-26 17:50:24 -08:00
Googler
e0be4c2ff4 Rollback of 4d5f844c61
PiperOrigin-RevId: 601910682
2024-01-26 17:45:40 -08:00
tofunmi
4d5f844c61 Clear the list of videoEffects in trim optimization
If trim optimisation is being applied, then `EditedMediItem.effects.videoEffects` only contains no-op effects or regular rotations that get be applied in the muxer wrapper. Therefore, we should clear the list of video effects to ensure that no effect gets applied twice.

This fixes requested rotations being applied twice in trim optimization.

Manually tested to ensure all combinations of trimming+muting+rotating works at intended.

PiperOrigin-RevId: 601853203
2024-01-26 13:33:53 -08:00
jbibik
eb3173aa90 Remove a redundant TODO in Util
PiperOrigin-RevId: 601820851
2024-01-26 11:34:43 -08:00
tonihei
2fc5590e7a Remove misleading @CanIgnoreReturnValue
The return value of onConfigure must not be ignored as it specifies
the output format of the processor, which may be different from the
input format.

#minor-release

PiperOrigin-RevId: 601799440
2024-01-26 10:19:40 -08:00
tonihei
ed5b7004b4 Replace or suppress deprecated usages
Many usages are needed to support other deprecations and some
can be replaced by the recommended direct alternative.

Also replace links to deprecated/redirected dev site

PiperOrigin-RevId: 601795998
2024-01-26 10:06:18 -08:00
tofunmi
7424cffce1 Support changing input colorinfo for images
since we now can support taking in the inputColor upon registering the stream, there is no need to hardcode the image input color anymore. We should now be able to support switching between texture and image input which we couldn't before, but this is untested and not necessary.

PiperOrigin-RevId: 601784149
2024-01-26 09:17:29 -08:00
huangdarwin
b1c1c2a6dd Transformer: Plumb hdrMode into AssetLoaders instead of forceInterpret.
This allows us to also plumb whether we're doing MediaCodec tone-mapping,
which will be used in a follow-up CL in the ExoAssetLoaderVideoRenderer.

PiperOrigin-RevId: 601774435
2024-01-26 08:36:21 -08:00
ibaker
373822ce45 Add a comment to suggest keeping JUnit version in sync with the Android
source tree - to make importing GTS tests easier.

PiperOrigin-RevId: 601725811
2024-01-26 04:14:40 -08:00
Googler
807d98a3d6 Update IMA README to include link to supported platforms
PiperOrigin-RevId: 601720412
2024-01-26 03:44:24 -08:00
tofunmi
2e6982be2c limit transmuxing to regular rotations only
PiperOrigin-RevId: 601710663
2024-01-26 02:46:50 -08:00
sheenachhabra
605689a020 Fix link to 1.3.0-alpha01 release
PiperOrigin-RevId: 601469906
2024-01-25 09:23:17 -08:00
sheenachhabra
21ab474260 Version bump to media3:1.3.0-beta01
#minor-release

PiperOrigin-RevId: 601441910
2024-01-25 07:28:43 -08:00
ibaker
12157a6b1a Make Cea608Parser and Cea708Parser package-private
It's likely that we will merge these back into their `XXXDecoder`
implementations, but this smaller change allows us to avoid including
these public symbols in the upcoming release.

#minor-release

PiperOrigin-RevId: 601432629
2024-01-25 06:43:57 -08:00
tofunmi
f9eb8626eb Support transmuxing when no op effects and regular rotations are set
PiperOrigin-RevId: 601419245
2024-01-25 05:34:06 -08:00
sheenachhabra
79b0b8090c Update release notes for Media3 1.3.0-beta01 release
#minor-release

PiperOrigin-RevId: 601408404
2024-01-25 04:34:10 -08:00
ibaker
a6812156e6 Throw immediately from ExoPlayer.setVideoEffects() if dep not found
This method works by reflectively loading classes from the `lib-effect`
module, in order to avoid a hard dependency on this module for ExoPlayer
users that don't want video effect functionality. This change ensures
that a failure to load the necessary classes fails immediately, instead
of on a later thread inside `MediaCodecVideoRenderer` when the
reflection currently happens.

Also update the javadoc to make the dependency requirement clear.

#minor-release

PiperOrigin-RevId: 601387957
2024-01-25 02:43:35 -08:00
jbibik
f103a2dcf5 Add a setter of SubtitleParser.Factory to MediaSource.Factory
DASH: `DashMediaSource.Factory` would only propagate it to `DashChunkSource.Factory` -> `BundledChunkExtractor.Factory`

SS: `SSMediaSource.Factory` -> `SsChunkSource.Factory`

HLS: `HlsMediaSource.Factory` -> `HlsExtractorFactory`

Remove nullability of SubtitleParser.Factory across the stack

#minor-release

PiperOrigin-RevId: 601250013
2024-01-24 15:19:50 -08:00
christosts
85db94782a Rollback of e364510937
PiperOrigin-RevId: 601187997
2024-01-24 11:50:24 -08:00
jbibik
4d7b23f0d1 Add setters of SubtitleParser.Factory and experimental toggle
The `SubtitleParser.Factory` is no longer @Nullable and the experimenting toggle is used to enable/disable the use of this factory for subtitle parsing during extraction.

The three places that will hold the "truth" for the `SubtitleParser.Factory` are: BundledChunkExtractor.Factory, SsChunkSource.Factory, DefaultHlsExtractorFactory

DASH: `DashMediaSource.Factory` would only propagate it to `DashChunkSource.Factory` -> `BundledChunkExtractor.Factory`

SS: `SSMediaSource.Factory` -> `SsChunkSource.Factory`

HLS: `HlsMediaSource.Factory` -> `HlsExtractorFactory`

#minor-release

PiperOrigin-RevId: 601151615
2024-01-24 09:55:49 -08:00
sheenachhabra
0acf6902e5 Write "stco" box instead of "co64" for fragmented MP4
As per MP4 spec ISO 14496-12: 8.7.5 Chunk Offset Box, Both "stco" and
"co64" can be used to store chunk offsets. While "stco" supports 32-bit
offsets, "co64" supports 64-bit offsets.
In non fragmented MP4, the mdat box can be extremely large, hence muxer
uses "co64" box.
But for fragmented MP4, muxer does not write any data in this chunk offset
box (present in "moov" box) because all sample related info is present in
"moof" box.
Technically, "co64" box should also work in fragmented MP4because
its empty only but QuickTime player fails to play video if "co64"
box is present in fragmented MP4 output file.

Testing: Verified that QuickTime player does not play video when "co64"
box is present but is able to play when "stco" box is present.

#minor-release

PiperOrigin-RevId: 601147046
2024-01-24 09:40:20 -08:00
jbibik
966b710897 Remove SubtitleParser.Factory references from Hls/Ss/DashMediaPeriod
Those classes only needed to have access to a `SubtitleParser.Factory` to get a potentially updated `Format` for TrackGroups. The `SubtitleParser.Factory` was only used to check the support for the `mimeType` and getting some cue-related behaviour.

This introduced complexity in a way that both Periods and Extractors needed to have the same `SubtitleParser.Factory` in their individual stacks. To ensure that the sample queue would get the same transcoded/original format.

Instead, now we expose `getOutputTextFormat` methods on `ChunkExtractor.Factory`, `SsChunkSource.Factory` and `HlsExtractorFactory`. Those are the dependencies that Hls/Ss/DashMediaPeriod can make use of to delegate the format-updating logic to.

#minor-release

PiperOrigin-RevId: 601130714
2024-01-24 08:40:39 -08:00
rohks
f8dbbc82e2 Add Mp4ExtractorTest for sample with edit list (edts box)
The sample has multiple sync frames for video track.

PiperOrigin-RevId: 601129350
2024-01-24 08:33:02 -08:00
sheenachhabra
806f90922b Write sample data offset related fields in tfhd and trun box
This fix makes output playable on VLC player.
The output does not play on QuickTime player which is being fixed in
a separate CL.

#minor-release

PiperOrigin-RevId: 601118813
2024-01-24 07:52:02 -08:00
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