1028 Commits

Author SHA1 Message Date
samrobinson
b15e7553e5 Add the hasSource method to the AudioMixer interface.
PiperOrigin-RevId: 551804976
2023-08-01 14:19:04 +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
ccdde8806e Account for endTimeUs when outputting with no sources.
When endTimeUs is set, restrict output to that point.

PiperOrigin-RevId: 551555392
2023-08-01 14:15:34 +01:00
huangdarwin
bd6a36033e Compositor: Move shared test logic to TestRunner.
Move shared test logic to the test runner.

This does increase indirection, which isn't usually preferable in tests.
However, we will have many different tests that would use logic
like this, so this allows us to reduce repetition.

PiperOrigin-RevId: 551536438
2023-08-01 14:13:25 +01:00
claincly
e77c318d96 Create Util method for SparseArray.contains()
And fixed usages in Transformer and Effect.

PiperOrigin-RevId: 551484860
2023-08-01 14:12:10 +01:00
samrobinson
b7d7027424 Update Composition javadoc for expanded audio support.
PiperOrigin-RevId: 550922961
2023-08-01 14:08:46 +01:00
andrewlewis
9a2bfc4042 Prioritize H.265 and H.264 over other formats
This should make no functional difference because `SampleExporter` always
checks for H.265 and H.264 first. However, in case we ever change that code,
these are used in priority order so it's better to order them accordingly.

PiperOrigin-RevId: 550894935
2023-08-01 14:05:42 +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
huangdarwin
35bee3299c Remove VisibleForTesting visibility in 8k workaround.
PiperOrigin-RevId: 550843914
2023-08-01 14:01:02 +01:00
Googler
465e7c1277 Rewrite tracing to be more flexible and provide more info.
For each event, the timestamp and presentation time is logged. The trace can
then be dumped to a tsv file and easily imported in a spreadsheet.

PiperOrigin-RevId: 550839156
2023-08-01 13:59:51 +01:00
huangdarwin
e5e3db954f Remove setting the interrupted flag when unneeded.
When rethrowing InterruptedException, this
Thread.currentThread().interrupted() is not needed.

PiperOrigin-RevId: 550586853
2023-08-01 13:56:35 +01:00
claincly
22d30b3d74 Fix some mal formatted TODOs
PiperOrigin-RevId: 550507208
2023-08-01 13:51:58 +01:00
huangdarwin
d7b5ab9f23 Add Thread.currentThread().interrupt() for InterruptedExceptions.
PiperOrigin-RevId: 549975878
2023-08-01 13:49:48 +01:00
huangdarwin
5858723a06 Effect: Add Compositor signalEndOfInputStream and onEnded.
signalEndOfInputStream is needed for when streams have different amounts of
frames, so that if the primary stream finishes after a secondary stream, it
can end without waiting indefinitely for the secondary stream's matching
timestamps.

onEnded mirrors this API on the output side, which will be necessary to
know when to call signalEndOfInput on downstream components (ex. on downstream)
VideoFrameProcessors

PiperOrigin-RevId: 549969933
2023-08-01 13:48:36 +01:00
sheenachhabra
c2615a679f Skip tests if device needs disable 8k workaround
PiperOrigin-RevId: 549967326
2023-08-01 13:47:26 +01:00
huangdarwin
9128293236 Test: Use correct test skipping in muxer androidTest.
PiperOrigin-RevId: 549601882
2023-08-01 13:37:31 +01:00
samrobinson
beceb996ac Create ExportException for audio from UnhandledAudioFormatException.
All audio processing export errors are related to a UAFE - passing
audioFormat separately is redundant.

PiperOrigin-RevId: 549427685
2023-07-20 10:35:45 +01:00
claincly
177187e237 Allow multiple inputs to the processing graphs
The new logic covers the old single-sequence use cases.

PiperOrigin-RevId: 549307918
2023-07-20 10:33:35 +01:00
huangdarwin
747b31b3c5 Test: Add non-mh androidTest tests to MH_TESTS / triage.
PiperOrigin-RevId: 549005874
2023-07-20 10:25:30 +01:00
samrobinson
035934c6d4 Combine audio mixing logic across Transformer.
AudioMixingUtil#mix handles input & output in float or Int16 PCM. Given
Float and Int16 use different sample ratnes, this util handles
conversion between the two, based on the encoding being mixed to.

Migrate AudioMixer to use the util, removing AudioMixingAlgorithm
interface and implementation. ChannelMixingAudioProcessor will be
migrated after additional performance checks.

PiperOrigin-RevId: 548994584
2023-07-20 10:22:58 +01:00
huangdarwin
0c29dacde3 Compositor: Use timestamps to release frames.
Also, implement back-pressure to avoid requesting more than all of the
compositor's texturepool textures

PiperOrigin-RevId: 548179800
2023-07-20 10:04:55 +01:00
huangdarwin
8c4aa6b75d Compositor: Add 10 frame test.
This serves as a sort of test with more frames for the compositor for now
(before more varied video system tests come later when integrating with
Transformer), showing it doesn't error out and outputs the right
amount of frames.

Due to the VFPTestRunner having a 5s timeout, and mostly due to presubmit
emulators being very slow with OpenGL, there is a sort of limitation
to how many frames this type of test can have, depending on the test target

PiperOrigin-RevId: 548159762
2023-07-20 10:03:55 +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
claincly
18033c9c1b Add basic SingleInputVideoGraph by wrapping DefaultVideoFrameProcessor
SingleInputVideoGraph implements GraphInput now, so the asset loaders would
interface directly with SIVG, rather than VideoSampleExporter. This is to pave
way for multi-asset video processing.

PiperOrigin-RevId: 547561042
2023-07-13 15:57:47 +01:00
claincly
e81ae0a8eb Remove stale (incorrect) javadoc lines from transformer.java
PiperOrigin-RevId: 547451166
2023-07-13 15:51:28 +01:00
claincly
bbdc64a732 Remove stale TODO
The said test is added in `TransformerMixedInputEndToEndTest` and
`TransformerSequenceEffectTest`.

PiperOrigin-RevId: 547407374
2023-07-13 15:48:58 +01:00
huangdarwin
c122c0ca05 Compositor: Add support for multiple bitmaps, and add testrunner
* Allow more than one input bitmap at a time.
* Allow Compositor to take in and set up an Executor. Otherwise,
Compositor resources may be created on one thread and accessed on another.
* Add a Compositor TestRunner to reuse test code more.
* Update VideoFrameProcessingTaskExecutor to use a new onError listener, so
that it's more reusable in non-DVFP contexts, like for Compositor.

PiperOrigin-RevId: 547206053
2023-07-13 15:45:30 +01:00
samrobinson
4983d4f339 Switch argument order passed to scaleLargeTimestamp.
durationUs is almost always going to be a larger number than the sample
rate, so pass as the main value, rather than the multiplier.

PiperOrigin-RevId: 547193927
2023-07-13 15:44:15 +01:00
andrewlewis
fcadecf2b1 Add note recommending OpenGL tone-mapping
PiperOrigin-RevId: 547192957
2023-07-13 15:43:01 +01:00
andrewlewis
7df09fe4b7 Disable codec tone-mapping on Fold 4 API 33
The codec plugin sets crop values incorrectly.

PiperOrigin-RevId: 547160088
2023-07-13 15:39:21 +01:00
samrobinson
9b06da8174 Remove redundant assertion.
TransformerAndroidTestRunner#run will throw any exception that occurs,
so there is no need to assert the result exception is null.

PiperOrigin-RevId: 546923823
2023-07-13 15:35:50 +01:00
huangdarwin
7c9e6ad2ea Effect: Only allow setExecutorService with @NonNull values.
PiperOrigin-RevId: 546828814
2023-07-13 15:30:07 +01:00
claincly
ddd000128f Add an Input interface to SampleExporter.
PiperOrigin-RevId: 546822962
2023-07-13 15:27:40 +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
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
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
claincly
372cd7f952 Remove unused constructor parameter
PiperOrigin-RevId: 545909062
2023-07-13 15:00:12 +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
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
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
kimvde
81c83e4213 Remove HDR modes from TransformationRequest
PiperOrigin-RevId: 545352306
2023-07-05 09:16:52 +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
tofunmi
d14122b029 Create queue of sync objects in FinalShaderProgramWrapper
PiperOrigin-RevId: 544683524
2023-07-05 09:00:20 +00:00
tofunmi
6f9731ce7e TextureInput: Advise client to delete syncObject after use
PiperOrigin-RevId: 544670927
2023-07-05 08:57:55 +00:00
huangdarwin
a875fa72a8 GL: Move fallback to glFinish to GlUtil.
This may happen, for example, on older OpenGL versions.

This may be used in the compositor too.

PiperOrigin-RevId: 544613566
2023-07-05 08:54:24 +00:00