21154 Commits

Author SHA1 Message Date
ibaker
551cbadafc Gracefully handle unexpected non-MP3 trailing data
The `bear-cbr-no-seek-table-trailing-garbage.mp3` test file was generated by appending 150kB of `0xDEADBEEF` onto the end of `bear-cbr-variable-frame-size-no-seek-table.mp3`.

Issue: androidx/media#1563

#cherrypick

PiperOrigin-RevId: 670131828
2024-09-02 02:10:13 -07:00
Copybara-Service
854566dbfe Merge pull request #1371 from v-novaltd:dsparano-exo207
PiperOrigin-RevId: 669352191
2024-08-30 09:35:32 -07:00
samrobinson
5eba716410 Add a composition export dump test with a shorter second sequence.
PiperOrigin-RevId: 669348374
2024-08-30 09:20:58 -07:00
sheenachhabra
4e858f7260 Add support for setting last sample duration in Mp4Muxer
PiperOrigin-RevId: 669340763
2024-08-30 08:53:36 -07:00
microkatz
f1654732a6 Added release note for change 2024-08-30 13:47:43 +00:00
sheenachhabra
791483f2d3 Remove TrackMetadataProvider interface
This interface was used by Boxes.moov. This CL removes the interface and just uses the Track object directly.

Since Track is package-private it seems fine to use it directly.
The drawback with interface is that, with every new field addition in the
Track class, we need to update the interface as well (if we need to access that field for moov box).

PiperOrigin-RevId: 669295399
2024-08-30 05:47:07 -07:00
sheenachhabra
613c7a6aa7 Change adjustLastSampleDuration() to getLastSampleDurationVu()
This is a no-op change.

PiperOrigin-RevId: 669283958
2024-08-30 04:55:40 -07:00
dancho
dc9854cc5b Add GlRect helper class
Adds a class that represents an image rectangle
in OpenGL coordinate convention.

android.graphics.Rect puts (0, 0) as the top-left corner:
it enforces `Rect.top <= Rect.bottom` and this matches
`android.graphics.Bitmap` coordinates: docs https://developer.android.com/reference/android/graphics/Rect

This is different from OpenGL coordinates where (0, 0) is
at the bottom-left corner. I.e. GlRect.bottom <= GlRect.top: docs https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glReadPixels.xhtml

The reason for this change is to allow a public API GlRect
getScaledRegion() which selects a region of pixels of a GL texture
to be copied to CPU memory.

PiperOrigin-RevId: 669231826
2024-08-30 01:13:22 -07:00
sheenachhabra
388d1f17b9 Clean up comments in Boxes.java
The CL aims to

1. Shorten unnecessary lengthy chatty comments.
2. Remove dead TODOs.
3. nit fixes for comment style consistency.
4. Remove usage of "we" in the comments.
5. Media3 muxer does not need to mention the behaviour of framework muxer
unless its required for some purpose, so remove them.

PiperOrigin-RevId: 668985875
2024-08-29 10:37:38 -07:00
Copybara-Service
39ed9cf88d Merge pull request #1652 from MiSikora:ms/vtt-speaker
PiperOrigin-RevId: 668976037
2024-08-29 10:08:13 -07:00
Ian Baker
c78ac6e784 Remove intdef value list from javadoc 2024-08-29 16:45:10 +01:00
Copybara-Service
68f55461c0 Merge pull request #1659 from colinkho:drm-util
PiperOrigin-RevId: 668919756
2024-08-29 06:51:13 -07:00
kimvde
37561c829f Fix and refactor logic to remove all frames in ExternalTextureManager
The existing logic was not working sometimes because:

1. The repeated scheduling in releaseAllFramesFromMediaCodec was
starving the thread on which the SurfaceTexture frameAvailableListener
was called.

2. The case where a pending frame arrives on the surface after flush
finishes executing was not handled.

The consequence of both problems is that availableFrameCount ended up
being > pendingFrames.size().

PiperOrigin-RevId: 668916256
2024-08-29 06:37:20 -07:00
Copybara-Service
e30161656e Merge pull request #1667 from JaroslavHerber:patch-1
PiperOrigin-RevId: 668905162
2024-08-29 05:57:59 -07:00
tonihei
41a56daab7 Code formatting 2024-08-29 13:48:41 +01:00
Colin Kho
a509033a5c Correct grammar and format javadoc on DrmUtil.executePost 2024-08-29 13:19:27 +01:00
Colin Kho
4ee34cc00e Refactor HttpMediaDrmCallback's executePost into a shared utility method within DrmUtil 2024-08-29 13:19:27 +01:00
Jaro
02fa4b0f9c Remove obsolete semicolon 2024-08-29 12:25:19 +01:00
ibaker
05cbbffbd7 Add a space in the ParserException message
PiperOrigin-RevId: 668870991
2024-08-29 03:51:40 -07:00
kimvde
3587afc9d7 Move CompositionPlayerSeekTest out of performance directory
These tests do not test performance. Moving them out of this directory
ensures they are run on emulators and on more than 1 physical device.

PiperOrigin-RevId: 668859017
2024-08-29 03:14:12 -07:00
Ian Baker
4d9ad5a6e0 Add release note 2024-08-29 10:27:10 +01:00
Ian Baker
a4aa975a26 Reformat and tweak javadoc 2024-08-29 10:25:06 +01:00
Michał Sikora
cd47e2a134 Remove redundant test 2024-08-29 10:25:06 +01:00
Michał Sikora
24bbe6d921 Rename VTT voice span speakerName to name 2024-08-29 10:25:06 +01:00
Michał Sikora
ce52fc77ec Remove VTT voice span classes 2024-08-29 10:25:06 +01:00
Michał Sikora
108a5ca2f5 Remove language span marker interface 2024-08-29 10:25:06 +01:00
Michał Sikora
d6f08a6237 Add VTT voice spans to cues 2024-08-29 10:25:06 +01:00
tonihei
e8664dbc8e Report initial discontinuity for DASH periods that require preroll
DASH periods don't have to start at the beginning of a segment. In
these cases, they should report an initial discontinuity to let the
player know it needs to expect preroll data (e.g. to flush renderers)

This information is only available in the ChunkSampleStream after
loading the initialization data, so we need to check the sample
streams and tell them to only report discontinuities at the very
beginning of playback. All other position resets are triggered by
the player itself and don't need this method.

Issue: androidx/media#1440
PiperOrigin-RevId: 668831563
2024-08-29 01:57:15 -07:00
kimvde
8367e420ad Import correct nullable annotation
PiperOrigin-RevId: 668521379
2024-08-28 10:54:29 -07:00
dancho
5c2dc7ed4e Add ByteBufferGlEffect.Image for easier format conversion
PiperOrigin-RevId: 668506831
2024-08-28 10:22:01 -07:00
kimvde
070e8217ac Report swallowed exceptions in ExternalTextureManager
The error was swallowed if
ExternalTextureManager.removeAllSurfaceTextureFrames was throwing.

PiperOrigin-RevId: 668480565
2024-08-28 09:14:53 -07:00
tianyifeng
c2e81052e8 Fix flakiness in ExoPlayerTest
In the flaky test `ExoPlayerTest.loading_withLargeAllocationCausingOom_playsRemainingMediaAndThenThrows`, it is indeterministic that when the message `MSG_IO_EXCEPTION` from the loader thread will arrive on the playback looper. If it arrives after `MSG_PERIOD_PREPARED`, then the period can continue loading and get the three samples written to the `SampleQueue` before the intentional OOM surfacing to the `ExoPlayerImplInternal`, otherwise, the OOM will be detected by `ExoPlayerImplInternal` very early and the player disallows to load three samples, which will cause the assertion to fail.

As we are expecting the three samples to play until the playback fails, we should assume that the `Loader` encounters the OOM after those samples loaded, thus we need to put this trigger a bit later until the `SampleStreamItem`s are handled by the `FakeSampleStream`. This could be checked by the return value of `FakeMediaPeriod.continueLoading` (super class implementation). However, `FakeMediaPeriod.continueLoading` originally always returns `true`, which is not aligned with the javadoc of `MediaPeriod.continueLoading`:

"return `true` if progress was made, meaning that `getNextLoadPositionUs()` will return a different value than prior to the call, `false` otherwise."

then we should also modify that logic.

PiperOrigin-RevId: 668438316
2024-08-28 07:16:29 -07:00
microkatz
0ac26c4004 Format with google-java-format 2024-08-28 12:41:49 +00:00
Daniele Sparano
7473156853 Fix output pixel aspect ratio and add test for it 2024-08-28 12:41:49 +00:00
Daniele Sparano
f0463bff8a Set pixel aspect ratio from output media format if set 2024-08-28 12:41:49 +00:00
samrobinson
9c5ea4f1ba Assert silent bytes are 0 in AudioGraphInputTest
PiperOrigin-RevId: 668403467
2024-08-28 05:18:37 -07:00
samrobinson
84f4c7bbcc Create and assert against dump files in ParameterizedAudioExportTest.
PiperOrigin-RevId: 668002146
2024-08-27 08:43:27 -07:00
sheenachhabra
ebd60acc95 Rename LAST_FRAME_DURATION_BEHAVIOR to LAST_SAMPLE_DURATION_BEHAVIOR
The original idea was to set duration for the last video frame, but this behavior actually applies to all tracks.

PiperOrigin-RevId: 667990099
2024-08-27 08:08:25 -07:00
tonihei
d0676245b5 Add AnalyticsListener.onRendererReadyChanged
This callback allows listeners to track when individual renderers
allow or prevent playback from being ready. For example, this is useful
to figure out which renderer blocked the playback the longest.

PiperOrigin-RevId: 667970933
2024-08-27 07:08:42 -07:00
claincly
36d61000fd Reorder the assetions in tests
So it's more clear what's actually broke in the error log.

PiperOrigin-RevId: 667964963
2024-08-27 06:43:58 -07:00
kimvde
a4d0735d4c Fix player hanging when seeking at MediaItem transition
Before this CL, the video sink was stuck if a flush was executed:
- after VideoSink.onInputStreamChanged, which is setting
  pendingInputStreamBufferPresentationTimeUs and
- before the previous stream was fully rendered.

This is because pendingInputStreamBufferPresentationTimeUs was not reset
to TIME_UNSET when flushing the sink, so that the sink was still waiting
for the last frame of the previous stream to be rendered in
handleInputFrame/Bitmap.

PiperOrigin-RevId: 667924517
2024-08-27 04:00:46 -07:00
dancho
c4930c4bb6 Default to OpenGL 3.0 context in DVFP
OpenGL ES 3.0 likely can be used since Android 18.
Moving to a higher version context more often can make
sharing GL context easier for apps

PiperOrigin-RevId: 667915331
2024-08-27 03:23:54 -07:00
dancho
563eb963fd Make ByteBufferConcurrentEffect asynchronous
* Changes to GlUtil to manage Pixel Buffer Objects and asynchronous
GPU -> CPU glReadPixels
* Make ByteBufferConcurrentEffect non-blocking

PiperOrigin-RevId: 667908805
2024-08-27 02:58:51 -07:00
sheenachhabra
52aeffbb3b Remove TODO for empty samples in muxer
There is no reason to write the empty samples so keep
the behaviour same as MediaMuxer

PiperOrigin-RevId: 667495861
2024-08-26 01:28:13 -07:00
claincly
2b031484fe Allow looping sequences in CompositionPlayer
PiperOrigin-RevId: 666793658
2024-08-23 07:54:13 -07:00
dancho
ee93a9832e Add ByteBufferGlEffect for easier non-GPU video effects
* new ByteBufferGlEffect GlEffect that enables API users to
implement an effect that accesses video frame data via CPU-mapped ByteBuffer
* ByteBufferConcurrentEffect responsible for reading
video frame data in CPU-accessible ByteBuffer

PiperOrigin-RevId: 666375594
2024-08-22 09:18:32 -07:00
tianyifeng
829cad6912 Bump media3 version to 1.4.1
#cherrypick

PiperOrigin-RevId: 666347191
2024-08-22 07:49:33 -07:00
kak
0060ff2028 Automated Code Change
PiperOrigin-RevId: 666338281
2024-08-22 07:19:57 -07:00
tianyifeng
1994ccdea8 Update release notes for 1.4.1 bug fix release
#cherrypick

PiperOrigin-RevId: 666328660
2024-08-22 06:45:59 -07:00
dancho
6e0e2d0cee Add QueuingGlShaderProgram for effects that run outside GL context
Implement a QueuingGlShaderProgram which queues up OpenGL frames and allows
asynchronous execution of effects that operate on video frames without a
performance penalty.

PiperOrigin-RevId: 666326611
2024-08-22 06:38:28 -07:00