19093 Commits

Author SHA1 Message Date
tonihei
3d4bd7ce19 Make MediaItems updateable
This changes all MediaSources in our library to allow updates to
their MediaItems (if supported).

Issue: google/ExoPlayer#9978
Issue: androidx/media#33
PiperOrigin-RevId: 546808812
2023-07-13 15:26:30 +01:00
ibaker
a8520bdee6 Clarify that new ConditionVariable instances are closed
#minor-release

PiperOrigin-RevId: 546803592
2023-07-13 15:25:15 +01:00
bachinger
175c64a07b Track controllers that don't await the connection
This removes some stack traces in unit tests when a
`RemoveMediaController` was created with `waitForConnection=false`
in which case the missing controller in the
`MediaControllerProviderService` caused a `NullPointerException`.

PiperOrigin-RevId: 546795181
2023-07-13 15:24:12 +01:00
claincly
9c74e78f33 Revert DefaultCodec to final
The class is made non-final for a test in 12584fbb20.

PiperOrigin-RevId: 546718462
2023-07-13 15:23:07 +01:00
jbibik
ca483a3c2c SubripParser implementation - moved from SubripDecoder
`SubripDecoder` which used to be `SimpleSubtitleDecoder` will now be called `SubripParser` and implement `SubtitleParser` interface. For backwards compatibility, we will have the same functionality provided by `DelegatingSubtitleDecoder` backed-up by a new `SubripParser` instance.

PiperOrigin-RevId: 546538113
2023-07-13 15:21:55 +01:00
jbibik
377d8edf9c SsaParser implementation - moved from SsaDecoder
`SsaDecoder` which used to be `SimpleSubtitleDecoder` will now be called `SsaParser` and implement `SubtitleParser` interface. For backwards compatibility, we will have the same functionality provided by `DelegatingSubtitleDecoder` backed-up by a new `SsaParser` instance.

PiperOrigin-RevId: 546336035
2023-07-13 15:20:34 +01:00
jbibik
e1e956cdf3 DelegatingSubtitleDecoder wrapper for SubtitleParser
`DelegatingSubtitleDecoder` is a `SimpleSubtitleDecoder` that delegates to a `SubtitleParser` instance (e.g. future implementations like `WebvttParser`, `SubripParser`, `SsaParser`, `DvbParser` etc)

It will be in the `exoplayer` package, rather than `extractor` and only be used in the decoding flow which happens after SampleQueue (and to be deprecated). When this decoding flow is deprecated and removed, the class can be later deleted.

PiperOrigin-RevId: 546317528
2023-07-13 15:19:18 +01:00
huangdarwin
cd0b45092e Test: Rename bitmap test method from Current to Focused GlFrameBuffer
Frame buffers are focused, not current. EGL Contexts may be current but this
is a prerequisite for focusing a framebuffer, and this alone isn't
sufficient to make a bitmap.

Clear this up as it can make some complex tests harder to understand, if the
methods needed don't match up in naming.

PiperOrigin-RevId: 546305118
2023-07-13 15:15:34 +01:00
andrewlewis
a0bc8d95c2 Improve texture asset loader documentation
Add documentation for threading requirements at the class level (in
addition to existing documentation on the methods) to improve
discoverablility. Also fix a couple of nits in the javadoc (US English
spelling, avoid passive voice) and in `OnInputFrameProcessedListener`.

PiperOrigin-RevId: 546303732
2023-07-13 15:14:21 +01:00
huangdarwin
4adb5d771e Effect: Remove obsolete TODO
PiperOrigin-RevId: 546285094
2023-07-13 15:13:02 +01:00
bachinger
a884186e58 Add android unit test for setting playback speed of a legacy session
PiperOrigin-RevId: 546282819
2023-07-13 15:11:57 +01:00
huangdarwin
0b7d9a945c GL: Log error for checkGlError when no gluErrorString is present.
Otherwise, errors like `GL_INVALID_FRAMEBUFFER_OPERATION` will only
report a `null` error string, instead of the proper error string.

PiperOrigin-RevId: 546273328
2023-07-13 15:10:48 +01:00
tonihei
d4c5414eff Use Clock in audio renderers and sinks
This makes tests more realistic because the returned value matches
the rest of the simulated test time.

It also prevents test flakiness in (yet to be written) tests that
may not correctly advance the playback time in the position tracker.

PiperOrigin-RevId: 546011842
2023-07-13 15:09:37 +01:00
tonihei
a9be9caf40 Ensure SampleQueue seek only happens if needed
When selecting progressive and HLS tracks, we currently check if
we can either seek in the existing samples or are starting from the
beginning of the stream. In both cases, we don't need to reload the
stream and can continue reading.

Seeking to the beginning isn't side-effect free though because it
also sets the startTimeUs to zero. Whether a seek to the beginning
is successful also depends on whether we already loaded a sample or
not. This mean that the startTimeUs value is set (or not set) based
on the speed of the Loader thread even for the same input starting
from the beginning. This race condition means the actual samples
we write to the stream may differ if the stream has initial samples
with negative timestamps.

We can avoid this race condition by checking if the queue is empty
first, so that we only call seekTo if really needed.

PiperOrigin-RevId: 546010951
2023-07-13 15:08:27 +01:00
andrewlewis
1ef7579f5c Fix stale javadoc
The method no longer returns anything. We don't need javadoc for this as it's
default visibility.

PiperOrigin-RevId: 545981702
2023-07-13 15:07:17 +01:00
claincly
50c6efe95d Rename SamplePipeline to SampleExporter
PiperOrigin-RevId: 545974776
2023-07-13 15:06:10 +01:00
huangdarwin
99a143a74e Transformer: Add 8k disabling workaround to avoid timeouts.
PiperOrigin-RevId: 545970477
2023-07-13 15:04:59 +01:00
andrewlewis
bdbf3e29a1 Fix incorrect class name for MediaPipe demo
Issue: androidx/media#500

#minor-release

PiperOrigin-RevId: 545942450
2023-07-13 15:03:46 +01:00
ibaker
06a791620e Update TODO link for shrinking workaround in DefaultExtractorsFactory
PiperOrigin-RevId: 545930708
2023-07-13 15:02:33 +01:00
tonihei
2250ffe6c8 Change multidex dependency type to androidTestImplementation
This is only needed for instrumentation tests and should not
be included in regular builds.

#minor-release

Issue: androidx/media#499
PiperOrigin-RevId: 545913113
2023-07-13 15:01:22 +01:00
claincly
372cd7f952 Remove unused constructor parameter
PiperOrigin-RevId: 545909062
2023-07-13 15:00:12 +01:00
tonihei
c6e7c54140 Release surface in e2etests
Robolectric writes warnings to the log output because the Surfaces
we create are not released and pollute the test environment. This
causes performance issues if tests are run repeatedly.

PiperOrigin-RevId: 545906757
2023-07-13 14:58:55 +01:00
tonihei
c66adfeaaf Add customization option to disable same-release-time skipping
We have the optimization to skip buffers if the release time is
exactly the same as the one for the previous buffer. This makes
sense under the assumption that these buffers get released to
a visible Surface and will be ignored anyway.

However, it's also helpful to provide a customization option to not
do this for cases where the outputting MediaCodecAdapter is not
directly talking to a visible Surface or for tests where we can't
fully control the vsync timing of the Surface and want to ensure
we output all samples that are meant to be shown.

PiperOrigin-RevId: 545906113
2023-07-13 14:57:41 +01:00
Googler
5050171ff6 Rename "useHdr" to "useHighPrecisionColorComponents."
BaseGlShaderProgram and SingleFrameGlShaderProgram are technically color space agnostic. useHdr is passed to the TexturePool, which only uses the value to choose between high/regular precision. useHdr is therefore a bit misleading and should be generalized to "useHighPrecisionColorComponents."

PiperOrigin-RevId: 545726629
2023-07-13 14:56:37 +01:00
claincly
2b8c01de47 Remove stale TODO
PiperOrigin-RevId: 545711472
2023-07-13 14:55:23 +01:00
tonihei
63331dbd1b Use Clock in video renderers
This makes tests more realistic because the returned value matches
the rest of the simulated test time.

It also prevents test flakiness in (yet to be written) tests that
may accidentally drop output buffers or calculate the wrong values.

PiperOrigin-RevId: 545690008
2023-07-13 14:54:10 +01:00
rohks
07d4e5986b Replace BitArray.skipBytes() with BitArray.skipBits()
Based on the spec, ETSI TS 102 366 V1.4.1 Annex F, 6 bits should have skipped instead of 6 bytes.

This correction was pointed out in Issue: androidx/media#474.

PiperOrigin-RevId: 545658365
2023-07-13 14:52:54 +01:00
huangdarwin
7a368b9a11 Effect: Remove GlTextureInfo accessor methods.
The extra check was a bit excessive, especially as it's called multiple times
per frame.

PiperOrigin-RevId: 545657102
2023-07-13 14:51:38 +01:00
michaelkatz
11dec52b6a Update build.gradle dependencies for lib-ui tests
This was missed in abd1c006fc

PiperOrigin-RevId: 545654091
2023-07-05 14:01:47 +00:00
huangdarwin
756845426b HDR: Add SM-X900 to HLG10 tone mapping blocklist.
PiperOrigin-RevId: 545647083
2023-07-05 13:59:58 +00:00
huangdarwin
fa781782da Effect: Share ExecutorService and thread between VFP instances.
This allows us to simplify and reduce thread initialization, hops and the
synchronization cost associated with them, especially when more and more VFPs
are used.

PiperOrigin-RevId: 545622169
2023-07-05 13:58:43 +00:00
michaelkatz
5737e415b8 Cache rawPlaybackHeadPosition across reset due to track transition
Upon track transition of offloaded playback of gapless tracks, the framework will reset the playback head position. The AudioTrackPositionTracker must be made to expect the reset and cache accumulated sum of rawPlaybackHeadPosition.

#minor-release

PiperOrigin-RevId: 545602979
2023-07-05 13:57:29 +00:00
tonihei
aa57d48347 Add MediaSource.canUpdateMediaItem/updateMediaItem
This allows MediaSources to accept MediaItem updates after creation.

This CL adds the handling and plumbing logic in `ExoPlayerImpl`,
`ExoPlayerImplInternal`, `MediaSourceList` and `MaskingMediaSource`.

It also updates all forwarding/wrapping sources to forward these calls
to their wrapped instance.

The actual functionality is only added to `FakeMediaSource` instances in
tests so far.

PiperOrigin-RevId: 545450210
2023-07-05 09:21:22 +00:00
samrobinson
c33a17d89c Wrap AudioSamplePipeline input and processing within AudioGraph.
This is a no-op refactor.

PiperOrigin-RevId: 545421300
2023-07-05 09:20:12 +00:00
kimvde
8ea79a13f9 Add a TODO to make TransformationRequest.Builder package private
PiperOrigin-RevId: 545400150
2023-07-05 09:19:06 +00:00
ibaker
3456382ae7 Include timing info in some SCTE-35 toString implementations
This was helpful in investigating Issue: androidx/media#471

PiperOrigin-RevId: 545393217
2023-07-05 09:18:00 +00:00
kimvde
81c83e4213 Remove HDR modes from TransformationRequest
PiperOrigin-RevId: 545352306
2023-07-05 09:16:52 +00:00
michaelkatz
de4575da28 Add nanoTime method to Clock to support overriding System.nanoTime()
#minor-release

PiperOrigin-RevId: 545237925
2023-07-05 09:15:49 +00:00
ibaker
a783d704b2 Add duration to text/x-exoplayer-cues binary format
This plumbs a duration through `SampleQueue` which will make it easier
to handle transcoding muxed subtitles from e.g. SubRip to
`text/x-exoplayer-cues`.

This change is a no-op to the end-to-end behaviour of ExoPlayer because
currently we only support parsing sideloaded subtitles before
`SampleQueue`, and by adding the duration we don't affect the cues that
are ultimately output by `Player.Listener.onCues` (as shown by no change
to the golden files for `WebvttPlaybackTest` in this commit).

I considered making `CuesWithStartTimeAndDuration` implement
`Bundleable` (and deleting `CueEncoder/Decoder`) but decided against
it because we are deliberately not encoding `startTimeUs` (since that's
encoded as the sample time in `SampleQueue`). I also considered
introducing another type that only has `List<Cue>` and `durationUs`
fields, but it didn't seem necessary, since we want `startTimeUs`
everywhere else (except inside `SampleQueue`).

PiperOrigin-RevId: 545226847
2023-07-05 09:14:38 +00:00
ibaker
4ae36cc175 Fix Error Prone warning in SubtitleExtractorTest
Also make some casting that is needed a bit safer.

Error Prone was complaining about casting `long` to `int` before passing
it to `Extractor.seek(long, long)`:
> Converting a `long` or `Long` to an `int` to pass as a `long`
> parameter is usually not necessary. If this conversion is intentional,
> consider `Longs.constrainToRange()` instead.

PiperOrigin-RevId: 545226063
2023-07-05 09:13:29 +00:00
ibaker
412e9398f9 Add SubtitleParser.Factory
This is a corollary of `SubtitleDecoderFactory`. We may add a
`boolean supportsFormat(Format)` method later if it turns out to be
useful.

PiperOrigin-RevId: 545225489
2023-07-05 09:12:17 +00:00
ibaker
e67e28c4aa Introduce CuesWithTiming and use it in SubtitleParser
PiperOrigin-RevId: 545224876
2023-07-05 09:11:08 +00:00
huangdarwin
1fce0cfd4d Test: Fix missed latch exceptions.
Catch timeouts, and general errors in the case of an InterupptedException.

PiperOrigin-RevId: 545219647
2023-07-05 09:09:59 +00:00
ibaker
5e96d355e1 Suppress NewApi lint warning on <vector> usage in drawables
PiperOrigin-RevId: 545207308
2023-07-05 09:08:51 +00:00
tonihei
5e19a33095 Replace exoplayer.dev@gmail.com with android-media-github@google.com
#minor-release

PiperOrigin-RevId: 545165879
2023-07-05 09:07:22 +00:00
huangdarwin
546b9a2a88 Effect Test: Use latch instead of thread.sleep.
The timeout time of 5000ms is quite long, and means that for tests with >1
VFPTestRunner, like texture output and compositor tests, we have to wait 10s.

The latch allows us to continue with the test once we're done processing input,
instead of needing to wait longer, until the timeout is reached.

PiperOrigin-RevId: 545159839
2023-07-05 09:06:14 +00:00
andrewlewis
6d351a3c12 Add back release notes about deprecated HDR symbols
These were accidentally removed in 832d5b5f98

PiperOrigin-RevId: 545156495
2023-07-05 09:05:08 +00:00
Googler
f486074f82 AudioDeviceCallback should not be used below SDK 23.
This gating should have been added in 6e46234589.

PiperOrigin-RevId: 544720503
2023-07-05 09:03:51 +00:00
huangdarwin
9945033867 Effect: Create basic VideoCompositor.
Allow two DefaultVideoFrameProcessor instances to output to one
VideoCompositor, which then outputs a frame.

PiperOrigin-RevId: 544705821
2023-07-05 09:02:45 +00:00
huangdarwin
854c5254ec GL: Print egl errors in hex.
The actual errors are all positive hex values. Without this CL, we must first
convert decimal errors to hex ones before figuring out what went wrong.

PiperOrigin-RevId: 544695961
2023-07-05 09:01:36 +00:00