19394 Commits

Author SHA1 Message Date
ibaker
f35e7bdc6a Switch WebvttParserTest to use partial-output method
PiperOrigin-RevId: 566598735
2023-09-19 05:19:07 -07:00
ibaker
92a3f3a8cd Update WebvttParser to implement new partial-output method
This requires adapting the 'to `CuesWithTiming` list' logic to work with
the new partial-output API, and that needs a private method so it's no
longer a good fit for a default method on `Subtitle` - hence moving it
to a new utility class.

Also update the implementation to never return `UNSET` duration (this is
an equivalent change to the `SsaParser` change in 9631923440).

PiperOrigin-RevId: 566598094
2023-09-19 05:15:08 -07:00
claincly
24e700c216 Decouple output size listener and setting output surface
This is because `onOutputSizeChanged()` should in theory be called on the
listener executor.

PiperOrigin-RevId: 566591784
2023-09-19 04:43:18 -07:00
jbibik
0c918d2c47 Fix ErrorProne lint actionable items
PiperOrigin-RevId: 566571653
2023-09-19 03:01:20 -07:00
huangdarwin
93d06180ef Compositor: Remove obsolete TODO
PiperOrigin-RevId: 566327798
2023-09-18 09:39:29 -07:00
rohks
fe199455e7 Add QuickTime (Classic) support to Mp4Extractor
PiperOrigin-RevId: 566272132
2023-09-18 05:29:29 -07:00
ibaker
2c0d9ba4c3 Rollback of d58f5fdf7d
PiperOrigin-RevId: 566258299
2023-09-18 04:12:21 -07:00
tonihei
f89053dbb0 Change UI module documentation link
PiperOrigin-RevId: 566257915
2023-09-18 04:09:46 -07:00
samrobinson
c4fb755283 Open progress conditionVariable when quitting internal thread.
If getProgress is blocking whilst the internal thread calls endInternal
(for error or success), the condition is never opened. Related to this,
onCompleted and onError are therefore never surfaced to the app.

progressState is accessed from application and internal threads, so
should be marked volatile to prevent a thread caching the value.

PiperOrigin-RevId: 565720184
2023-09-15 10:50:07 -07:00
claincly
fef16b05d9 Fix flaky test becasue ExtTexMgr is not using emulator settings
When running on emulators, ExternalTextureManager needs a longer timeout for
forcing EOS, but we didn't catch a device name running on blaze: `generic_x86`

PiperOrigin-RevId: 565513152
2023-09-14 16:45:38 -07:00
huangdarwin
c77b8c8479 Compositor: Split out OpenGL drawing logic into inner class.
Organize logic a bit by splitting logic about how we draw using OpenGL onto a
texture, out from the larger class, which has lots of logic discussing how we select
frames and streams.

No functional change intended, but a few method calls are shuffled around to
simplify things.

PiperOrigin-RevId: 565426225
2023-09-14 11:26:14 -07:00
tofunmi
16b0ea850f Support multiple streams in the ImageRenderer
PiperOrigin-RevId: 565410924
2023-09-14 10:37:58 -07:00
huangdarwin
5ef5d46708 Compositor: Move Settings to DefaultVideoCompositor.
This previously was in the VideoCompositor class, but wasn't
referenced at all from that interface.

PiperOrigin-RevId: 565409646
2023-09-14 10:33:25 -07:00
sheenachhabra
03b793e2ee Read muxedPartialVideo only in MUXER_MODE_MUX_PARTIAL_VIDEO mode
When we switch from MUXER_MODE_MUX_PARTIAL_VIDEO to MUXER_MODE_APPEND_VIDEO
`muxedPartialVideo` will already be `true` so `endTrack` method will pass
through this `if(muxedPartialVideo)` check which is incorrect.

PiperOrigin-RevId: 565398117
2023-09-14 09:54:25 -07:00
ibaker
d58f5fdf7d Upgrade Guava dependency to 32.1.2
Android's version of Guava was upgraded in http://r.android.com/2731599

PiperOrigin-RevId: 565396612
2023-09-14 09:50:10 -07:00
sheenachhabra
dc865e6e98 Return TIME_UNSET for last sync sample if there is no video track
PiperOrigin-RevId: 565395263
2023-09-14 09:44:42 -07:00
huangdarwin
98009d396a Compositor: Document VideoCompositor interface thread safety.
PiperOrigin-RevId: 565388982
2023-09-14 09:22:08 -07:00
christosts
c0e11e0edd Move bitmap loader tests in test
These tests were under androidTest because we needed a functional
BitmapFactory. Robolectric now supports decoding bitmaps so moving them
under tests.

PiperOrigin-RevId: 565181239
2023-09-13 15:40:55 -07:00
claincly
bf25b3e89d Move listener methods into private method for readability
The logic that handles components' boundaries are grouped together in private
methods, like handling VideoCompositor's output textures.

PiperOrigin-RevId: 565131579
2023-09-13 12:45:40 -07:00
claincly
1d8135e563 Add test for MultiInputVideoGraph
This test composites the first frame from two video inputs.

PiperOrigin-RevId: 565090338
2023-09-13 10:28:07 -07:00
claincly
5106f2f45a Rollback of e2882c051b
PiperOrigin-RevId: 565069442
2023-09-13 09:15:35 -07:00
ibaker
56fbf7377e Add javadoc to SubtitleParser.OutputOptions
PiperOrigin-RevId: 565066243
2023-09-13 09:04:27 -07:00
ibaker
f8b23da7af Add overflow tests for sample count to duration conversion methods
These methods were updated to use the new overflow-resistant
`scaleLargeValue` method in 885ddb167e.

PiperOrigin-RevId: 565059609
2023-09-13 08:38:14 -07:00
ibaker
d111976125 Change SubtitleParser interface to support incremental output
This change introduces two new types of method to `SubtitleParser`:
1. `parse()` methods that take a `Consumer<CuesWithTiming>` and return `void`
2. `parseToLegacySubtitle` method that returns `Subtitle`

(1) ensures that in the new 'parse before SampleQueue' world we can
write cues to the `SampleQueue` as soon as they're ready - this is
especially important when parsing monolithic text files, e.g. for a
whole movie.

(2) ensures that during the transition, the legacy 'parse after
SampleQueue' behaviour doesn't see any regressions in 'time to first
cue being shown'. Previously we had a single implementation to convert
from `List<CuesWithTiming>` to `Subtitle`, but this relies on the
complete list of cues being available, which can take a long time for
large files in some formats (with ExoPlayer's current parsing logic).
By allowing implementations to customise the way they create a
`Subtitle`, we can directly re-use the existing logic, so that the
'time to first cue being shown' should stay the same.

This change migrates all **usages** to the new methods, but doesn't
migrate any **implementations**. I will migrate the implementations in
follow-up CLs before deleting the old list-returning `parse()` methods.

PiperOrigin-RevId: 565057945
2023-09-13 08:33:29 -07:00
huangdarwin
e0de405e68 Compositor: Move input source javadoc to class-level.
As discussed offline, this is important for users of the class, and not all users may choose to read method javadoc, so best to make sure it's visible by leaving it at the class-level.

PiperOrigin-RevId: 565057677
2023-09-13 08:30:15 -07:00
ibaker
fdfec60f6e Remove some debugging lines in AtomParsers
These were accidentally added in 885ddb167e

PiperOrigin-RevId: 565035337
2023-09-13 06:49:25 -07:00
michaelkatz
85c944b955 Enable offload scheduling by default for audio-only offload playback
Removed `ExoPlayer.experimentalSetOffloadSchedulingEnabled` as scheduling will be enabled by default when offload is enabled for audio-only playback.

In addition, the `experimental` key word was taken out of the following
method signatures:
* `ExoPlayer.experimentalIsSleepingForOffload`
* `AudioOffloadListener.onExperimentalSleepingForOffloadChanged`
* `AudioOffloadListener.onExperimentalOffloadedPlayback`

PiperOrigin-RevId: 565035289
2023-09-13 06:46:50 -07:00
ibaker
abaf3e7aa1 Add Format.cueReplacementBehavior
Previously any `CuesWithTiming.durationUs` could be `TIME_UNSET`,
meaning it should be replaced by the next `CuesWithTiming` instance
(instead of being merged if the durations overlap, which is currently
the expected behavior for all `CuesWithTiming` with a 'real' duration).

This technically allowed a single subtitle track to include a mixture of
`CuesWithTiming` that should be merged, and some that should be
replaced. This is not actually needed for any of the subtitle formats
currently supported by ExoPlayer - in all cases a format expects either
all cues to be merged, or each cue to replace the previous one.

Supporting this mixture of merging and replacing in `TextRenderer` ended
up being very complicated, and it seemed a bit pointless since it's not
actually needed. This change means a given subtitle track either merges
**all** cues (meaning `CuesWithTiming.durationUs = C.TIME_UNSET` is not
allowed), or **every** cue is replaced by the next one (meaning
`CuesWithTiming.durationUs` may be set (to allow for cues to 'time out',
needed for CEA-608), or may be `TIME_UNSET`).

This value will be used in a subsequent change that adds cue-merging
support to `TextRenderer`.

PiperOrigin-RevId: 565028066
2023-09-13 06:09:45 -07:00
Googler
282171cb6f Rollback of e2882c051b
PiperOrigin-RevId: 564802194
2023-09-12 12:40:57 -07:00
ibaker
885ddb167e Add general-purpose overflow-resistant divide+multiply util method
This is equivalent to the existing `scaleLargeTimestamp` method with the
following changes/improvements:
* No longer specific to timestamps (there was nothing inherently
  time-specific about the logic in `scaleLargeTimestamp`, but the name
  and docs suggested it shouldn't be used for non-timestamp use-cases).
* Additional 'perfect division' checks between `value` and `divisor`.
* The caller can now provide a `RoundingMode`.
* Robust against `multiplier == 0`.
* Some extra branches before falling through to (potentially lossy)
  floating-point math, including trying to simplify the fraction with
  greatest common divisor to reduce the chance of overflowing `long`.

This was discussed during review of 6e91f0d4c5

This change also includes some golden test file updates - these
represent a bug fix where floating-point maths had previously resulted
in a timestamp being incorrectly rounded down to the previous
microsecond. These changes are due to the 'some more branches' mentioned
above.

PiperOrigin-RevId: 564760748
2023-09-12 10:22:57 -07:00
ibaker
320a45f7d6 Session tests: Log when no controllers are connected
While debugging various session tests failure I found that sometimes
this list was empty (e.g. when a controller had failed to connect, or
hadn't finished connecting yet) - resulting in these methods being
silent no-ops. I think it's basically never expected for there to be no
controllers connected when these methods are invoked, so this logs at
ERROR level to give a clue of what happened when looking at the test
logcat.

PiperOrigin-RevId: 564750969
2023-09-12 09:52:21 -07:00
claincly
e2882c051b Implement MultipleInputVideoGraph
Also adds DebugTraceUtil category to track MultipleInputVideoGraph events.

PiperOrigin-RevId: 564749202
2023-09-12 09:45:23 -07:00
sheenachhabra
b042943102 Add different modes in MuxerWrapper
For pause and resume feature we need to use same `MuxerWrapper`
for `remuxing processed video` and then to `process remaining video`.
In order to use same `MuxerWrapper` across `different Exports`
we need to preserve its state.

PiperOrigin-RevId: 564728396
2023-09-12 08:28:35 -07:00
ibaker
fe10f5ae18 Add tests for Util.scaleLargeTimestamp
This ensures we don't regress this behaviour when introducing
`scaleLargeValue`.

PiperOrigin-RevId: 564708566
2023-09-12 07:00:22 -07:00
ibaker
624eb1d7cb Add missing this.session null check in MockMediaLibraryService.
This aligns the equivalent implementation in `MockMediaSessionService`,
and it looks more correct to me - but the tests seem to pass both with
and without this change (and it doesn't seem to affect flakiness
either).

PiperOrigin-RevId: 564689493
2023-09-12 05:33:24 -07:00
ibaker
cf15463b1f Fix parameter comments in MediaBrowser tests
The parameter name was changed in 782a69e38c

PiperOrigin-RevId: 564688136
2023-09-12 05:25:22 -07:00
michaelkatz
3742f6b1f5 Allow renderer recovery with disabling offload if failed at first write
If offload fails at first write with [ERROR_DEAD_OBJECT](https://developer.android.com/reference/android/media/AudioTrack#ERROR_DEAD_OBJECT), then try disabling offload mode and try again. This allows recovery in a state where AudioTrack succeeds init in offload mode but writing is failing.

Issue: androidx/media#627
PiperOrigin-RevId: 564402181
2023-09-11 09:04:17 -07:00
ibaker
d77c707cd3 Use ISE instead of AssertionError in MockMediaLibraryService
Also pass the full cause instead of just the message.

PiperOrigin-RevId: 564313917
2023-09-11 02:28:38 -07:00
tofunmi
23665090ed Support Jpeg image track extraction in exoplayer
PiperOrigin-RevId: 563818198
2023-09-08 12:15:10 -07:00
tofunmi
be5fa6d130 Support image track extraction for JPEG
PiperOrigin-RevId: 563746945
2023-09-08 07:32:10 -07:00
tonihei
f285334a15 Deprecate multi-window time bar mode
It's much better to merge the windows at source level to reflect the
same state everywhere (e.g. notifications, player state, etc). This
can be done with ConcatenatingMediaSource2.

PiperOrigin-RevId: 563715718
2023-09-08 04:46:43 -07:00
christosts
4afecc9099 Rollback of 51fd06482b
PiperOrigin-RevId: 563714392
2023-09-08 04:39:51 -07:00
tonihei
6cff4a2638 Deprecate ConcatenatingMediaSource
There is no known use case left that needs to be solved by this
class. All other use cases are better solved by alternative
approaches (Player playlist methods or ConcatenatingMediaSource2).

PiperOrigin-RevId: 563713384
2023-09-08 04:36:01 -07:00
samrobinson
866d62dd34 Improve CompositionExportTest assertions by using dump files.
PiperOrigin-RevId: 563708666
2023-09-08 04:09:21 -07:00
Googler
007b7dbbf1 Make sure the mdat box is not extended by more than 1 GB at a time.
PiperOrigin-RevId: 563708468
2023-09-08 04:07:13 -07:00
tonihei
5a1322c9f9 Remove restriction from ConcatenatingMediaSource2
The class currently disallows offsets of periods in their windows
except for the very first window. This is not necessary because
we can use TimeOffsetMediaPeriod to eliminate the offset if needed.
This makes the class more useful for many use cases, in particular
for using it with ClippingMediaSource.

Issue: google/ExoPlayer#11226
PiperOrigin-RevId: 563702120
2023-09-08 03:31:17 -07:00
samrobinson
763dddfbd4 Dump with C.TrackType as key, rather than muxer track index.
Modifying dumping to not required "released" to be called.

Track index is an arbitrary value based on the order of addTrack calls.
Samples are dumped by track (rather than as soon as they are written),
so it's preferable to use a value that provides more context.

By using the track type as a key, dump files will be more deterministic
and will have more similarities when branched.

PiperOrigin-RevId: 563700982
2023-09-08 03:25:13 -07:00
tonihei
0c2aba9ce1 Add MediaPeriodId to CompositeMediaSource.getMediaTimeForChildMediaTime
This callback asks to correct the media time in a composition, but doesn't
provide the MediaPeriodId as the necessary context to do this.

PiperOrigin-RevId: 563699344
2023-09-08 03:17:55 -07:00
tonihei
dd2a373636 Add missing synchronization in ExperimentalBandwidthMeter
Issue: androidx/media#612
PiperOrigin-RevId: 563690229
2023-09-08 02:27:20 -07:00
tonihei
f2b1d0cfa3 Move TimeOffsetMediaPeriod to its own class
This makes it reusable for other MediaSource/Periods in the same
package.

Issue: google/ExoPlayer#11226
PiperOrigin-RevId: 563687935
2023-09-08 02:13:39 -07:00