721 Commits

Author SHA1 Message Date
samrobinson
83bc474f3c Clarify case where HDR encoder and muxer have no shared mime type.
The prior version (with the call to createEncodingException) could
never occur as select...SupportedMimeType already checks for HDR
editing support. This change ensures we throw before creating an
encoder, gives a better error code and allows future simplifications
around createForCodec (see child CL).

PiperOrigin-RevId: 506308290
2023-02-02 16:05:21 +00:00
kimvde
b8ec982ee3 Pass a Composition to Transformer callbacks
PiperOrigin-RevId: 506304101
2023-02-02 16:01:06 +00:00
kimvde
c67cfbf8ce Undeprecate startTransformation(MediaItem, String)
This overload is helpful to apps transcoding a MediaItem without edits.

PiperOrigin-RevId: 505987852
2023-02-01 15:11:33 +00:00
kimvde
8caf836053 Make Composition fields public
Transformer callbacks will take a Composition instead of a MediaItem.
Apps should be able to see what this Composition contains.

PiperOrigin-RevId: 505976561
2023-02-01 15:07:31 +00:00
huangdarwin
e7ac678ba4 HDR: Add device checks and mh for GL tone mapping PixelTests.
Add checks to GL tone-mapping pixel tests, to ensure the device's decoder, API
version, and OpenGL implementation support GL tone-mapping before attempting it.

These tests should be run on mobile harness, to detect per-device failures, and
so are moved to transforemr/mh. Per b/263395272, these tests should ultimately
be in an effect/mh directory.

PiperOrigin-RevId: 505749974
2023-02-01 14:59:13 +00:00
samrobinson
d7cc12c0da Add check for isIdentity in ChannelMappingMatrix.
Make clearer the intermediate matrix property names.

PiperOrigin-RevId: 505732563
2023-02-01 14:50:46 +00:00
samrobinson
4f61c73df9 Add ChannelMixingMatrix property unit tests.
PiperOrigin-RevId: 505720834
2023-02-01 14:46:24 +00:00
kimvde
e7bc263c4d Pass an EditedMediaItem to AssetLoader.Factory
PiperOrigin-RevId: 505671326
2023-02-01 14:42:11 +00:00
kimvde
47b32594ee Add error message if track is added during transformation
PiperOrigin-RevId: 505670386
2023-02-01 14:38:00 +00:00
kimvde
4a66ad5dd1 Remove ParcelFileDescriptor output from Transformer
ParcelFileDescriptor is quite specific and removing it allows to have
less overloads of startTransformation.

A follow-up CL will undeprecate the overload that takes a MediaItem.

PiperOrigin-RevId: 505670321
2023-02-01 14:33:43 +00:00
huangdarwin
fef3e804a0 Transformer: Make it clear that getExpectedColorInfo is input.
Otherwise, it's not clear if it's the expected output.

Renaming-only change. No functional change intended.

PiperOrigin-RevId: 505103740
2023-02-01 14:25:17 +00:00
samrobinson
f924fcb8b4 Generalise UnhandledAudioFormatException for non-input use cases.
PiperOrigin-RevId: 505084963
2023-02-01 14:12:25 +00:00
kimvde
e5e17d6f2c Add EditedMediaItemSequence and Composition objects
PiperOrigin-RevId: 505047245
2023-02-01 13:59:32 +00:00
kimvde
9759849001 Make setResolution package private
- Usages in 1P apps have been removed.
- setResolution should be removed when refactoring fallback.

PiperOrigin-RevId: 505043425
2023-02-01 13:55:11 +00:00
kimvde
341f2d6b3a Move flattenForSlowMotion to EditedMediaItem
PiperOrigin-RevId: 504867150
2023-02-01 13:50:59 +00:00
samrobinson
728619018b Move audio buffer/array test utility methods to TestUtil.
PiperOrigin-RevId: 504611069
2023-01-25 20:37:34 +00:00
kimvde
5ed72efbe0 Move removeAudio/Video to EditedMediaItem
Also add a Builder to EditedMediaItem to avoid having a constructor with
many optional parameters, or a chain of constructors.

PiperOrigin-RevId: 504588544
2023-01-25 20:25:23 +00:00
samrobinson
7abbd6aa1f Use EMPTY_BUFFER in SpeedChangingAudioProcessorTest.
PiperOrigin-RevId: 504264862
2023-01-25 19:56:51 +00:00
samrobinson
a010ebf7b6 Consolidate TransformationResult.transformationException test usage.
PiperOrigin-RevId: 504257627
2023-01-25 19:48:31 +00:00
samrobinson
f440fea738 Move AudioMixer classes from transformer.audio to transformer package.
Transformer convention has been to avoid splitting into packages unless
necessary.

See https://jlbp.dev/JLBP-2: "Prefer fewer packages over more packages
to avoid unnecessarily publicizing internal details, since any
dependency across package boundaries needs to be public.

PiperOrigin-RevId: 503463294
2023-01-23 13:52:28 +00:00
samrobinson
3055de94ac Don't use transformationResult with timeout/unexpected exceptions.
PiperOrigin-RevId: 503187291
2023-01-23 13:34:51 +00:00
kimvde
4f6b83e2c3 Remove usages of deprecated startTransformation
PiperOrigin-RevId: 503138745
2023-01-23 13:21:42 +00:00
kimvde
45596fcd1e Make startTransformation methods take an EditedMediaItem
Usages of the deprecated methods in Transformer.Builder will be removed
in a follow-up CL.

PiperOrigin-RevId: 502889423
2023-01-23 13:12:54 +00:00
kimvde
a043c8c204 Avoid re-encoding if video effects are no-op
This is to avoid regressions introduced by removing the convenience
methods from TransformationRequest.

PiperOrigin-RevId: 502864512
2023-01-23 13:08:38 +00:00
samrobinson
a44032c59b Add ColorInfo to TransformationResult.
TESTED: Manually verified the ColorInfo is propagated when VSP is used.
PiperOrigin-RevId: 502843773
2023-01-23 12:59:59 +00:00
samrobinson
76af4270a9 Generate silent audio if no audio track is available.
To always generate silent audio, `removeAudio(true)` can be used in conjunction.

PiperOrigin-RevId: 502814315
2023-01-18 13:21:57 +00:00
kimvde
6b6e4993b9 Add EditedMediaItem class
This class will be used in a follow-up CL.

PiperOrigin-RevId: 502615323
2023-01-18 13:16:48 +00:00
samrobinson
2cc64a037c Add resolution fallback for 25% of requested.
If a device only supports 1920x1080 as maximum resolution, then adding
the 25% case ensures 8k is reduced correctly.

PiperOrigin-RevId: 502588364
2023-01-18 13:06:39 +00:00
samrobinson
5da086fe01 Add a unit test to check 2/3 resolution supported.
PiperOrigin-RevId: 502573469
2023-01-18 13:01:35 +00:00
kimvde
55aeb76e0c Add CompositeAssetLoader
This is an AssetLoader that wraps a sequence of AssetLoaders. It will
be used for constrained multi-asset.

This class can currently only concatenate media items with the exact
same format.

PiperOrigin-RevId: 502525796
2023-01-18 12:51:50 +00:00
kimvde
89e14989b3 Remove setScale and setRotationDegrees from TransformationRequest
Also remove usages of TransformationRequest convenience methods
(setScale, setRotationDegrees and setResolution).

Some usages of setResolution can't be removed yet because they are used
for fallback.

PiperOrigin-RevId: 502415748
2023-01-17 03:38:19 +00:00
kimvde
a4f9f9487b Add the possility to shift frame timestamps in SampleConsumer
This is needed for constrained multi-asset to shift the timestamps of
the media items that are not the first in the sequence.

PiperOrigin-RevId: 502409923
2023-01-17 03:30:32 +00:00
claincly
c86d70a98b Allow forcing duration in FrameworkMuxer.
PiperOrigin-RevId: 501865706
2023-01-17 03:02:43 +00:00
huangdarwin
4ade37c48d HDR: Implement PQ to SDR tone-mapping.
Tested manually on the Pixel 7 and Samsung S10.

PiperOrigin-RevId: 501626354
2023-01-17 02:46:59 +00:00
huangdarwin
4f4f28b923 Transformer: Clarify setResolution javadoc.
This class may be removed soon, but in the meantime clarify this method's
javadoc summary fragment to make it marginally clearer that this only affects
the "displayed" height instead of the "encoded" height.

PiperOrigin-RevId: 501582219
2023-01-17 02:39:07 +00:00
huangdarwin
27e71d2f91 Transformer: Simplify EncoderWrapper rotationDegrees logic.
Small refactoring change to simplify the logic a tiny bit by removing one
unnecessary variable. No functional change intended.

PiperOrigin-RevId: 501566533
2023-01-17 02:31:20 +00:00
samrobinson
8fe90562a6 Allow Muxer.writeSampleData to take @C.BufferFlag int flags.
PiperOrigin-RevId: 501314812
2023-01-17 02:11:33 +00:00
kimvde
bbffa8ae27 Remove setDecoderFactory from Transformer
It makes more sense to have it in the AssetLoader now that decoding is
done there, particularly as the decoder factory should rarely be
customized.

Also remove the setter from the AssetLoader.Factory because it's
uncommon to have setters in a factory.

PiperOrigin-RevId: 501244974
2023-01-17 01:59:37 +00:00
kimvde
a5288a20fb Add a queue at the start of the buffer SamplePipelines
This improves performance and makes the code more intuitive.

PiperOrigin-RevId: 501220234
2023-01-17 01:55:45 +00:00
kimvde
4a91a234a8 Remove setters from AssetLoader.Factory
It's unusual to have setters on a Factory.

PiperOrigin-RevId: 501212264
2023-01-17 01:51:45 +00:00
steveanton
25fdc4ed47 Add an audio mixer that combines concurrent audio sources
Design document: go/me-android-audio-mixer

PiperOrigin-RevId: 501048758
2023-01-10 21:03:03 +00:00
samrobinson
2693b6025f Make EncoderBitrateProvider and implementations package private.
There is no API to allow applications to use these currently. Until
that exists, these classes do not need to be public.

PiperOrigin-RevId: 500792401
2023-01-10 20:47:24 +00:00
samrobinson
8cac27a77c Add audio and video values from Format to TransformationResult.
PiperOrigin-RevId: 500789076
2023-01-10 20:43:34 +00:00
samrobinson
8ad26c0d8b Split IAE and ISE cases in MuxerWrapper and improve javadoc.
PiperOrigin-RevId: 500786191
2023-01-10 20:39:43 +00:00
samrobinson
b3831778ef Improve docs and split audio/video order in TransformationResult.
PiperOrigin-RevId: 500776260
2023-01-10 20:35:52 +00:00
kimvde
886063d649 Rename SampleConsumer dequeueInputBuffer to getInputBuffer
This makes more sense as SampleConsumer.dequeueInputBuffer returns the
same buffer as long as it is not queued.

PiperOrigin-RevId: 500631982
2023-01-10 20:31:59 +00:00
kimvde
c642f811a6 Fix sample interleaving
Whether to write a sample or not was based on the timestamp of the
previous sample, rather than the current sample.

PiperOrigin-RevId: 500195279
2023-01-10 20:28:01 +00:00
kimvde
ee37b453dd Split ExoPlayerAssetLoaderRenderer
Split ExoPlayerAssetLoaderRenderer into audio and video renderers.

PiperOrigin-RevId: 500102256
2023-01-10 20:24:03 +00:00
samrobinson
03bb91401d Refactor MuxerWrapper handling of track details.
This brings together the multiple details about a muxer track, and
reduces the need for additional variables and more complicated track
tracking.

PiperOrigin-RevId: 499872145
2023-01-10 20:12:05 +00:00
kimvde
827bd6b8f1 Rename the SamplePipelines
The old names are not really correct anymore because:
- The Audio/VideoTranscodingSamplePipelines do not decode anymore.
- The pipelines now mux the encoded data.

PiperOrigin-RevId: 499498446
2023-01-04 19:59:05 +00:00