494 Commits

Author SHA1 Message Date
kimvde
e12dd1ac5d Surface player release timeouts
Also make sure the demo app doesn't crash when it happens.

PiperOrigin-RevId: 490725959
2022-11-24 15:00:34 +00:00
huangdarwin
7d45b9d83a 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 14:52:09 +00:00
huangdarwin
d74eb7500f 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 14:51:06 +00:00
huangdarwin
2693ca138d 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 14:47:37 +00:00
huangdarwin
0a176d1f05 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:40:47 +00:00
samrobinson
af1d7b9b1b Fix SpeedChangingAudioProcessor handling of EMPTY_BUFFER.
PiperOrigin-RevId: 490265564
2022-11-24 14:36:14 +00:00
huangdarwin
4d50e0221e 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:43:08 +00:00
huangdarwin
d0c5168902 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:42:01 +00:00
kimvde
d8eec16369 Refactor progress logic to be thread safe
PiperOrigin-RevId: 489984147
2022-11-22 10:10:21 +00:00
kimvde
56cf5e0774 Build TransformationResult only when transformation succeeded
PiperOrigin-RevId: 489442518
2022-11-22 10:04:56 +00:00
kimvde
f658fe79b1 Make sure Muxer is always accessed from playback thread
This thread will become the Transformer internal thread.

PiperOrigin-RevId: 489168435
2022-11-22 09:50:13 +00:00
kimvde
1ee185cb10 Refactor transformation completion
PiperOrigin-RevId: 488929446
2022-11-22 09:44:47 +00:00
huangdarwin
53cff556bf 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:16:21 +00:00
samrobinson
7b2547271a Utilize AudioProcessingPipeline in Transformer.
Provides an API for applications to set AudioProcessors for use
in Transformer.

PiperOrigin-RevId: 488621242
2022-11-16 12:11:47 +00:00
kimvde
66dc6b3242 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:09:03 +00:00
huangdarwin
6820704b08 HDR: For HDR videos, enableHdrEditing by default.
Previously, tone-mapping was the default.

PiperOrigin-RevId: 488362209
2022-11-14 17:54:51 +00:00
huangdarwin
0cd1edd834 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:52:37 +00:00
kimvde
e1a9ce71df Remove asyncErrorListener
PiperOrigin-RevId: 488310077
2022-11-14 17:51:36 +00:00
samrobinson
83b4d00081 Remove checkNotNull from Transformer build method.
PiperOrigin-RevId: 487811903
2022-11-14 17:50:29 +00:00
huangdarwin
b6d49ec59b HDR: Require transcoding when forceInterpretHdrVideoAsSdr is set.
PiperOrigin-RevId: 487786326
2022-11-14 17:49:28 +00:00
kimvde
c9fe52bf67 Fix bug where streamOffsetUs is passed instead of streamPositionUs
Also make order of streamStartPositionUs and streamOffsetUs consistent

PiperOrigin-RevId: 487511633
2022-11-10 15:01:18 +00:00
kimvde
07f0589ce7 Remove dependency on muxer from ExoPlayerAssetLoader
PiperOrigin-RevId: 487487259
2022-11-10 14:51:53 +00:00
kimvde
1d888d20dc 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 14:49:40 +00:00
huangdarwin
2ff5dab003 HDR: Implement ForceInterpretHdrVideoAsSdr
Also, document that we tone map when no HDR features are explicitly set

PiperOrigin-RevId: 487310971
2022-11-10 14:41:05 +00:00
claincly
3c74e076fe 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 14:39:53 +00:00
sheenachhabra
818bf4a20a 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:37:52 +00:00
kimvde
95f37b4df8 Add ExoPlayerAssetLoader
Just move some code around for now, to start setting up the overall
structure.

PiperOrigin-RevId: 487229329
2022-11-10 14:35:49 +00:00
kimvde
714e556505 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:33:47 +00:00
kimvde
61471474c7 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 11:37:31 +00:00
sheenachhabra
eb357654bb 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 11:36:30 +00:00
huangdarwin
e510d9903f 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 11:34:35 +00:00
huangdarwin
23e724a00b HDR: Update test FileUtil to handle null ColorInfo.
PiperOrigin-RevId: 486706595
2022-11-08 11:33:27 +00:00
huangdarwin
58b32b6129 HDR Test: Add link to tested method.
PiperOrigin-RevId: 485890141
2022-11-08 11:26:45 +00:00
huangdarwin
91b286c4f8 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 11:20:09 +00:00
huangdarwin
a65ff85a98 HDR: Generalize Pixel 6 workaround to TP
PiperOrigin-RevId: 485366659
2022-11-08 11:17:58 +00:00
samrobinson
bcc2fe4007 Disable the muxer watchdog if all tracks have ended.
PiperOrigin-RevId: 484512661
2022-10-31 11:47:54 +00:00
kimvde
1730334133 Add test for muxer watchdog timer
PiperOrigin-RevId: 484298261
2022-10-31 11:45:55 +00:00
kimvde
16cb5cbc1f Add muxer timer to detect when generating an output sample is too slow
This allows to throw when the Transformer is stuck or is too slow.

PiperOrigin-RevId: 484179037
2022-10-31 11:39:28 +00:00
samrobinson
fc34542864 Move AudioProcessor to common.
PiperOrigin-RevId: 483699606
2022-10-31 11:34:30 +00:00
samrobinson
8723e74b1f Add CanIgnoreReturnValue to AudioProcessor#configure + implementations
Although it can be useful to check the output format, it's not required or needed.

For some AudioProcessor implementations, it is stated/obvious that
the output format will match the input, in which case there is no
a need to check the return value.

#cleanup

PiperOrigin-RevId: 483403679
2022-10-31 11:29:28 +00:00
kimvde
e6d5595545 Remove muxerFactory dependency on playerListener
This listener will need to be passed to the MuxerWrapper to throw when
the Transformer is stuck.

PiperOrigin-RevId: 482433552
2022-10-24 10:46:26 +00:00
kimvde
cf14d0687d Make Muxer public
The reason for making the Muxer public is that we want to add an option
to disable or configure the timer that will throw when the muxer doesn't
receive any data for a given period of time.

PiperOrigin-RevId: 482199360
2022-10-24 10:42:42 +00:00
kimvde
9221b1251c Remove deprecated setOutputMimeType
This is to prepare Muxer to become public

PiperOrigin-RevId: 481893842
2022-10-24 10:32:43 +00:00
samrobinson
7ac7e643ac Fix parameter comment block.
#cleanup

PiperOrigin-RevId: 481882181
2022-10-24 10:31:37 +00:00
kimvde
3399f4ecdf Add DefaultMuxer forwarding to FrameworkMuxer
- The naming DefaultMuxer is more consistent with the rest of
Transformer codebase (e.g. DefaultEncoderFactory).
- By hiding the implementation details of DefaultMuxer, the transition
to in-app Muxer will be seamless for apps using DefaultMuxer.
- The current plan is that DefaultMuxer will become the in-app muxer.

PiperOrigin-RevId: 481838790
2022-10-24 10:29:27 +00:00
kimvde
2786db9e73 Remove supportsSampleMimeType from Muxer.Factory
- This method is redundant with getSupportedSampleMimeTypes().
- This is to prepare the Muxer class to become public.

PiperOrigin-RevId: 480840902
2022-10-17 15:54:39 +00:00
huangdarwin
8548e3519e HDR: Disable tone mapping on unsupported pixel build ID.
Also, update tests to allow AnyOf error codes, and no longer check exception messages, which caused quite a bit of churn.

PiperOrigin-RevId: 479570861
2022-10-17 15:38:30 +00:00
huangdarwin
253486d4af HDR: Check isToneMappingApplied in HDR editing test.
Assert that tone mapping is applied when an HDR edit cannot be HDR, but is successfully tone mapped. Meanwhile, assert that fallback, which is applied after codec configuration (which throws the "Tone-mapping requested but not supported by the decoder" error) is not applied when that error is called.

PiperOrigin-RevId: 478762951
2022-10-17 15:28:24 +00:00
huangdarwin
6e5a4c05b5 HDR: Add tests with HLG10 input.
PiperOrigin-RevId: 478019046
2022-10-17 15:25:17 +00:00
huangdarwin
62b95a7190 Test: Rename to avoid redundant substrings.
Rename test files to avoid substrings that can be implied by the directory name,
like "Transformation" and "Test"

No functional changes. Renaming-only.

PiperOrigin-RevId: 477724724
2022-09-30 18:31:56 +00:00