18347 Commits

Author SHA1 Message Date
sheenachhabra
a099c7a0b5 Move SampleTableBoxesTest.java into third_party/.../muxer/...
Following changes are included:
1. Move test file into third_party/.../muxer/...
2. Rewrite tests for stts box and stsz box to use dump file infra instead of Mp4Slicer.
3. Remove existing test cases related to stts box which are kind of duplicate as it tries to cover the scenarios which are already covered by "DurationsVuForStts" related test cases.

PiperOrigin-RevId: 510977119
2023-02-24 09:56:35 +00:00
kimvde
b88025cc3d Fix stuck muxer
Unstuck the muxer if the next timestamp in the track with the minimum
timestamp is larger than this minimum timestamp plus
MAX_TRACK_WRITE_AHEAD_US.

PiperOrigin-RevId: 510977088
2023-02-24 09:53:06 +00:00
huangdarwin
c79eb7466a Effect: Add FloatRange to public GlEffect impl interfaces.
Using these annotations/checkers should hopefully make it marginally harder to use the wrong input values in the API.

PiperOrigin-RevId: 510966941
2023-02-24 09:49:37 +00:00
christosts
cbb6878f9f Skip rendering multiple frames on the same vsync
When rendering frames at a rate higher than the screen refresh rate,
e.g. playing at 8x, the player is releasing multiple frames at the same
release time (nanos) which are then dropped by the platform. The output
buffers are available later and as a result MediaCodec cannot keep up
decoding fast enough.

This change skips releasing multiple video frames on the same vsync
period and proactivelly drops the frame. The frame is counted as skipped
rather than dropped to differentiate with frames dropped due to slow
decoding.

PiperOrigin-RevId: 510964976
2023-02-24 09:46:06 +00:00
tonihei
829b49d724 Reduce number of calls to AudioTrack.getPlaybackHeadPosition
This call may cause performance overhead in some situations,
for example if the AudioTrack needs to query an offload DSP
for the current position. We don't need to check this multiple
times per doSomeWork iteration as the value is unlikely to
change in any meaningful way.

PiperOrigin-RevId: 510957116
2023-02-24 09:42:39 +00:00
huangdarwin
6a91b2df51 HDR: Remove comment explaining force sdr behavior with assetloaders.
Before, if the upstream AssetLoader provides HDR to the VideoSamplePipeline when
HDR_MODE_EXPERIMENTAL_FORCE_INTERPRET_HDR_AS_SDR is requested, the
VideoSamplePipeline would attempt to tell the AssetLoader to output SDR, which
could be accomplished via MediaCodec tone-mapping in the AssetLoader.

However, this makes an assumption of the AssetLoader implementation, and
AssetLoaders may not all implement support for decoder tone-mapping. Remove javadoc
attempting to explain how AssetLoaders (ex. custom ones) could behave.

PiperOrigin-RevId: 510956820
2023-02-24 09:39:08 +00:00
samrobinson
363b85226e Pass AudioFormat to ASP#computeNextEncoderInputBufferTimeUs.
This method uses sampleRate, channelCount and pcmEncoding, so passing
AudioFormat is easier.

This will lead into a future change that builds the
encoderInputAudioFormat from encoder.getConfigurationFormat()

PiperOrigin-RevId: 510956177
2023-02-24 09:35:35 +00:00
huangdarwin
ae37d33b18 Effect: Rename to DefaultShaderProgram.
Rename:
* MatrixShaderProgram to DefaultShaderProgram, and
* FinalMatrixShaderProgramWrapper to FinalShaderProgramWrapper.
PiperOrigin-RevId: 510498547
2023-02-24 09:32:08 +00:00
huangdarwin
540f5d681d Effect: Rename to ScaleAndRotateTransformation
Rename ScaleToFitTransformation to ScaleAndRotateTransformation.

This better represents the operations that can be accomplished using this
effect. The name was originally named ScaleToFit* because it's not obvious how
to scale to fit using OpenGL, and this effect handled the scaling to fit in a way that no other MatrixTransformations did.

However, it's hard to discover how to rotate when skimming names of effects, so
it's probably more useful to convey that this effect rotates, than that it
scales to fit.

PiperOrigin-RevId: 510480078
2023-02-24 09:28:37 +00:00
huangdarwin
84fe683ca3 HDR: Add colorinfo to exception logs.
Format.toString unfortunately doesn't log colorInfo, and as Format holds a very
large set of values, it's unclear that it should. ColorInfo is useful for codec
exceptions though, so log this in ExportException.createForCodec.

PiperOrigin-RevId: 510475520
2023-02-24 09:25:07 +00:00
tofunmi
5e93616ad2 fix nits and enhance DefaultVideoFrameProcessorImageFrameOutputTest
resolving comments from 8aa1638fe4.

PiperOrigin-RevId: 510457401
2023-02-24 09:21:39 +00:00
bachinger
a231ff4fa9 Map PLAYER_STATE_LOADING to STATE_BUFFERING
#minor-release
Issue: androidx/media#245
PiperOrigin-RevId: 510456793
2023-02-24 09:18:11 +00:00
tofunmi
8aa1638fe4 Add multi-image input FrameProcessor tests
PiperOrigin-RevId: 510441777
2023-02-24 09:14:39 +00:00
andrewlewis
bd4a5ecf6a Align test codec caps check with real implementation
PiperOrigin-RevId: 510437262
2023-02-24 09:11:12 +00:00
sheenachhabra
241364b960 Change DumpableBox to dump recursively
PiperOrigin-RevId: 510433206
2023-02-24 09:07:32 +00:00
christosts
9170e6f511 Merge branch 'release-v2' into dev-v2 2023-02-17 14:50:29 +00:00
christosts
0c17605ff0 Merge branch 'release' 2023-02-17 14:43:01 +00:00
bachinger
73150cf9c5 Update migration script
Only the version need to be updated. No changes in class or package mappings since the last release.

PiperOrigin-RevId: 510385733
2023-02-17 14:37:01 +00:00
kimvde
2163cfb24a Move generateSilentAudio to Composition
Also rename to forceAudioTrack

PiperOrigin-RevId: 510394620
2023-02-17 14:22:50 +00:00
bachinger
39b74c2d74 Update migration script
Only the version need to be updated. No changes in class or package mappings since the last release.

PiperOrigin-RevId: 510385733
2023-02-17 14:18:23 +00:00
kimvde
ae91615a68 Rename occurences of transform in demo app
PiperOrigin-RevId: 510384933
2023-02-17 14:14:09 +00:00
tofunmi
a4ad85d25a InternalTextureManager: delete texture after use
PiperOrigin-RevId: 510377977
2023-02-17 14:09:55 +00:00
tofunmi
7614ac4778 Update demo app with image input
Adds a new option to the preset file list to show an image for 5secs at 30fps. Also adds an ImageView to show the input image

PiperOrigin-RevId: 510372035
2023-02-17 14:05:40 +00:00
sheenachhabra
48fca7d007 Move BoxesTest.java into muxer module
Following changes are included:
1. Move BoxesTest.java into muxer module.
2. Change test code to use dump file infra.

BoxesTest.java does not cover all the boxes implemented in Boxes.java so created a WI to track it b/269471752

PiperOrigin-RevId: 510219645
2023-02-17 14:01:23 +00:00
huangdarwin
0cb5c58834 HDR: Catch test util decoder support error.
Otherwise, a lack of HDR decoding support will result in the tests checking output files for HDR output, like HdrEditingTest.transform_noRequestedTranscode_hdr10File_transformsOrThrows, failing.

PiperOrigin-RevId: 510213020
2023-02-17 13:57:07 +00:00
samrobinson
9ca1122bed Remove space in exception message.
This space was added by mistake in a prior CL of mine.

PiperOrigin-RevId: 510157363
2023-02-17 13:52:22 +00:00
huangdarwin
aa7abd5518 HDR: Add comment explaining force-SDR and AssetLoader interaction.
PiperOrigin-RevId: 510155318
2023-02-17 13:48:00 +00:00
huangdarwin
7d54f24473 HDR: Put force HDR as SDR into AssetLoader
This allows us to fix usage of HDR_MODE_EXPERIMENTAL_FORCE_INTERPRET_HDR_AS_SDR.

Before, this was checked in the VideoSamplePipeline, which no longer decides on the decoder configuration input format.

PiperOrigin-RevId: 510142097
2023-02-17 13:43:42 +00:00
kimvde
4cc5080db0 Rename occurrences of transform in lib-transformer
PiperOrigin-RevId: 510118760
2023-02-17 13:39:21 +00:00
andrewlewis
37768ed099 Remove Pixel watch check
It's unlikely anyone will try to use Transformer on watches.

PiperOrigin-RevId: 510115645
2023-02-17 13:34:56 +00:00
claincly
f74cd7b17e Fix a missed rename.
PiperOrigin-RevId: 510100709
2023-02-17 13:30:26 +00:00
andrewlewis
ab2cabe3da Check capabilities for more tests
Some of the test methods in `TransformationTest` don't check
capabilities. Add a check just scoped to decoding (not checking
encoding, but the default encoder factory may fall back).

PiperOrigin-RevId: 510088562
2023-02-17 13:25:57 +00:00
kimvde
3f84c86977 Rename TransformationTest to ExportTest
PiperOrigin-RevId: 510087543
2023-02-17 13:21:35 +00:00
huangdarwin
5fee7df622 Effects: Update javadoc to link to method.
PiperOrigin-RevId: 510077348
2023-02-17 13:17:10 +00:00
kimvde
774b44c6e2 Rename TransformationException to ExportException
PiperOrigin-RevId: 510062674
2023-02-17 13:12:44 +00:00
Googler
6867f56658 Update instrumentation to avoid making all constructors public
Previously, any constructors instrumented by Robolectric were made public. This
caused two types of issues:

1) If Android classes had non-public constructors which were made public and
added to the Android API, Robolectric allowed tests to incorrectly use the
constructors on older SDK levels (where they were non-public). This most
commonly occurs for AccessibiltyEvent and AccessibilityNodeInfo.

2) When reflection was used to instantiate classes that were instrumented by
Robolectric, all constructors were accessible, which did not match what
happened when running on an Android test.

Update the instrumentation in Robolectric to prevent making all public
constructors.

PiperOrigin-RevId: 510049123
2023-02-17 13:08:23 +00:00
huangdarwin
413f61b96d Effect: Rename FrameProcessor
Rename FrameProcessor to VideoFrameProcessor, and GlEffectsFrameProcessor to
DefaultVideoFrameProcessor.

Most changes are semi-mechanical, semi-manual find-replace, preserving case:
* "FrameProc" -> "VideoFrameProc" (ex. FrameProcessor -> VideoFrameProcessor, and
   FrameProcessingException -> VideoFrameProcessingException)
* "GlEffectsVideoFrameProc" -> "DefaultVideoFrameProc"

PiperOrigin-RevId: 509887384
2023-02-17 13:04:02 +00:00
andrewlewis
3e5ae92bc6 Fix some minor nits
PiperOrigin-RevId: 509879029
2023-02-17 12:59:36 +00:00
kimvde
58d653b702 Rename occurences of transform in demo app
PiperOrigin-RevId: 510384933
2023-02-17 11:58:05 +00:00
tofunmi
a1f7960eab InternalTextureManager: delete texture after use
PiperOrigin-RevId: 510377977
2023-02-17 11:57:15 +00:00
tofunmi
d20c11442a Update demo app with image input
Adds a new option to the preset file list to show an image for 5secs at 30fps. Also adds an ImageView to show the input image

PiperOrigin-RevId: 510372035
2023-02-17 11:56:24 +00:00
Googler
fc642eb45f Fix error in documentation string
The current javadoc refers to the SessionCallback#onConnected, which doesn't exist.

PiperOrigin-RevId: 510261965
2023-02-17 11:55:35 +00:00
sheenachhabra
6711a59564 Move BoxesTest.java into muxer module
Following changes are included:
1. Move BoxesTest.java into muxer module.
2. Change test code to use dump file infra.

BoxesTest.java does not cover all the boxes implemented in Boxes.java so created a WI to track it b/269471752

PiperOrigin-RevId: 510219645
2023-02-17 11:54:46 +00:00
huangdarwin
da8b4db278 HDR: Catch test util decoder support error.
Otherwise, a lack of HDR decoding support will result in the tests checking output files for HDR output, like HdrEditingTest.transform_noRequestedTranscode_hdr10File_transformsOrThrows, failing.

PiperOrigin-RevId: 510213020
2023-02-17 11:53:53 +00:00
samrobinson
e3484d632f Remove space in exception message.
This space was added by mistake in a prior CL of mine.

PiperOrigin-RevId: 510157363
2023-02-17 11:53:03 +00:00
huangdarwin
77ea31e01c HDR: Add comment explaining force-SDR and AssetLoader interaction.
PiperOrigin-RevId: 510155318
2023-02-17 11:52:13 +00:00
huangdarwin
fb8bbce5f1 HDR: Put force HDR as SDR into AssetLoader
This allows us to fix usage of HDR_MODE_EXPERIMENTAL_FORCE_INTERPRET_HDR_AS_SDR.

Before, this was checked in the VideoSamplePipeline, which no longer decides on the decoder configuration input format.

PiperOrigin-RevId: 510142097
2023-02-17 11:51:23 +00:00
kimvde
221c5afb1b Rename occurrences of transform in lib-transformer
PiperOrigin-RevId: 510118760
2023-02-17 11:50:20 +00:00
andrewlewis
5d8a83f924 Remove Pixel watch check
It's unlikely anyone will try to use Transformer on watches.

PiperOrigin-RevId: 510115645
2023-02-17 11:49:29 +00:00
claincly
cec603393d Fix a missed rename.
PiperOrigin-RevId: 510100709
2023-02-17 11:48:39 +00:00