19814 Commits

Author SHA1 Message Date
Johan Halin
ad7b12e56f Apply workaround for Android 13 and newer
At least some Android 14 devices still have the same invalid URL issue
when using ClearKey DRM, so might as well apply the check to newer
versions of Android as well.
2023-11-27 10:41:47 +00:00
andrewlewis
ad40db4489 Avoid value close to overflow for KEY_OPERATING_RATE
Using `Integer.MAX_VALUE` risks causing arithmetic overflow in the codec
implementation.

Issue: androidx/media#810

#minor-release

PiperOrigin-RevId: 585104621
2023-11-24 08:57:59 -08:00
siroberts
bc36553e81 Expose isTrusted property of ControllerInfo.
PiperOrigin-RevId: 585052580
2023-11-24 03:37:33 -08:00
jbibik
c0ef5f6de4 Serialize media3 custom Spans for Cue encoding/decoding
PiperOrigin-RevId: 585028521
2023-11-24 01:32:40 -08:00
ibaker
479344d74e Fix typo in DashManifestParser
PiperOrigin-RevId: 585017285
2023-11-24 00:32:26 -08:00
tonihei
85a54e2e19 Remove redundant ) in Javadoc
PiperOrigin-RevId: 584910697
2023-11-23 09:58:45 -08:00
Copybara-Service
45b51d8c97 Merge pull request #707 from equeim:ffmpeg-6.0
PiperOrigin-RevId: 584893190
2023-11-23 08:06:04 -08:00
samrobinson
aef2fcb900 Plumb EditedMediaItem for audio preview.
PiperOrigin-RevId: 584865962
2023-11-23 05:13:32 -08:00
tonihei
e766666482 Instruct MediaCodec to drop buffers before start time in tunneling mode
We don't get the buffer back after decoding to make a proper decision
about whether dropping the buffer is needed, so we do the next best
thing and tell the codec to drop the buffer if its input timestamp is
less than the intended start time.

PiperOrigin-RevId: 584863144
2023-11-23 04:56:57 -08:00
christosts
2a74cb7ef2 Move VideoFrameProcessor reflective loading code
Move the reflective loading of VideoFrameProcessor from
MediaCodecVideoRenderer to the CompositingVideoSinkProvider. This is so
that all reflective code lives in one place. The
CompositingVideoSinkProvider already has reflective code to load the
default PreviewingVideoGraph.Factory.

PiperOrigin-RevId: 584852547
2023-11-23 03:54:18 -08:00
samrobinson
1524d12634 Avoid using unneeded double ended queue.
These usages have no need for the double ended input functionality. All
other usages across media3 are ConcurrentLinkedQueue.

PiperOrigin-RevId: 584841104
2023-11-23 02:51:20 -08:00
huangdarwin
0f040e6c6e Use static import for Util.formatInvariant.
In OverlayShaderProgram, this method is used quite a lot, and is the only method from Util.java in this file. Marginally reduce complexity by using a static import instead.

PiperOrigin-RevId: 584828455
2023-11-23 01:45:19 -08:00
huangdarwin
dc037b22cd Effect: Flip texture in OpenGL instead of allocating a Bitmap.
Reduce short-lived allocations of potentially large objects, like Bitmap.

Unfortunately, this does make the TextureOverlay interface more messy though, requiring a way to signal whether the texture should be flipped vertically.

PiperOrigin-RevId: 584661400
2023-11-22 10:17:10 -08:00
Rohit Singh
7c939593fe Add change to RELEASENOTES 2023-11-22 16:25:44 +00:00
Alexey Rochev
6332693ce4 Use swr_alloc_set_opts2 function to set SwrContext options 2023-11-22 16:14:47 +00:00
Alexey Rochev
815d93cfa2 Migrate to FFmpeg 6.0
These changes are also compatible with FFmpeg 5.1, which is now minimum supported version.

Also set -Wl,-Bsymbolic flag via target_link_options command which is more correct.
2023-11-22 16:14:47 +00:00
tofunmi
2d77e4d22c Implement trim optimization in Transformer
PiperOrigin-RevId: 584622392
2023-11-22 07:28:34 -08:00
christosts
6435ddb89e Create VideoFrameRenderControl
Split CompositingVideoSinkProvider.VideoSinkImpl in two classes:
- VideoSinkImpl now only receives input from MediaCodecVideoRenderer and
  forwards frames to its connected VideoFrameProcessor
- VideoFrameRenderControl takes composited frames out of the VideoGraph
  and schedules the rendering of those.
- CompositingVideoSinkProvider connects VideoSinkImpl with
  VideoFramesRenderer.

PiperOrigin-RevId: 584605078
2023-11-22 06:05:04 -08:00
bachinger
a063d137b4 Add session extras to the state of the controller
This change adds `MediaController.getSessionExtras()` through
which a controller can access the session extras.

The session extras can be set for the entire session when
building the session. This can be overridden for specific
controllers in `MediaSession.Callback.onConnect`.

PiperOrigin-RevId: 584430419
2023-11-21 14:32:33 -08:00
rohks
1d61c48266 Rollback of 1360548649
PiperOrigin-RevId: 584358604
2023-11-21 10:12:47 -08:00
rohks
1360548649 Handle unsupported format xHE-AAC in FfmpegAudioRenderer
Issue: androidx/media#803
PiperOrigin-RevId: 584333812
2023-11-21 08:34:25 -08:00
huangdarwin
0b22a7a0d8 GL: Move private helper method next to the method that uses it.
In addition to being more readable, this will help future CLs that modify
these methods...

PiperOrigin-RevId: 584323686
2023-11-21 07:52:24 -08:00
huangdarwin
6c68146efa GL demo: Use setColor instead of setARGB
setColor is a bit more readable

PiperOrigin-RevId: 584322875
2023-11-21 07:45:32 -08:00
christosts
ec08db458e MidiExtractor: mark only the first sample as key-frame
This change fixes a bug with seeking forward in MIDI. When seeking forward,
the progressive media period attempts to seek within the sample queue, if a
key-frame exists before the seeking position. With MIDI, however, we can
only skip Note-On and Note-Off samples and all other samples must be sent
to the MIDI decoder.

When seeking outside the sample queue, the MidiExtractor already
instructs the player to start from the beginning of the MIDI input. With
this change, only the first output sample is a key-frame, thus the
progressive media period can no longer seek within the sample queue and
is forced to seek from the MIDI input start always.

Issue: androidx/media#704

#minor-release

PiperOrigin-RevId: 584321443
2023-11-21 07:39:46 -08:00
samrobinson
79fd3365fa Use VolumeScalingAudioProcessor in audio effect preview test.
Dump files changes are easier to understand with a processor that keeps
buffer sizes the same.

PiperOrigin-RevId: 584320606
2023-11-21 07:35:01 -08:00
tonihei
af0282b9db Avoid clipping live offset override to min/max offsets
The live offset override is used to replace the media-defined
live offset after user seeks to ensure the live adjustment adjusts
to the new user-provided live offset and doesn't go back to the
original one.

However, the code currently clips the override to the min/max
live offsets defined in LiveConfiguration. This is useful to
clip the default value (in case of inconsistent values in the media),
but the clipping shouldn't be applied to user overrides as
the player will then adjust the position back to the min/max
and doesn't stay at the desired user position.

See 2416d99857 (r132871601)

#minor-release

PiperOrigin-RevId: 584311004
2023-11-21 06:49:19 -08:00
Copybara-Service
fde142d66e Merge pull request #793 from androidx:mpegh_extractor_changes
PiperOrigin-RevId: 584291984
2023-11-21 05:07:27 -08:00
bachinger
fd81d2a1b2 Use a better sample video for testing
The replaced one had barely no movement and audio in
the first second.

PiperOrigin-RevId: 584283388
2023-11-21 04:21:07 -08:00
Rohit Singh
4c3ca9b6f4 update mhm1 mp4 samples and corresponding extractor dumps 2023-11-21 12:12:23 +00:00
bachinger
ec478138ba Add test case to test position conversion when POSITION_UNKNOWN
PiperOrigin-RevId: 584261559
2023-11-21 02:24:30 -08:00
bachinger
167f50a9ca Return empty timeline when media info is null
Issue: androidx/media#708
PiperOrigin-RevId: 584054624
2023-11-20 09:55:36 -08:00
ibaker
4bcb60d31d Add Cea708Decoder/ParserTest with a single, simple example
PiperOrigin-RevId: 584042033
2023-11-20 09:06:03 -08:00
tianyifeng
89bedf0fb5 Emit onPositionDiscontinuity event when silence is skipped
Issue: androidx/media#765
PiperOrigin-RevId: 584024654
2023-11-20 07:50:13 -08:00
tonihei
5eb6a889a7 Adjust Javadoc
PiperOrigin-RevId: 583965332
2023-11-20 02:54:57 -08:00
rohks
ffbaa090aa Use .test top level domain for test URI
PiperOrigin-RevId: 583951327
2023-11-20 02:00:30 -08:00
rohks
6df240877c Populate MediaMetadata.extras to MediaMetadataCompat
Ensures backward compatibility.

Issue: androidx/media#802
PiperOrigin-RevId: 583425114
2023-11-17 10:25:10 -08:00
claincly
ad96ca3b30 Make vararg APIs more robust
Composition and EditedMediaItemSequence don't allow empty lists in their main
constructors, so shouldn't the vararg API. This is more inline with Effective
Java item 53.

PiperOrigin-RevId: 583415124
2023-11-17 09:51:39 -08:00
andrewlewis
7b9aa87344 Allow allocating more buffers when transmuxing
When transmuxing, the `EncodedSampleExporter` maintains a queue of input
buffers that get filled with encoded data by the asset loader. The number of
buffers was limited to avoid using more and more memory if producer (asset
loader) gets far ahead of the consumer (exporter).

Previously this limit was fixed at 10 buffers, but increasing the number of
buffers can make some transmux operations much faster. Allow allocating between
a min and max number of buffers, and also set a target allocation size beyond
which new buffers can't be allocated. This allows audio formats which require
many small buffers to be processed more quickly, while preventing allocating
too much memory for hypothetical very high bitrate formats.

'Remove video' edits on local videos in particular get much faster, because
audio buffers are very short and there are lots of them. With a sample 10
minute video, a 'remove video' edit took 2 seconds (36 seconds before this
change).  With a sample 1 minute removing video took 0.25 seconds after this
change (2.5 seconds before).

The speed improvement is smaller for other types of edits that retain the video
track. Transmuxing a 10 minute video retaining the video track took 26 seconds
(40 seconds before).

PiperOrigin-RevId: 583390284
2023-11-17 08:11:25 -08:00
ibaker
66c162dabd Fix examples in MediaLibraryInfo javadoc to be realistic
Bugfix releases don't have pre-release cycles.

PiperOrigin-RevId: 583295158
2023-11-17 00:52:10 -08:00
christosts
7dc0654c69 Rollback of eafe2e35f0
PiperOrigin-RevId: 583045154
2023-11-16 08:01:24 -08:00
jbibik
b750ad50f9 Add subtitle parsing support in HLS for TS files
PiperOrigin-RevId: 582714493
2023-11-15 10:00:03 -08:00
samrobinson
d5fbf0007b Migrate to Util.durationUsToSampleCount in transformer audio.
PiperOrigin-RevId: 582700443
2023-11-15 09:15:10 -08:00
lpribanic
64d2210b79 Add DashPlayback test for loading thumbnail grids
This test instantiates an image renderer, selects an image track and
plays a thumbnail grid.

PiperOrigin-RevId: 582696009
2023-11-15 09:03:19 -08:00
jbibik
a667ceb6f9 Test DASH playback with TTML subs muxed into MP4
PiperOrigin-RevId: 582685662
2023-11-15 08:31:31 -08:00
tonihei
310e2edcca Workaround layout problems with Material Design
In some contexts (e.g. BottomSheetDialogFrament), Material Design
themes will override the default of singleLine=false to true. This
causes layout problems because the forward/rewind buttons are no
longer visible with singleLine=true.

This problem can be avoided by explicitly requesting the default
value of false in our layout files.

Issue: androidx/media#511

#minor-release

PiperOrigin-RevId: 582604131
2023-11-15 02:57:03 -08:00
ibaker
bd7615c0b8 Update recommended way to suppress @UnstableApi errors in lint.xml
#minor-release

PiperOrigin-RevId: 582599098
2023-11-15 02:34:40 -08:00
jbibik
94e45eb4ad Migrate CEA-708 logic to a SubtitleParser implementation
This change is similar to 27caeb8038 (CEA-608), but is currently lacking unit tests.

PiperOrigin-RevId: 582585457
2023-11-15 01:38:56 -08:00
jbibik
b23b1bb693 Add HLS support for parsing TTML subs muxed into MP4 during extraction
This removes the flakiness of the HLS playback test as well.

Previously, this flow only worked for standalone WebVTT subtitles (7b762642db)

PiperOrigin-RevId: 582359383
2023-11-14 10:10:44 -08:00
jbibik
67f770a786 Add HLS playback test with TTML subtitles muxed into MP4
The test is hidden behind the `@Ignore` annotation due to some
flakiness. However, it will be removed when the subtitle parsing is
moved to a pre-sample-queue architecture.

The test media was created with:

```shell
$ cp ../../dash/standalone-ttml/sample.xml sample.ttml
$ MP4Box -add sample.ttml sample.text.mp4
$ MP4Box -frag 10000 sample.text.mp4
$ rm sample.ttml
```

PiperOrigin-RevId: 582347113
2023-11-14 09:31:09 -08:00
tonihei
9bf1852069 Set MIME type from IMA SDK on ads MediaItem
This helps to play ads where the file extension is not sufficient
to deduce the correct source in DefaultMediaSourceFactory.

PiperOrigin-RevId: 582340114
2023-11-14 09:12:07 -08:00