715 Commits

Author SHA1 Message Date
samrobinson
16ea364478 Merge feedXFromInput and feedXFromSilence in ATSP.
PiperOrigin-RevId: 492195931
2022-12-12 11:58:57 +00:00
samrobinson
5d2cc8dc36 Add an E2E test for changing sample rate with AudioProcessor.
PiperOrigin-RevId: 492160193
2022-12-12 11:41:47 +00:00
samrobinson
32bed82897 Add an option to force a silent audio track.
PiperOrigin-RevId: 492154544
2022-12-12 11:37:35 +00:00
claincly
e4db710deb Fix Samsung MediaCodec encoder reports incorrect timestmp in EOS
PiperOrigin-RevId: 492023573
2022-12-12 11:15:41 +00:00
huangdarwin
2652d0efd7 Transformer: Move getMaxPendingFrameCount logic to constructor.
Also, use the mediaCodecName passed into the constructor to get the
maxPendingFrameCount.

PiperOrigin-RevId: 491985044
2022-12-12 11:07:04 +00:00
claincly
c308802ad1 Add function to clear the cached list of encoders
EncoderUtil using a static list to cache encoders means it's not possible to
use a different set of encoders for different tests when running all
robolectric tests together.

PiperOrigin-RevId: 491959350
2022-12-12 10:58:04 +00:00
kimvde
ed20420b9b Move audio decoding to AssetLoader
PiperOrigin-RevId: 491933937
2022-12-12 10:53:48 +00:00
huangdarwin
4496cf551f HDR: Limit Z Fold 4 c2.qti decoder pending frame count.
Bypass Z Fold 4 HDR10 tone-mapping bug by limiting the max frame count to 12.

This passed with a value of 14, and failed with a value of 15, but I figured I'd use 12 just to be safe.

PiperOrigin-RevId: 491684058
2022-12-12 10:41:20 +00:00
samrobinson
349144f65d Change TransformerInternal durationMs to durationUs.
Follow-up CLs will use this duration for silent audio.

PiperOrigin-RevId: 491670359
2022-11-29 19:57:09 +00:00
claincly
18280723be Move audio MIME type fallback away to ATSP
PiperOrigin-RevId: 491660842
2022-11-29 19:53:30 +00:00
kimvde
9bd79ebdcd Move sample processing to transformer thread
PiperOrigin-RevId: 491623586
2022-11-29 19:46:03 +00:00
claincly
532e0ffdc3 Move video encoding MIME type fallback to VTSP
Main change:

- Removed `Codec.EncoderFactory.createForVideoEncoding`'s argument of a list
of allowed MIME types
- Moved the check for whether a video MIME type is supported to VTSP

PiperOrigin-RevId: 491611799
2022-11-29 19:38:43 +00:00
claincly
51d1c0b892 Fix VideoEncoderSetting.bitrate is ignored when set
PiperOrigin-RevId: 491377695
2022-11-29 19:31:11 +00:00
kimvde
2a0dc414da Add Transformer internal thread
This thread just starts the player and handles the player callbacks for
now. Sample pipelines are still run on the playback thread.

PiperOrigin-RevId: 491299671
2022-11-29 19:11:59 +00:00
samrobinson
fd40cd4a25 Bump muxer watchdog abort timer default timeout to 10s.
PiperOrigin-RevId: 490756055
2022-11-29 18:36:07 +00:00
kimvde
df2c9ce4ec Surface player release timeouts
Also make sure the demo app doesn't crash when it happens.

PiperOrigin-RevId: 490725959
2022-11-24 15:37:38 +00:00
huangdarwin
6ca67af455 Tests: Set SSIM decoder KEY_PRIORITY to 1.
This reduces the priority to best effort (from the default that seems to be best effort), and allows us to run SSIM even on 8k24fps video. Without this CL,
start()'ing a second codec may result in a MediaCodec.CodecException.

Tested to confirm that transformation8k24():
* fails deterministically without this CL, or with KEY_PRIORITY set to 0.
* succeeds deterministically after this CL (~18s on Samsung Z Fold 4)

PiperOrigin-RevId: 490570416
2022-11-24 15:11:33 +00:00
huangdarwin
87e98b483b Transformer: Document when OMX video codecs will no longer exist.
We cannot check this in code, due to DEVICE_INITIAL_SDK_INT being a @SystemApi, and
reflection being a bit risky/unstable.

PiperOrigin-RevId: 490537916
2022-11-24 15:07:49 +00:00
huangdarwin
e61ff42adb Transformer: Remove obsolete TODO from TransformationException.
The bug has since been fixed.

The values still could change, as the API is labelled as @UnstableApi, so it's
probably fine to leave the <p> tag mostly as is.

PiperOrigin-RevId: 490509205
2022-11-24 15:00:08 +00:00
huangdarwin
4d421e7bd4 Tests: Move codec configure() out of VideoDecodingWrapper constructor.
This allows us to release both codecs used in SSIM when one fails to
configure() or start().

Tested and confirmed that on Samsung Galaxy Z Flip 4, running all
TransformationTest.java tests, tests after transform8k24() fails to start the
2nd codec:
* Before this CL, all fail.
* After this CL, all pass.

PiperOrigin-RevId: 490461560
2022-11-24 14:43:34 +00:00
samrobinson
c1e292374d Fix SpeedChangingAudioProcessor handling of EMPTY_BUFFER.
PiperOrigin-RevId: 490265564
2022-11-24 14:38:59 +00:00
huangdarwin
82b59b7228 Tests: Throw exception when network is needed but not available.
This exception is a bit shorter and more clear (and is more clear that this is a
test issue, as opposed to the prior issue that was thrown as an ExoPlayer
DataSourceException, which may seem like a legitimate Transformer failure)

PiperOrigin-RevId: 490252772
2022-11-22 17:52:20 +00:00
huangdarwin
0d863ddc91 HDR Tests: Rename remote URIs to REMOTE instead of ASSET.
Following naming conventions throughout AndroidTestUtil, REMOTE files should have REMOTE instead of ASSET. Update the URI and FORMAT names accordingly.

PiperOrigin-RevId: 490237673
2022-11-22 17:48:23 +00:00
kimvde
b75b421353 Refactor progress logic to be thread safe
PiperOrigin-RevId: 489984147
2022-11-22 09:47:45 +00:00
kimvde
19bf020d84 Build TransformationResult only when transformation succeeded
PiperOrigin-RevId: 489442518
2022-11-21 15:46:56 +00:00
kimvde
59badba5fb Make sure Muxer is always accessed from playback thread
This thread will become the Transformer internal thread.

PiperOrigin-RevId: 489168435
2022-11-21 14:42:47 +00:00
kimvde
ea7e8cff3a Refactor transformation completion
PiperOrigin-RevId: 488929446
2022-11-21 14:27:00 +00:00
huangdarwin
79cc8a5956 HDR: Use HdrMode IntDef to select HDR output mode.
This is a simpler API to use than the prior tone mapping, HDR editing, and
forceInterpretHdrAsSdr options

PiperOrigin-RevId: 488742391
2022-11-16 12:38:01 +00:00
samrobinson
01e0db62f3 Utilize AudioProcessingPipeline in Transformer.
Provides an API for applications to set AudioProcessors for use
in Transformer.

PiperOrigin-RevId: 488621242
2022-11-16 12:21:36 +00:00
kimvde
4477eec38a Move progress computation to TransformerInternal
AssetLoader will have multiple implementations and be customizable. We
want to remove the responsibility of computing the progress from this
class and centralize the logic in TransformerInternal.

PiperOrigin-RevId: 488608890
2022-11-16 12:14:07 +00:00
huangdarwin
53978104e6 HDR: For HDR videos, enableHdrEditing by default.
Previously, tone-mapping was the default.

PiperOrigin-RevId: 488362209
2022-11-14 17:31:08 +00:00
huangdarwin
680f0c3af7 HDR: Add public HLG test file.
Add an HLG Pixel 7 Pro video and its associated format for testing.

PiperOrigin-RevId: 488353926
2022-11-14 17:22:26 +00:00
kimvde
6d266bfc0d Remove asyncErrorListener
PiperOrigin-RevId: 488310077
2022-11-14 17:18:45 +00:00
samrobinson
3f1b1b70ed Remove checkNotNull from Transformer build method.
PiperOrigin-RevId: 487811903
2022-11-14 17:15:01 +00:00
huangdarwin
681de4e763 HDR: Require transcoding when forceInterpretHdrVideoAsSdr is set.
PiperOrigin-RevId: 487786326
2022-11-14 17:11:18 +00:00
kimvde
acfea39235 Fix bug where streamOffsetUs is passed instead of streamPositionUs
Also make order of streamStartPositionUs and streamOffsetUs consistent

PiperOrigin-RevId: 487511633
2022-11-10 16:17:50 +00:00
kimvde
97589f126c Remove dependency on muxer from ExoPlayerAssetLoader
PiperOrigin-RevId: 487487259
2022-11-10 15:55:01 +00:00
kimvde
ef568d2061 Add TransformerInternal
The player is still driving the transformation at this point. The
transformer thread will be added in another CL.

PiperOrigin-RevId: 487479148
2022-11-10 15:43:39 +00:00
huangdarwin
8bdd2784d3 HDR: Implement ForceInterpretHdrVideoAsSdr
Also, document that we tone map when no HDR features are explicitly set

PiperOrigin-RevId: 487310971
2022-11-10 15:09:41 +00:00
claincly
d6c8e3a8af Set HDR color info on FrameworkMuxer
Not setting the color info results in a missing "colr" box in the produced
container, under file/moov/trak/mdia/minf/stbl/stsd/hvc1. This means extractors
will not be able to find out the transcoded file is HDR.

In `Transformer`, this means it can't transcode this transcoded file, because
it currently relies on the container bearing HDR info to construct the
transcoding sample pipeline.

PiperOrigin-RevId: 487276712
2022-11-10 15:04:06 +00:00
sheenachhabra
4598cc9248 Change UnsupportedEncodingException to IllegalArgumentException
In startTransformation method we were throwing UnsupportedEncodingException (IOException) when mediaItem with unsupported arguments is passed.
Changed this to IllegalArgumentException which seems more logical here.

PiperOrigin-RevId: 487259296
2022-11-10 14:58:34 +00:00
kimvde
5d1cab0cf5 Add ExoPlayerAssetLoader
Just move some code around for now, to start setting up the overall
structure.

PiperOrigin-RevId: 487229329
2022-11-10 14:52:53 +00:00
kimvde
b59fdf5e98 Move slow mo logic to sample pipelines
This is to avoid having this logic in TransformerInternal once it is
added.

PiperOrigin-RevId: 487159941
2022-11-10 14:39:11 +00:00
kimvde
d8754b6642 Move muxing inside sample pipelines
This logic is currently in the player renderers. With multi-asset, the
renderers will go into the AssetLoader, which shouldn't be responsible
for muxing.

PiperOrigin-RevId: 486860502
2022-11-08 14:37:35 +00:00
sheenachhabra
b10b4e6d46 Move muxer initialization off application thread
Problem: We are initialising muxer as soon as we start the transformation. Now the startTransformation() method can be called from main thread, but muxer creation is an I/O operation and should be not be done on main thread.

Solution: Added lazy initialisation of muxer object. The actual transformation happens on background thread so the muxer will be initialised lazily from background thread only.

Another way was to provide an initialize() method on MuxerWrapper which will explicitly initialise muxer object but with this approach the caller need to call the initialise method before calling anything else. With current implementation the renderers are calling MuxerWrapper methods on various callbacks (Not sequentially) and also we are sharing same muxer with multiple renderers so It might become confusing for the caller on when to call the initialise() method. Also there are few methods on MuxerWrapper which dont really need muxer object. So in short it might make MuxerWrapper APIs more confusing.

Validation: Verified the transformation from demo app.
PiperOrigin-RevId: 486735787
2022-11-08 14:33:40 +00:00
huangdarwin
0b7e5bbad2 HDR: Set decoder codec profile and level if available.
This should be necessary to ensure decoders see fewer errors.

Setting this resulted in removing native_dequeueOutputBuffer errors on OMX.MTK decoders for in-app tone mapping prototyping.

PiperOrigin-RevId: 486715941
2022-11-08 14:29:43 +00:00
huangdarwin
0b53c934d8 HDR: Update test FileUtil to handle null ColorInfo.
PiperOrigin-RevId: 486706595
2022-11-08 14:25:45 +00:00
huangdarwin
bd4e58d68b HDR Test: Add link to tested method.
PiperOrigin-RevId: 485890141
2022-11-08 14:13:49 +00:00
huangdarwin
2ddd645a34 Apply tone mapping workaround to Pixel Watch as well.
Not sure what BUILD.ID the fix will first be applied on though.

PiperOrigin-RevId: 485389618
2022-11-08 13:54:19 +00:00
huangdarwin
6de5d9336d HDR: Generalize Pixel 6 workaround to TP
PiperOrigin-RevId: 485366659
2022-11-08 13:46:35 +00:00