629 Commits

Author SHA1 Message Date
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
rohks
55b82ff8ae Disable failing tests of FlacExtractorSeekTest
PiperOrigin-RevId: 485061783
2022-11-01 16:19:10 +00:00
samrobinson
2390322a00 Disable the muxer watchdog if all tracks have ended.
PiperOrigin-RevId: 484512661
2022-10-31 16:40:45 +00:00
kimvde
42057cc9f8 Add test for muxer watchdog timer
PiperOrigin-RevId: 484298261
2022-10-31 16:33:25 +00:00
kimvde
376ee77f52 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 16:22:31 +00:00
samrobinson
dda17db261 Move AudioProcessor to common.
PiperOrigin-RevId: 483699606
2022-10-31 16:03:50 +00:00
samrobinson
a7bfa12eec 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 15:49:17 +00:00
kimvde
e3f28421fd 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:43:32 +00:00
kimvde
d213b93958 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:31:25 +00:00
bachinger
28c4be2f6b Map lib-effect from androidx to exoplayer2
PiperOrigin-RevId: 482179761
2022-10-20 03:15:38 +00:00
kimvde
bd9181e6ba Remove deprecated setOutputMimeType
This is to prepare Muxer to become public

PiperOrigin-RevId: 481893842
2022-10-20 02:53:21 +00:00
samrobinson
b6bd35860c Fix parameter comment block.
#cleanup

PiperOrigin-RevId: 481882181
2022-10-20 02:49:37 +00:00
kimvde
b4d7f066dd 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-20 02:42:22 +00:00
kimvde
8962f5a3f4 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-20 01:54:12 +00:00
huangdarwin
faa796d736 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-20 01:13:42 +00:00
huangdarwin
36e41059ea 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-20 00:45:11 +00:00
huangdarwin
b9a3aa5ca1 HDR: Add tests with HLG10 input.
PiperOrigin-RevId: 478019046
2022-10-20 00:38:08 +00:00
huangdarwin
9786802527 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-10-20 00:27:26 +00:00
huangdarwin
05ce639ea0 HDR: Add period to end of error message.
For tone mapping error messages.

PiperOrigin-RevId: 477447799
2022-10-20 00:20:19 +00:00
huangdarwin
507a1be61d HDR: Add tests for tone mapping.
Also, add checks for output file color.

PiperOrigin-RevId: 477439139
2022-10-20 00:16:37 +00:00
huangdarwin
df58107eae HDR: Assert output C.ColorTransfer for tests.
To confirm that tone mapping did or did not happen.

PiperOrigin-RevId: 476354606
2022-10-19 23:20:59 +00:00
leonwind
afd829e5db Add OETF and EOTF ES2 fragment shaders for non-HDR frames.
* Transform the intermediate color space to linear SDR by applying the SMPTE 170M EOTF and OETF.
* Use linear colors for the color filter pixel tests and update all golden bitmaps.

PiperOrigin-RevId: 476124592
2022-10-19 23:13:26 +00:00
samrobinson
08bb01b218 Add file size to TransformationResult at the end of a Transformation.
Tested:
  * Manually using both path and file descriptor.
PiperOrigin-RevId: 475860978
2022-10-19 23:02:18 +00:00
samrobinson
6dd2a6dac6 Add support for skipping windows in MssimCalculator.
By skipping every other row and column, SSIM calculation time reduces by 10-30%.

PiperOrigin-RevId: 474286702
2022-10-19 22:35:54 +00:00
samrobinson
20aa22c9fa Add MssimCalculatorTest to verify SSIM calculations.
As part of this change, MssimCalculator is moved from androidTest/ to main/

PiperOrigin-RevId: 473771344
2022-10-19 22:24:34 +00:00
samrobinson
8f9c9d0f88 Rollback of eb6c1183b6
*** Original commit ***

Handle int instead of byte in SSIM.

The value of pixels are converted to integers at the point of use,
move this logic to the initialisation step.

This is a prerequisite step for testing SSIM calculation, which
will lead on to some SSIM improvements being verifiable.

Tested manually and SSIM values match for the same video
before and after this change.

***

PiperOrigin-RevId: 473259446
2022-10-19 22:06:07 +00:00
samrobinson
eb6c1183b6 Handle int instead of byte in SSIM.
The value of pixels are converted to integers at the point of use,
move this logic to the initialisation step.

This is a prerequisite step for testing SSIM calculation, which
will lead on to some SSIM improvements being verifiable.

Tested manually and SSIM values match for the same video
before and after this change.

PiperOrigin-RevId: 473231779
2022-10-19 22:02:35 +00:00
huangdarwin
41963fce9b Decoder: Reduce max pending frame count limit down to 5.
PiperOrigin-RevId: 473212543
2022-10-19 21:55:20 +00:00
huangdarwin
8ee2121627 HDR: Add fallback MH tests.
Test that HDR editing succeeds on devices supporting HDR editing, tone maps on
devices supporting tone mapping, and throws exceptions on all other devices.

Also, only restrict HDR editing and tone mapping support to API 31+ only when
transcoding, not for all transformations.

PiperOrigin-RevId: 472958965
2022-10-19 21:44:21 +00:00
claincly
caefa565f7 Remove conditional check for no-longer flaky API version
PiperOrigin-RevId: 472949850
2022-10-19 21:40:42 +00:00
claincly
9a9baa54a5 Remove redundant constant definition
PiperOrigin-RevId: 472522846
2022-10-19 21:25:53 +00:00
claincly
6e45824992 Include CamcorderProfile resolution in encoder capability test
PiperOrigin-RevId: 472459423
2022-10-19 21:07:09 +00:00
huangdarwin
8e14611d60 Minor javadoc and scoping cleanup.
No functional changes.

PiperOrigin-RevId: 472245797
2022-10-19 20:44:40 +00:00
huangdarwin
1a4cd549a4 Rename shouldPassthrough to shouldTranscode
shouldPassthrough's internal checks seem to be check whether we should *not*
pass through, which seemed a bit like a confusing double-negative to me.

shouldTranscode is slightly more clear, by instead returning true when we do
want to transcode.

No functional changes intended.

PiperOrigin-RevId: 471753771
2022-10-19 20:36:58 +00:00
Googler
94713a8ffb Skip transcoding if HDR video does not need encoding.
3b0d2c1586 made `shouldPassthrough` always return false for `enableHdrVideoEditing`:

>We force using `FrameEditor` (no passthrough) to avoid the need to select another edit operation, and use the new shaders. The `EGLContext` and `EGLSurface` also need to be set up differently for this path.

However, this was introduced before the `videoNeedsEncoding` setting was introduced in 3f615040c0. That setting should apply to HDR videos as much as SDR videos.

PiperOrigin-RevId: 471569853
2022-10-19 20:33:15 +00:00
ibaker
e285e70785 Remove media3-only line from exoplayer2 build.gradle file
#minor-release

PiperOrigin-RevId: 470999044
2022-10-19 20:03:06 +00:00
andrewlewis
1023254d8e Update color info mismatch test
This should now expect transformation to succeed.

PiperOrigin-RevId: 470950411
2022-10-19 19:55:44 +00:00