228 Commits

Author SHA1 Message Date
huangdarwin
0466bd7957 Effect: Add alpha effect.
This effect can scale Alpha values.

This is needed for testing Compositor, and coincidentally was requested
by a partner in the past. This also will generally be more useful in
full multi-asset, where we may want to have one input have different alpha
values than another

Also, update fragment_shader_copy_es2.glsl to not throw away alpha values.
This means ThumbnailStripShaderProgram (the only place this glsl is used) will
consider input alpha and output alpha appropriately

PiperOrigin-RevId: 555915092
2023-08-11 20:31:21 +00:00
huangdarwin
fd5784455c Compositor: Add test for correct input timestamps.
To ensure that for each output bitmap from the compostor, the right input
timestamps were used.

Only applied on a subset of tests to avoid needing to upload+maintain
too many files/size in the test binary, especially when it would test
duplicate behavior

PiperOrigin-RevId: 555222530
2023-08-10 12:29:21 +00:00
andrewlewis
bf5c4d8078 Use golden data generated on emulator for tests based on london.jpg
PiperOrigin-RevId: 555148673
2023-08-10 12:22:31 +00:00
Tianyi Feng
ef54364478 Merge pull request #528 from zgzong:patch-2
PiperOrigin-RevId: 554869426
2023-08-10 12:09:43 +00:00
Googler
4fe55b8b63 Return the correct output buffer from audio processing pipeline
PiperOrigin-RevId: 554851456
2023-08-10 12:07:15 +00:00
kimvde
f43146718c Add CompositionPlayer unit test
Test the audio side only because the video side won't be testable with
unit tests once we add the OpenGL components.

PiperOrigin-RevId: 554508703
2023-08-10 11:59:42 +00:00
andrewlewis
691bf93032 Use lower resolution bitmap for tests
The test file decompresses to about 48 MB, which can cause an
`OutOfMemoryError` on lower end devices.

Also, a test appears to apply a rotation to this bitmap without downscaling
first, leading to exceeding a maximum texture width/height of 4096 on some
devices.

Replace the test file with one that has a quarter of the original's
width/height so that these tests can pass reliably even on lower end
devices.

PiperOrigin-RevId: 554507185
2023-08-10 11:58:25 +00:00
tonihei
71591782f0 Adjust periodEnded logic further
Periods that are not the last in the manifest are always ended
and non-dynamic periods are also always ended by definition.

Also, some periods may not be able to declare their final duration
accurately and we need to account for some inaccuracy. This can be
done by testing whether no further full segment within the duration
can be expected.
2023-08-08 17:47:23 +01:00
tonihei
a3c1d5be9d Reset loading period after reading discontinuity that requires loading
This is the same change as 8655429af7, just on the second call site
of readDiscontinuity. The tests didn't cover this case yet because
they never queued more than 2 items in a playlist.

PiperOrigin-RevId: 553485244
2023-08-07 11:30:38 +00:00
tofunmi
dfd668238a Create SingleSampleSeekMap and use in pngExtractor
PiperOrigin-RevId: 553191571
2023-08-07 11:27:27 +00:00
Googler
e87f0d5580 Add a thumbnail strip effect that tiles frames horizontally.
The size of the thumbnail strip and the timestamp of the video frames to use must be specified by the user of the effect.

PiperOrigin-RevId: 552809210
2023-08-07 11:15:10 +00:00
tofunmi
bb699e41c9 Add png extractor
Implementing a basic extractor that reads the whole png file into the trackOutput as one sample.

PiperOrigin-RevId: 551897619
2023-08-01 14:24:47 +01:00
claincly
c221958889 Remove setInputFrameInfo
After this change, every queued bitmap is treated as an individual input stream
(like a new MediaItems).

This change merges the FrameDropTest and FrameDropPixelTest into one (while maintaining all the test cases)

- This is accomplished by generating bitmaps with timestamps on it in FrameDropTest and compare them with goldens (one may call this a pixel test, please lmk if you want this to be renamed)
- The most part of the change comes from DefaultVideoFrameProcessorVideoFrameRenderingTest. The overall working is
  - We bypass the input manager
  - The TestFrameGenerator generates frames based on timestamps. In this case, we generate frames with timestamps on it
  - The generated frame is sent to texture output and in turn saved to bitmaps
  - We then compare the generated bitmap with the goldens

PiperOrigin-RevId: 551795770
2023-08-01 14:17:59 +01:00
samrobinson
54093a152e Integrate AudioMixer for audio export.
Adds support for compositions with multiple audio sequences.

PiperOrigin-RevId: 550880626
2023-08-01 14:03:22 +01:00
samrobinson
357c458028 Ensure EOS is queued after processing generated silence with effects.
When generating silence for AudioProcessingPipeline, audio never
queued EOS downstream.

Linked to this, when silence followed an item with audio, the silence
was added to SilentAudioGenerator before the mediaItem reconfiguration
occurred. If the silence had effects, the APP would be flushed after
silence queued EOS, resetting APP.isEnded back to false, so AudioGraph
never ended.

Regression tests reproduce failure without fix, but pass with it.

PiperOrigin-RevId: 550853714
2023-08-01 14:02:09 +01:00
jbibik
f4ad26451f Deprecate MimeTypes.TEXT_EXOPLAYER_CUES for APPLICATION_MEDIA3_CUES
Instead of `text/x-exoplayer-cues`, we will use `application/x-media3-cues`.

The prefix should be `application` not `text` since the encoded form is arbitrary bytes, not necessarily text. The name should not reference `exoplayer`, since the Media3 Extractors (which are not part of `exoplayer`) produce this format.

PiperOrigin-RevId: 550181852
2023-08-01 13:50:50 +01:00
tofunmi
7eee15ecb4 Update OverlaySettings to explicitly state overlay transformations
Alters the OverlayShaderProgram implementation to support rotations, however we need to apply the transformations separately in order for them to work as expected so the matrix is removed from the interface in favour of explicit methods.

Adds a rotation test to ensure this ability doesn't regress

PiperOrigin-RevId: 549890847
2023-08-01 13:45:22 +01:00
jbibik
e11e484bc3 Do not emit empty cues in SsaParser
It is not part of the `SubtitleParser` interface's promise to give events for all changes to do with `Cue` objects. So while in the past, we would have `endTimeUs` of one Cue event being the `startTimeUs` of the next one, now we have that encoded in `durationUs` and can skip event with empty `Cues`.

PiperOrigin-RevId: 549629157
2023-08-01 13:41:11 +01:00
ibaker
1cfaae3450 Enable WebVTT subtitles in MkvPlaybackTest
This is no longer flaky because WebVTT subtitles are decoded on the
loading thread (enabled in this test with
`defaultExractorsFactory.setTextTrackTranscodingEnabled(true)` - and
supported for WebVTT since f0f24aa0d4).

PiperOrigin-RevId: 549594291
2023-08-01 13:35:11 +01:00
jbibik
f4c66d82dd TtmlDecoderTest refactor not to use TtmlNode or TtmlStyle
PiperOrigin-RevId: 549584918
2023-08-01 13:30:39 +01:00
ibaker
5d453fcf37 Add an Extractor to parse subtitles before SampleQueue
The end-to-end test output for the overlapping SRT and SSA subtitles
is currently incorrect. They will be fixed in a future change that
updates `TextRenderer` to support this overlap.

The 'extra' samples visible in the extractor test output files are
'empty cue list' samples produced by `SsaParser`. They will go away
when this implementation is updated to remove this behaviour and rely
on `CuesWithTiming.durationUs` instead (the 'empty list' behaviour is
not required by the `SubtitleParser` interface).

PiperOrigin-RevId: 549264593
2023-07-20 10:30:16 +01:00
tonihei
da99f9937d Rollback of 7996766b22
*** Original commit ***

Rollback of b69b33206e

*** Original commit ***

Mark output sample as decode-only based on start time

We currently do the same check on the input timestamps and
expect the output timestamps to match. Some codecs produce
samples with modified timestamps and the logic is a lot safer
when the comparison with the start time is done on the output
side of the codec.

Issue: google/ExoPlayer#11000

***

***

PiperOrigin-RevId: 549019403
2023-07-20 10:26:25 +01:00
tonihei
b0ec2cc701 Remove timestamp clipping in MergingMediaPeriod.TimeOffsetSampleStream
This was done because it was deemed correct to only start at timestamp
zero when the code was originally written. However, in case of
prerolling from a keyframe, many samples will get the same timestamp,
which is not correct and interferes with downstream logic
that deals with timestamps.

PiperOrigin-RevId: 548986160
2023-07-20 10:20:22 +01:00
ibaker
34768c2399 Add MKV test assets with overlapping SSA and SRT subtitles
This is a step towards adding general support for overlapping
subtitles in these formats (and others), both muxed and sideloaded:
* Issue: google/ExoPlayer#10295
* Issue: google/ExoPlayer#4794

This change adds these files to the end-to-end playback tests too, but
the subtitle track is currently disabled because renderer-side subtitle
parsing causes flaky tests (due to an uncontrolled thread in
`SimpleSubtitleDecoder`). The subtitle track will be re-enabled in
a follow-up change when loading-side subtitle parsing is added (so the
tests will no longer be flaky). At this point the overlapping subtitles
**still** won't be supported end-to-end, but a second change will
resolve this will changes in `TextRenderer` - which will change the
end-to-end playback dumps to reflect the overlapping subtitles.

PiperOrigin-RevId: 548705032
2023-07-20 10:14:50 +01:00
tofunmi
453431fef2 Fix TextOverlay's overlay width measuring strategy
Before this CL, the text with a scale span would wrap text, with because the scale wasn't taken into account when measuring the width of the overlay.

PiperOrigin-RevId: 548123626
2023-07-20 10:00:05 +01:00
michaelkatz
847f6f24d3 Prepend Ogg ID and Comment Header Pages to offloaded Opus stream
Add Ogg ID Header and Comment Header Pages to the Ogg encapsulated Opus for offload playback. This further matches the RFC 7845 spec and provides initialization data to decoders.

PiperOrigin-RevId: 548080222
2023-07-20 09:56:31 +01:00
tonihei
568817f756 Add e2etests for merged sources in a playlist
These tests allow to verify the samples sent for decoding,
when decoders are reset, which samples are dropped as decode-only
for video and which samples are sent to the AudioTrack for playback.

The test exercises all combinations of merges where audio or video
is the primary track and where audio, video or both are clipped.

PiperOrigin-RevId: 548061254
2023-07-14 10:23:01 +01:00
samrobinson
847cc9b841 Use asset with encoded video & raw audio for Robolectric test.
Test requires file to have video track for forcing silence.

PiperOrigin-RevId: 547839076
2023-07-14 10:19:29 +01:00
tonihei
989607aa04 Add e2etest for clipped sources in playlists
These tests allow to verify the samples sent for decoding,
when decoders are reset, which samples are dropped as decode-only
for video and which samples are sent to the AudioTrack for playback.

The test exercises all combinations of clipping transitions for
sources that are either clipped at the start, the end, or both.

PiperOrigin-RevId: 547730824
2023-07-13 16:00:16 +01:00
tonihei
7441c1f083 Add more data to e2etest dumps
We currently only log the input buffers to the codec, but the test
will be more complete and provide more insights into the playback
behavior if we also dump more information about these input buffers
(timestamps and flags) and also all output buffers with their
timestamps and whether they are rendererd (only relevant for video).
And also use the CapturingAudioSink to output the audio data we produce.

PiperOrigin-RevId: 546898937
2023-07-13 15:33:33 +01:00
tonihei
d6f20455ac ServerSideAdInsertionMediaSourceTest adjustments
Some adjustments to the test to make it more correct and prevent it
from becoming flaky:
 - Use separate output dump files per test setup. Once we add more data
   to these files, they are not guaranteed to be the same anymore.
 - Use a seek position that is actually behind the midroll as described
   in the test setup.
 - Change ad insertion position to ensure the ad group duration doesn't
   exceed the underlying media duration.
 - Add a wait for isLoading to ensure the late insertion of an ad group
   happens consistently at the same processing stage.

PiperOrigin-RevId: 546825183
2023-07-13 15:28:54 +01: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
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
microkatz
9513f2c551 Merge pull request #487 from vishnuchilakala:allow_unsigned_int_for_adaptation_set_id
PiperOrigin-RevId: 544601945
2023-07-05 08:53:09 +00:00
tonihei
4169386c12 Switch parsing to Long
This avoids issues with potential number clashes with ID_UNSET.
Also fixes some further parsing where adaptation set ids are referenced
from manifest properties.
2023-06-30 08:42:59 +01:00
samrobinson
f60f79bb10 Handle media item (Effects/Format) changes in AudioSamplePipeline.
On a MediaItem change, the input Format (and Effects to apply) may be
different. Therefore the AudioProcessingPipeline must be reconfigured
to determine what processing is active, and what the AudioFormat of the
data output is. In the event that it is different, additional
AudioProcessor instances must be used to ensure the encoder will still
be able to accept the audio buffers.

PiperOrigin-RevId: 544338451
2023-06-29 23:14:10 +00:00
samrobinson
0d67733d28 Update media in silence concatentation test to match silent format.
Goal of tests (SequenceExportTest) that use this media is for the
silence and the media to match exactly with audio format, however
`sample_with_increasing_timestamps.mp4` had a different sample rate.

testvid_1022ms.mp4: channel count = 2, sample rate = 44100.

PiperOrigin-RevId: 543458948
2023-06-29 22:52:32 +00:00
tonihei
2322462404 Do not trim audio samples by changing their timestamp
MP4 edit lists sometimes ask to start playback between two samples.
If this happens, we currently change the timestamp of the first
sample to zero to trim it (e.g. to display the first frame for a
slightly shorter period of time). However, we can't do this to audio
samples are they have an inherent duration and trimming them this
way is not possible.

#minor-release

PiperOrigin-RevId: 543420218
2023-06-29 22:50:04 +00:00
samrobinson
b46b6a8278 Use stereo audio in silence -> audio SequenceExportTest.
With the upcoming "handle format changes" CL, stereo -> mono audio
would add an AudioProcessor. Robolectric decodes output encoded data,
which crashes some AudioProcessors because the number of frames may not
be an integer.

PiperOrigin-RevId: 542568875
2023-06-23 16:40:57 +00:00
Ian Baker
7cb7e8c666 Update TS dump files with extra final sample 2023-06-21 10:00:47 +01:00
sheenachhabra
911a6430f3 Remove UdtaInfo class
The class seems unnecessary and the code can be simplified by
removing this.

PiperOrigin-RevId: 541675378
2023-06-20 14:00:50 +01:00
samrobinson
6d648f8bdb Add dump tests for concatenating 2 audio items.
Audio only tests are now using RAW audio where possible, which is
passed through the Robolectric decoders/encoders, and can be handled by
the AudioProcessor instances accurately.

PiperOrigin-RevId: 541648853
2023-06-20 13:57:33 +01:00
sheenachhabra
c0e8513b7a Make dump files deterministic
Issue: When running the Transformer related test cases, the tests are flaky
because the order in which audio and video samples are interleaved seems to
differ in few instances.

Root cause: When running a transformation the sample producer (Asset loader)
and sample consumer (Sample pipeline) both runs on different thread and
theoretically there is no reason for behaviour to be deterministic because
the number of samples produced/written depends on how fast individual thread
works. So it is indeed surprising that test somehow worked deterministically in
majority of instances (may be something to do with Robolectric environment).

Solution: Since we don't expect the order of sample interleaving to be deterministic, make the dumping logic deterministic where all the video
samples will be collected and then dumped together (similarly for audio). This would mean we won't be able to see the interleaving so for that we need to
add separate test case verifying the interleaving logic only.

Pending: Test case for interleaving.
PiperOrigin-RevId: 540930871
2023-06-19 16:28:07 +01:00
claincly
0d3082e6ad Reduce the pixel differnce in TransformerSequenceEffectTest
As the test images are re-gened on the emulators.

PiperOrigin-RevId: 540851288
2023-06-19 16:23:13 +01:00
samrobinson
1236d37acb Improve SequenceExportTest test and dump file naming.
No-op change to highlight when video and/or audio are transmuxed and
reorder the methods.

PiperOrigin-RevId: 540567375
2023-06-19 16:14:38 +01:00
sheenachhabra
d0eda433ea Replace CreationTime class with Mp4TimestampData class
PiperOrigin-RevId: 540257484
2023-06-14 20:42:36 +01:00
claincly
5961637c0a Add test for per-MediaItem effect
The test transcodes four media items with distinct effects, keeping one frame
each; extracts the four frames in the produced video, and compares them against
the expected results.

PiperOrigin-RevId: 539697344
2023-06-14 20:27:37 +01:00
sheenachhabra
53c174f047 Add support for passing custom metadata via transformer
Changes included:
1. Enable MP4 extractor to read all types of metadata.
2. Allow passing String and Float metadata via Transformer.

Reference to QuickTime spec: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW21

PiperOrigin-RevId: 538783982
2023-06-09 13:51:15 +00:00
huangdarwin
adf53b4d50 Effect: Add multiple texture output test.
Confirms that multiple textures can be output, and that timestamps and pixels
are as expected.

PiperOrigin-RevId: 538459296
2023-06-08 12:37:00 +00:00
sheenachhabra
7e14811e25 Add support for passing creation time via InAppMuxer
PiperOrigin-RevId: 538175466
2023-06-06 18:12:51 +00:00