20226 Commits

Author SHA1 Message Date
okunhardt
250fc80419 Move HttpEngineDataSource to the DataSource library.
Since HttpEngineDataSource does not have any external dependencies, it does not need to be in its own package.

PiperOrigin-RevId: 592623750
2023-12-20 12:10:36 -08:00
Googler
e25e497227 Make DefaultDecoderFactory try multiple formats before giving up
PiperOrigin-RevId: 592622544
2023-12-20 12:07:19 -08:00
tonihei
98519931e7 Split creation of AudioCapabilitiesReceiver from instance access
getAudioCapabilities currently creates the receiver and returns
the current capabilities. This is error-prone because the
capabilities are also available as a class field.

This can made cleaner by letting the method just create the receiver
and all access to the capabilities can be made via class field.

PiperOrigin-RevId: 592591590
2023-12-20 10:12:27 -08:00
ibaker
770ca66fbc Fix HLS CEA-608 when parsing during extraction
HLS distinguishes between 'subtitles' (WebVTT or TTML distributed in
separate files with their own playlist) and 'captions' (CEA-608 or 708,
distributed muxed into the video file).

The format transformation added in 7b762642db
only applies to subtitles and not captions. This change makes the same
transformation for caption formats.

This resolves an error like:

```
SampleQueueMappingException: Unable to bind a sample queue to TrackGroup with MIME type application/cea-608.
```

Also add two playback tests for HLS CEA-608, one that parses during
decoding (old way) and one during extraction (new way). Adding these
tests is what alerted me to this issue.

PiperOrigin-RevId: 592571284
2023-12-20 08:52:39 -08:00
tofunmi
4ce47ccdd3 MuxerWrapper: remove unnecessary volatiles
PiperOrigin-RevId: 592569012
2023-12-20 08:37:03 -08:00
tonihei
59f01388a6 Use platform constants for PCM 24/32 bit encoding
These constants are used when setting up the AudioTrack
and should match the definition in the platform.

PiperOrigin-RevId: 592564644
2023-12-20 08:16:35 -08:00
ibaker
8b9bf5e7cd Add DASH CEA-608 playback test
This was generated by combining the existing `ts/bbb_2500ms.ts` test
asset and a temporary `.srt` file using
https://cloud.google.com/transcoder/docs/how-to/captions-and-subtitles

This doesn't directly reproduce the problem fixed by
7ca26f898d,
because the CEA-608 subs are structured differently to the stream I
discovered the problem with (from Issue: androidx/media#887). However this test
does fail if that fix is reverted after
486230fbd7.

I'm also not able to repro the character duplication reported in
Issue: androidx/media#887 by just changing the manifest in this CL. I'm not yet
sure on the exact differences between the stream provided on GitHub
and this stream.

This stream does provide some regression protection, because it
currently fails with 'new' subtitle parsing
(`DashMediaSource.Factory.experimentalParseSubtitlesDuringExtraction(true)`),
though I'm not sure on the exact reason for that yet.

PiperOrigin-RevId: 592476328
2023-12-20 01:13:21 -08:00
bachinger
36b7a49d52 Use factory to create media period holders in the queue
This is a refactoring that allows the `MediaPeriodQueue` to
create media period holders without all the collaborators
being passes in to `enqueueNextMediaPeriodHolder(...)`.

The factory is presumably also helpful in unit test to
know whether and when exactly a holder is created in
the preloading process.

PiperOrigin-RevId: 592301400
2023-12-19 11:55:13 -08:00
ibaker
486230fbd7 Throw a clear error from Cea608/708Parser.parseToLegacySubtitle
This would have immediately exposed the mistakes fixed by
7ca26f898d

Issue: androidx/media#904
PiperOrigin-RevId: 592244943
2023-12-19 08:34:37 -08:00
bachinger
8940900c69 Optimize short form content demo app
PiperOrigin-RevId: 592225900
2023-12-19 07:08:27 -08:00
ibaker
7ca26f898d Fix 'legacy' CEA-608 and CEA-708 to use the Decoder impls
We deliberately left `Cea608Decoder` and `Cea708Decoder` intact when
creating the respective `SubtitleParser` implementations (in
27caeb8038
and
94e45eb4ad
respectively).

However we didn't correctly change the behaviour of
`SubtitleDecoderFactory.DEFAULT` in order to use these 'legacy'
implementations. We firstly left the `Cea608Decoder` instantiation
**after** the `DefaultSubtitleParserFactory.supportsFormat()` check,
meaning that code would never be reached (since `supportsFormat` now
returns true for CEA-608). Then in the second change (which was supposed
to only be about CEA-708) we removed all instantiations of **both**
`Cea608Decoder` and `Cea708Decoder`. This change puts the decoder
instantiations back and moves them above the
`DefaultSubtitleParserFactory.supportsFormat` check, meaning they will
be used in preference to `DelegatingSubtitleDecoder`.

This resolves the immediately-disappearing subtitles tracked by
Issue: androidx/media#904.
PiperOrigin-RevId: 592217937
2023-12-19 06:32:36 -08:00
tonihei
e10f96d6a6 Make some DefaultRenderersFactory methods final
These methods are just setters and not meant to be overridden.

PiperOrigin-RevId: 592193857
2023-12-19 04:38:57 -08:00
ibaker
6853ffccae Add container to Format.toLogString
While investigating Issue: androidx/media#887 I naively assumed the CEA-608
captions were in a TS file, but they're actually in an MP4 (which is
possibly obvious given DASH only supports MP4). This change includes
container info in the `EventLogger` `tracks` output.

PiperOrigin-RevId: 592192752
2023-12-19 04:33:58 -08:00
ibaker
0b8a9a2ca4 Add Widevine license renewal example to demo app
PiperOrigin-RevId: 592182371
2023-12-19 03:49:43 -08:00
christosts
3bb233a911 Misc clean-ups in ImageRenderer
Add some missing empty lines and use checkStateNotNull() everywhere.

PiperOrigin-RevId: 592173300
2023-12-19 03:06:29 -08:00
tofunmi
087c07e596 Rename OptimizationResult options
Rename options to be more accurate of what they capture

PiperOrigin-RevId: 592155563
2023-12-19 01:50:40 -08:00
tonihei
e5aa69237e Use CRYPTO_ASYNC mode for video from API 34
This allows us to remove the additional thread we create
for asynchronous buffer queuing and use a synchronized
queueing approach again.

This API looks strictly beneficial on all tested devices,
but since this code path in MediaCodec has not been used
widely, we leave an opt-out flag for now.

PiperOrigin-RevId: 591867472
2023-12-18 05:32:40 -08:00
sheenachhabra
bb7aa2fb19 Update updateMetadataEntries() method javadoc
PiperOrigin-RevId: 591858840
2023-12-18 04:45:35 -08:00
tonihei
b7c3d83e51 Forward setParameters to AsynchronousMediaCodecBufferEnqueuer
The parameters may change the decoding behavior of the
following samples and it's suprising/wrong to apply them
from another thread where we can't guarantee from which
sample they apply.

PiperOrigin-RevId: 591808760
2023-12-18 00:37:21 -08:00
huangdarwin
236bad5597 Add access control modifier to variable.
PiperOrigin-RevId: 591302601
2023-12-15 10:57:53 -08:00
huangdarwin
bde56b6b43 Effect: Move inputColorInfo javadoc to registerInputStream.
Oops, I forgot to move these in the earlier change, http://<unknown commit>.

PiperOrigin-RevId: 591300964
2023-12-15 10:52:22 -08:00
sheenachhabra
1303bfbc7c Set language field when creating MediaFormat from a Format
Currently Transformer simply omits the language field from the input
media file when writing data to the output file.

PiperOrigin-RevId: 591287481
2023-12-15 10:06:38 -08:00
huangdarwin
7579693739 Effect: Move VideoFrameProcessor inputColorInfo interface to FrameInfo.
Move `inputColorInfo` from `VideoFrameProcessor`'s `Factory.create` to `FrameInfo`,
input via `registerInputStream`.

Also, manually tested on exoplayer demo that setVideoEffects still works.

PiperOrigin-RevId: 591273545
2023-12-15 09:17:39 -08:00
tonihei
f47c4e33ec Remove experimental synchronization on async buffer queuing
PiperOrigin-RevId: 591273508
2023-12-15 09:14:52 -08:00
bachinger
29d7dd1ec9 Keep selections for preloaded adaptive sample streams
When an adaptive source has been preloaded, the track selection
of the player should possibly not override the preloaded selection
to avoid discarding preloaded data.

PiperOrigin-RevId: 591256334
2023-12-15 08:09:22 -08:00
lpribanic
1096ae9145 Write empty image byte arrays to sample queue
The number of empty image byte arrays written is one less than the
total number of tiles in the image. The empty byte arrays act as
placeholders for individual tiles inside ImageRenderer.

PiperOrigin-RevId: 591231432
2023-12-15 06:18:54 -08:00
claincly
7e65cce967 Fix first frame not force rendered
This is because currently

1. Player sets a surfaceView to render to
2. Player intializes the renderer
3. MCVR initializes the VideoSinkProvider, by extension VideoGraph

But when 1 happens, MCVR doesn't set the surfaceView on the VideoGraph because
it's not initialized. Consequently after VideoGraph is initialized, it doesn't
have a surface to render to, and thus dropping the first a few frames.

Also adds a test for first frame to verify the correct first frame is rendered.

PiperOrigin-RevId: 591228174
2023-12-15 06:01:12 -08:00
christosts
7df3e9e779 Integrate ImageRenderer with composition preview
PiperOrigin-RevId: 591218013
2023-12-15 05:01:50 -08:00
rohks
7f6596bab2 Fix sending negative bufferedDurationUs to CmcdData.Factory
When track is changed during playback, `playbackPositionUs` may be in middle of a chunk and `loadPositionUs` should be the start of that chunk. In this situation `loadPositionUs` can be less than the current `playbackPositionUs`, resulting into negative `bufferedDurationUs`. It translates to having no buffer and hence we should send `0` for `bufferedDurationUs` when creating new instances of `CmcdData.Factory`.

Issue: androidx/media#888

#minor-release

PiperOrigin-RevId: 591099785
2023-12-14 17:39:41 -08:00
huangdarwin
0baf777c96 Effect: Release FinalShaderProgramWrapper when releasing DVFP.
Otherwise, there's a memory leak of ~30MB, as this is never released.

This likely used to be considered released as part of what now became
`intermediateGlShaderPrograms`, but its release was missed after we split
`finalShaderProgramWrapper` out from the larger glShaderProgram list.

PiperOrigin-RevId: 590954785
2023-12-14 08:59:38 -08:00
ibaker
7399b7c5ce Remove @Beta comments that should have been removed in 0a016b59f7
PiperOrigin-RevId: 590940876
2023-12-14 08:04:23 -08:00
huangdarwin
97e9ed3f7b Effect: Move inputColorInfo usage to registerInputStream.
To prepare to move `inputColorInfo` from `VFP.Factory.create` to
`VFP.registerInputStream`, move all usage of `inputColorInfo` to be *after*
`registerInputStream`.

To do this, defer creation of `externalShaderProgram` instances, which require
`inputColorInfo`. However, we must still initialize `InputSwitcher` and OpenGL
ES 3.0 contexts in the VFP create, to create and request the input surface from
ExternalTextureManager.

PiperOrigin-RevId: 590937251
2023-12-14 07:50:04 -08:00
tonihei
01578780a6 Use different wraparound assumptions for duration readers
The timestamp adjuster also estimates the number of wraparounds
of the 90Khz TS timestamp. It does that by assuming that a new
timestamp is always close to the previous one (in either direction).

This logic doesn't always work for duration estimates because the
timestamp at the end of the media is not close to the one at the
beginning and it may also never be less than the one at the beginning.

This can be fixed by introducing a new estimation model that assumes
the new timestamp is strictly greater than the previous one without
making the assumption that it has to be close to it.

Issue: androidx/media#855

#minor-release

PiperOrigin-RevId: 590936953
2023-12-14 07:47:11 -08:00
bachinger
4974f960e7 Fix broadcasting notifyChildrenChanged for legacy controllers
When broadcasting a notifyChildrenChanged event, the task for legacy
controllers was sent to the broadcasting callback. This would
technically work, but because the subscription list is maintained
with specific controllers, the broadcast controller isn't subscribed
and hence the call wasn't executed.

This change calls the overloaded method for a specific controller
for each connected controller. Making sure (only) subscribed
controllers are notified.

Issue: androidx/media#644
PiperOrigin-RevId: 590904037
2023-12-14 05:20:39 -08:00
samrobinson
84471813b6 Update TODO internal bug number.
PiperOrigin-RevId: 590884408
2023-12-14 03:43:16 -08:00
Copybara-Service
ab296ef686 Merge pull request #753 from stevemayhew:p-fix-issue-9347
PiperOrigin-RevId: 590862514
2023-12-14 02:05:35 -08:00
lpribanic
d52772dff8 Set image tile counts to what the manifest says
Vertical and horizontal tile counts inside Format used by ImageRenderer
used to be required to equal 1 and were set to 1 regardless of what
the manifest said.

This change removes the above requirement and sets the tile counts to
the values from the manifest.

PiperOrigin-RevId: 590608353
2023-12-13 08:37:06 -08:00
lpribanic
b1d65f6d00 Amend javadocs for ImageOutput methods
PiperOrigin-RevId: 590607537
2023-12-13 08:33:55 -08:00
ibaker
9a766161ee Combine 'matching' versions in media3 bug template
#minor-release

PiperOrigin-RevId: 590586491
2023-12-13 07:14:21 -08:00
tonihei
7a702870f6 Add test and release notes 2023-12-13 14:48:35 +00:00
Steve Mayhew
64840159d6 Fixes issue #9347 - jump to live on seek to 0
Using 0 as the unset prepare position is the root cause of a number of issues,
as outliine in the ExoPlayer issue https://github.com/google/ExoPlayer/issues/7975

The premise of this fix is that once the prepare override is used (the initial call
to `selectTracks()`) it is never needed again, so simply invalidate it after use.
2023-12-13 14:48:35 +00:00
huangdarwin
a15dfd75be GL: Request OpenGL ES 3.0 context on API 29+, with fallback to 2.0.
Despite GL 3.0 not being required on API 29+, it is experimentally
determined to always be supported on our testing devices, on API 29+.

That said, still fall back to OpenGL 2.0 if 3.0 is not supported,
just in case.

PiperOrigin-RevId: 590569772
2023-12-13 06:01:08 -08:00
tofunmi
2fa5430417 Update OptimizationResult to specify different reasons for abandonment
PiperOrigin-RevId: 590530694
2023-12-13 03:22:55 -08:00
ibaker
6aeaad26ad Clean-up multi-line strings in YAML issue templates
* If we don't want any newlines in the result, it's better to use `>`
* If we want newlines (e.g. for markdown) then we should ensure the
  string **only** contains the newlines we want, because GitHub (unlike
  other markdown renderers) preserves single newlines in the output,
  leading to ugly newlines dictated by the source.

Also remove a markdown-style link that isn't renderered as markdown.

PiperOrigin-RevId: 590309749
2023-12-12 13:11:51 -08:00
tofunmi
37def3679f Trim optimization: fallback on format mismatches
Manual testing: tested manually with pixel 4a

PiperOrigin-RevId: 590284361
2023-12-12 11:53:43 -08:00
sheenachhabra
ee1147ffe1 Remove unused method from TrackMetadataProvider interface
PiperOrigin-RevId: 590242668
2023-12-12 10:01:46 -08:00
Copybara-Service
f465efeefd Merge pull request #864 from v-novaltd:dsparano-exo129_2
PiperOrigin-RevId: 590234505
2023-12-12 09:37:41 -08:00
ibaker
5580b78b13 Fix VorbisComment.populateMediaMetadata key comparison to ignore case
Issue: androidx/media#876

#minor-release

PiperOrigin-RevId: 590215918
2023-12-12 08:43:02 -08:00
tonihei
8e33fbd536 Deprecate RAW_RESOURCE_SCHEME and util method
It's better to use the generic Android resource scheme which
is at least as powerful as our own one.

Issue: androidx/media#868
PiperOrigin-RevId: 590168919
2023-12-12 05:34:09 -08:00
Copybara-Service
27f437b65a Merge pull request #867 from equeim:ndk-r26
PiperOrigin-RevId: 590142275
2023-12-12 03:48:08 -08:00