20885 Commits

Author SHA1 Message Date
Googler
6e18cb0053 Add support for amr-wb audio codec.
Implement damrBox to provide support for amr-wb audio codec.

Add unit test and an Android end to end test.

PiperOrigin-RevId: 650210732
2024-07-08 05:13:18 -07:00
claincly
d0a29400ea Fix test failuer on real-device
In the previous CL, muxer timeout is set to the surface timeout, which is
incorrect.

PiperOrigin-RevId: 650203505
2024-07-08 04:40:22 -07:00
tianyifeng
58ff8fa3c2 Add onPreloadError method to PreloadMediaSource.PreloadControl
Upon the call of `PreloadMediaSource.preload`, the source will periodically check the source refresh or period loading error, and trigger `PreloadMediaSource.PreloadControl.onPreloadError`. For now, the `DefaultPreloadManager` will skip the problematic source and continue to preload the next source. The checking of the error will be terminated when the source stops preloading or releases.

PiperOrigin-RevId: 650195817
2024-07-08 04:06:32 -07:00
claincly
b4722ef1ea Make timeout longer for emulators
Some test is flaky because frame processing is quite slow and triggered this
time out.

PiperOrigin-RevId: 650191068
2024-07-08 03:47:15 -07:00
tonihei
f55c09cfe2 Add ForwardingSimpleBasePlayer
This utility helps apps to forward to another Player while overriding
selected behavior or state values. The advantage to a ForwardingPlayer
is that the SimpleBasePlayer base class keeps ensuring correctness,
listener handling etc.

The default forwarding logic tries to stay as close as possible to the
original method calls, even if not strictly required by the Player
interface (e.g. calling single item addMediaItem instead of
addMediaItems if only one item is added).

Issue: androidx/media#1183
PiperOrigin-RevId: 650155924
2024-07-08 01:15:16 -07:00
Googler
a269355369 Refactor audioEsdsBox to esdsBox
Since the muxer supported only AAC audio codec, the esdsBox was unconditionally created within the audioSampleEntry. This CL refactors the box creation logic by moving it to the codecSpecificBox method. This is to make adding support for new audio codecs easier.

PiperOrigin-RevId: 650130935
2024-07-07 23:13:29 -07:00
tonihei
b2585aad0f Allow externally provided Timeline in SimpleBasePlayer.State
The Timeline, Tracks and MediaMetadata are currently provided
with a list of MediaItemData objects, that are a declarative
version of these classes. This works well for cases where
SimpleBasePlayer is used for external systems or custom players
that don't have a Timeline object available already. However,
this makes it really hard to provide the data if the app already
has a Timeline, currently requiring to convert it back and forth
to a list of MediaItemData.

This change adds an override for `State.Builder.setPlaylist`
that allows to set these 3 objects directly without going
through MediaItemData. The conversion only happens when needed
(e.g. when modifying the playlist).

PiperOrigin-RevId: 649667983
2024-07-05 09:39:49 -07:00
tonihei
fafd927702 Replace SimpleBasePlayer.State.playlist by getter
The value is basically a duplicate of the information stored
in the timeline field. Reducing the source of truth to the
single Timeline also allows acceptance of other Timelines in the
future that don't necessarily have the helper structure of
the playlist.

To allow apps to retrieve the current playlist as it is, we
add a getter instead.

PiperOrigin-RevId: 649667281
2024-07-05 09:35:44 -07:00
ktrajkovski
35a43d5c43 Add support for IAMF audio in MP4 Extractors.
A new IAMF type can now be recognized as an audio sample entry. A new mime type was created.

PiperOrigin-RevId: 649658865
2024-07-05 08:40:18 -07:00
dancho
40a5d31753 Parse the H264 bitstream of mp4 files to identify sample dependencies
Changes to Mp4Extractor to parse additional sample dependency information
and mark output samples as "no other sample depend on this".
Only applies to H.264 tracks.
Controlled by new mp4 flag: FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES

PiperOrigin-RevId: 649640184
2024-07-05 06:45:40 -07:00
ibaker
bb2fd002ae Fix TTML handling of inherited percentage tts:fontSize values
The percentage should be interpreted as relative to the size of a parent
node.

This change makes this inheritance work correctly for percentages in
both the parent and child. It does not fix the case of a non-percentage
parent size with a percentage child size.

PiperOrigin-RevId: 649631055
2024-07-05 05:57:54 -07:00
andrewlewis
8f72054f2b Remove unused tag
PiperOrigin-RevId: 649448617
2024-07-04 10:55:15 -07:00
rohks
adf1c7915d Add FileDescriptorDataSource
This is a new `DataSource` that can be used to read from a `FileDescriptor`.

Limitations:
- The provided file descriptor must be seekable via lseek.
- There's no way to duplicate a file descriptor with an independent position (it
  would be necessary instead for the app to provide a new FD). Therefore this
  implementation will only work if there's one open data source for a given file
  descriptor at a time.
PiperOrigin-RevId: 649443584
2024-07-04 10:24:25 -07:00
ibaker
b7f317e650 Remove deprecation note from release notes
This was added in 0b96f4372f
but isn't needed. The deprecation annotation is self-documenting.

PiperOrigin-RevId: 649419778
2024-07-04 08:19:59 -07:00
Googler
0d4a785b61 Add support for parsing LHEVCConfigurationBox.
Parse LHEVCDecoderConfigurationRecord with the ‘lhvC’ type and set the corresponding sample mime type to video/mv-hevc.  With no MV-HEVC decoder available, fallback to single-layer HEVC decoding.

PiperOrigin-RevId: 649119173
2024-07-03 10:24:36 -07:00
claincly
8632c3add6 Fix not setting videoSinkNeedsRegisterInputStream when seeking
PiperOrigin-RevId: 649093092
2024-07-03 09:04:58 -07:00
andrewlewis
4c1807781f Mark flaky test as ignored
PiperOrigin-RevId: 649091256
2024-07-03 08:58:58 -07:00
claincly
ccdc0ffc27 Use us (microsecond) API.
PiperOrigin-RevId: 649058648
2024-07-03 07:00:18 -07:00
sheenachhabra
a1fc4e766f Reduce Exoplayer load control buffer durations for Transformer demo app
The default value is 50 seconds.
Changed it to 5 seconds.

This prevents the player from buffering too much data and causing the app to crash due to OOM.

This was reported in https://github.com/androidx/media/issues/1506

PiperOrigin-RevId: 649054885
2024-07-03 06:41:52 -07:00
kimvde
c832cf5a57 Clarify Javadoc of VideoSink
The VideoSink has an input and an output surface. Clarify which surface
the Javadoc is referring to. Also document that the VideoSink can be fed
with images, and that multiple renderers can feed the same sink.

PiperOrigin-RevId: 649052551
2024-07-03 06:31:40 -07:00
claincly
ed3a741601 Fix MCVR crash when seeking in HDR10 videos
MCVR crashed because MCVR registers a new input stream to VideoSink on every
`onOutputFormatChanged()`, assuming that `onOutputFormatChanged()` is only
invoked on media item transition. However, it can be called multiple times for
one media item.

PiperOrigin-RevId: 649050576
2024-07-03 06:22:44 -07:00
claincly
ce8ab84b7c Add test that covers clipping all videos in a sequence
PiperOrigin-RevId: 649048322
2024-07-03 06:13:08 -07:00
claincly
b9d101f090 Use a resolution that should be encode-able on all devices
The image in the test has a resolution of 1x1 which some device will reject.

PiperOrigin-RevId: 649039791
2024-07-03 05:32:56 -07:00
andrewlewis
0b96f4372f Rollback of 95260e28a5
PiperOrigin-RevId: 649003095
2024-07-03 02:52:00 -07:00
tianyifeng
b531d93b90 Version bump to 1.4.0-rc01
#cherrypick

PiperOrigin-RevId: 648982615
2024-07-03 01:27:39 -07:00
claincly
73da1c09bd Call onProcessedStreamChange() for every media item change
Added `MCR.experimentalEnableProcessedStreamChangedAtStart()` to guard this new
feature.

PiperOrigin-RevId: 648886533
2024-07-02 17:04:08 -07:00
sheenachhabra
3793a06bdd Add support for file format for depth/editing in Mp4Muxer
PiperOrigin-RevId: 648747038
2024-07-02 09:42:36 -07:00
tianyifeng
9277a34253 Update release notes for 1.4.0-rc01
#cherrypick

PiperOrigin-RevId: 648745388
2024-07-02 09:37:05 -07:00
dancho
91bf3d1da1 Use software decoder in VideoDecodingWrapper
Hardware decoder on some devices fails to write 1920x1080 YUV_420_888 buffers into an ImageReader. This change allows us to remove skipCalculateSsim device workaround in ExportTest.java.

VideoDecodingWrapper now uses media3.MediaExtractorCompat: necessary for parsing of MediaFormat#KEY_CODECS_STRING and decoder capabilities check

PiperOrigin-RevId: 648726721
2024-07-02 08:29:36 -07:00
andrewlewis
3b7d59ef4f Rollback of 95260e28a5
PiperOrigin-RevId: 648708459
2024-07-02 07:16:27 -07:00
tianyifeng
afe3826d7c Suppress the lint "WrongConstant" error
Lint somehow complains that the integer resulting from the bit-manipulation shouldn't be passed as an @IntDef parameter.

#cherrypick

PiperOrigin-RevId: 648687698
2024-07-02 05:49:23 -07:00
andrewlewis
95260e28a5 Add input type for automatic frame registration
Deprecate `setInputDefaultBufferSize` and `setRequireRegisteringAllInputFrames`
as the new input stream type replaces these (as far as we know they are always
used together).

This is in preparation for supporting asset loaders signaling that they require
these features, specifically for recording from a surface.

PiperOrigin-RevId: 648686087
2024-07-02 05:41:23 -07:00
kimvde
a2087ba5bb Improve Javadoc of VideoSink.registerInputFrame/queueBitmap
Document that the stream must be registered before

PiperOrigin-RevId: 648648650
2024-07-02 02:50:02 -07:00
ibaker
03a205f220 Re-order CEA-6/708 samples during extraction instead of rendering
This is required before we can move CEA-6/708 parsing from the rendering
side of the sample queue to the extraction side.

This re-ordering is needed for video encodings with different decoder
and presentation orders, because the CEA-6/708 data is attached to each
frame and needs to be processed in presentation order instead of decode
order. This change re-orders frames within a group-of-pictures, but also
takes advantage of `maxNumReorderFrames/Pics` values to cap the size of
the re-ordering queue, allowing caption data to be released 'earlier'
than the end of a GoP.

Annex D of the CEA-708 spec (which also applies for CEA-608 embedded in
SEI messages), makes the need to re-order from decode to presentation
order clear.

PiperOrigin-RevId: 648648002
2024-07-02 02:47:45 -07:00
tianyifeng
0510370bd2 Add OptIn annotation to method declaration in demo app file
#cherrypick

PiperOrigin-RevId: 648641357
2024-07-02 02:19:18 -07:00
bachinger
ec3a58f8db Count down three playback states to match the assertion
PiperOrigin-RevId: 648629427
2024-07-02 01:30:38 -07:00
tianyifeng
7fb6eee920 Add PreloadException with initial subset of error codes
As the first version, the error codes only include the miscellaneous and IO errors, but are likely to be extended.

PiperOrigin-RevId: 648466385
2024-07-01 13:24:34 -07:00
ibaker
711d18de03 Fix index out of bounds exception when a Subtitle is empty
Issue: androidx/media#1516

#cherrypick

PiperOrigin-RevId: 648416119
2024-07-01 10:40:15 -07:00
bachinger
70c063905c Improve automatic error replication for legacy browsers
This change extends the error replication to a given set of
error codes (not only authentication error), but only
replicates an error if the caller of the service `Callback`
is a legacy controller. It also makes error replication
configurable so that apps can opt-out and report errors
manually instead, or define the error codes for which
replication is enabled.

The change also removes the restriction of `sendError` only
being available for Media3 controllers. Instead, sending an
error to a legacy controller updates the platform playback
state in the same way as sending the error to the media
notification controller.

#cherrypick

PiperOrigin-RevId: 648399237
2024-07-01 09:47:25 -07:00
tianyifeng
6bf2461f80 Update translations
#cherrypick

PiperOrigin-RevId: 648385733
2024-07-01 09:02:21 -07:00
simakova
16ef63cdfc Update the composition README file
PiperOrigin-RevId: 648282532
2024-07-01 01:34:17 -07:00
dancho
9939d77d14 Change test to output 16x width and height
PiperOrigin-RevId: 647716870
2024-06-28 10:03:48 -07:00
claincly
174d5ea530 Update test golden images
Now VFP receives actual (un-offsetted) frame presentation time, updates the
test goldens to match.

PiperOrigin-RevId: 647665323
2024-06-28 07:04:47 -07:00
ktrajkovski
e4d4a776c3 Remove deprecated hasPreviousWindow() and hasPrevious() methods.
Use Player.hasPreviousMediaItem() and Player.seekToPreviousMediaItem() instead.

PiperOrigin-RevId: 647664991
2024-06-28 07:02:33 -07:00
dancho
18b28cd625 Skip seahawk device for 8K encoding
PiperOrigin-RevId: 647647264
2024-06-28 05:40:50 -07:00
ktrajkovski
e392084c4d Remove deprecated DrmSessionEventListener.onDrmSessionAcquired method.
#cherrypick

PiperOrigin-RevId: 647620751
2024-06-28 03:36:51 -07:00
ktrajkovski
47b1ca18ed Remove deprecated Player#hasPrevious() method.
Use Player#hasPreviousMediaItem() instead.

#cherrypick

PiperOrigin-RevId: 647336042
2024-06-27 09:04:21 -07:00
Googler
3da63eeaa7 Add NAL unit parsing needed for stereo MV-HEVC playback.
Add the following NAL unit parsing utility functions that will be needed for the MV-HEVC support as proposed in Apple's HEVC stereo video interoperability profile:
- NAL unit header parsing to get the layer information needed for MV-HEVC support.
- VPS parsing, including vps_extension() needed for MV-HEVC support.
- SPS parsing modifications to support MV-HEVC.

PiperOrigin-RevId: 647329211
2024-06-27 08:39:12 -07:00
michaelkatz
304bcfc852 Fix spelling typo in 1.4.0-beta01 release notes
PiperOrigin-RevId: 647327810
2024-06-27 08:35:06 -07:00
michaelkatz
a58e77a5a6 Cache audio timestamp frame position across track transition reset
Upon track transition of offloaded playback of gapless tracks, the framework will reset the audiotrack frame position. The `AudioTrackPositionTracker`'s `AudioTimestampPoller` must be made to expect the reset and cache accumulated sum of `AudioTimestamp.framePosition`.

#cherrypick

PiperOrigin-RevId: 647294360
2024-06-27 06:27:32 -07:00