14778 Commits

Author SHA1 Message Date
Googler
c65acc04d6 Defensively cancel frame processing tasks on error.
FrameProcessingTaskExecutor should be released on error.
There can be a delay until this happens, so
FrameProcessingTaskExecutor will cancel any pending tasks
and drop new tasks until it is released.

PiperOrigin-RevId: 468171820
(cherry picked from commit d11c3be952d4a5cd31b7f629b427bdddcbf3f15c)
2022-08-17 12:25:53 +00:00
leonwind
f555ed46e8 Fix typo
PiperOrigin-RevId: 468152718
(cherry picked from commit c6a10ad2270ecf295dc06ac338eae6367b7887ca)
2022-08-17 10:15:21 +00:00
leonwind
a4175b8607 Compact a RGB Matrix chain into a singular RGB Matrix.
PiperOrigin-RevId: 468013019
(cherry picked from commit 977370e9db8fda16388a56f8979df9f6f6737b60)
2022-08-16 20:39:42 +00:00
tonihei
d5710d3171 Define CueGroup.EMPTY_TIME_ZERO for convenience
We create an empty CueGroup in many places as default or
where none is needed. Instead, we can define a constant
for this purpose and reuse it.

PiperOrigin-RevId: 467944841
(cherry picked from commit 29208ec1ed4d78fa86af33b81a2b32f3151b9004)
2022-08-16 16:27:56 +00:00
huangdarwin
c5b4cbed75 HDR: Update limited range and add full range YUV to RGB color transforms.
PiperOrigin-RevId: 467910378
(cherry picked from commit 130a536287f705ea823c9351d053f01512bf7e3c)
2022-08-16 13:33:32 +00:00
Googler
6d09959810 Allow high-priority tasks to be executed before other tasks.
This is needed as a pre-requisite for allowing MCVR to control
FrameProcessor frame release for previewing.

Submitting a high-priority task is conceptually different from
posting at the front of a single queue of tasks, as the high-priority
tasks are executed in FIFO order among themselves. This will ensure
that frame release tasks submitted in close succession are executed
in the order they are submitted but before any lower priority tasks.

PiperOrigin-RevId: 467675137
(cherry picked from commit 4d81a6db240b0f5b92936d894d59b53cc493e3b2)
2022-08-15 15:27:21 +00:00
christosts
909953b84a Increase max sample size for HEVC.
Increase the estimated max sample size for HEVC by 2x, and set a minimum
size of 2MB. The 2MB will be applied for resolutions up to 1080p, after
which the new calculation takes effect. This is in par with the
platform's HEVC software decoder.

PiperOrigin-RevId: 467641494
(cherry picked from commit d3d5ffce91452ebf1edf51a0c0c9d80ad29fe0b6)
2022-08-15 11:47:42 +00:00
tonihei
770839fe2b Update CMake version for AV1 extension
The specified CMake version doesn't work with the latest
Android Studio releases. Updating to a more recent version
fixes the problem.

Issue: google/ExoPlayer#9933
PiperOrigin-RevId: 467634063
(cherry picked from commit 80b635e7abf3a980b801c49c7975c4963aed7518)
2022-08-15 10:49:44 +00:00
tonihei
d2000fd25f Add initial version of SimpleBasePlayer
This base class will simplify the implementation of custom
Player classes. The current version only supports
available commands and playWhenReady handling.

PiperOrigin-RevId: 467618021
(cherry picked from commit 9a7fde8fde6e194b92ec67095b7b889ee23a3d77)
2022-08-15 08:54:27 +00:00
andrewlewis
9b6d997703 Increase pixel difference threshold
PiperOrigin-RevId: 467610621
(cherry picked from commit ec7936f64d8019c94d69bcd7a31e2002fcaca695)
2022-08-15 07:59:28 +00:00
leonwind
befcc01764 Refactor RgbaMatrix to RgbMatrix.
* Rename all Rgba instances to Rgb.
* Remove alpha value from the RGBA Matrices and apply the 4x4 matrix
only to the R, G, B channels.
* Restore the alpha from the input unchanged.

PiperOrigin-RevId: 467208888
(cherry picked from commit 80f9ad9bf9631a61c06317df54a68be248e23b4f)
2022-08-12 14:51:25 +00:00
Googler
2697916e23 Avoid spinning while queueing input to ExternalTextureProcessor.
This change adds ExternalTextureManager which implements
InputListener to only queue input frames to the
ExternalTextureProcessor when it is ready to accept an input
frame. This replaces the old retry-logic in GlEffectsFrameProcessor.

Before this change, the retrying in GlEffectFrameProcessor wasted
CPU time if input becomes available faster than the
ExternalTextureProcessor can process it.

PiperOrigin-RevId: 467177659
(cherry picked from commit 06ce5ec73898d5e56eb5a2e0f68d4910919c5ea7)
2022-08-12 11:10:47 +00:00
tonihei
ea1e26d9dd Add additional build flags for ffmpeg on "arm64-v8a"
From NDK 23.1.7779620 and above, the arm64-v8a ABI needs additional
build flags to correctly link the ffmpeg libraries.

Issue: google/ExoPlayer#9933
PiperOrigin-RevId: 467161973
(cherry picked from commit 6ea1d0ecf068d866faf2f1c0f4624ae5de872497)
2022-08-12 09:43:22 +00:00
tonihei
5cc23fd972 Add timeout for ad to load.
In some cases, the IMA SDK fails to call the expected loadAd
event to load the next ad to play. This is (potentially) the
only remaining case where playback can get stuck due to missing
calls from IMA as the player doesn't even have a MediaSource at
this stage and is only waiting for IMA to provide the ad URL.

We can reuse the existing adPreloadTimeoutMs that was added for
a similar purpose (when preloading the first ad in the group).
The JavaDoc matches this purpose as well and the default timeout
is appropriate since we expect to get the loadAd call immediately.

Issue: google/ExoPlayer#10510
PiperOrigin-RevId: 466953617
(cherry picked from commit 91fc5c4f3c52c02439d1e65f09fa2d2c1c5fcf05)
2022-08-11 14:59:21 +00:00
Googler
4b3f001032 Fix ChainingGlTextureProcessorListener field name.
PiperOrigin-RevId: 466735554
(cherry picked from commit 43aa89aa2ef04756f185738bbd7c17c236bff879)
2022-08-10 18:01:01 +00:00
huangdarwin
3e4ca2c981 HDR: Clarify tone mapping fallback.
createSupportedTransformationRequest is more accurate than
createFallbackTransformationRequest, as a TransformationRequest will be returned
regardless of whether any fallback is applied.

PiperOrigin-RevId: 466641277
(cherry picked from commit 70972bbab0c884bcc2ef1dfef2177967499c36b6)
2022-08-10 11:25:56 +00:00
Googler
4a4bfc7b96 Avoid spinning in between intermediate texture processors.
This change adds a new method onReadyToAcceptInputFrame to
GlTextureProcesssor.InputListener and changes maybeQueueInputFrame
to queueInputFrame, removing the boolean return value.
This avoids the re-trying in ChainingGlTextureProcessorListener
by allowing it to only feed frames from the producing to the consuming
GlTextureProcessor when there is capacity.

MediaPipeProcessor still needs re-trying when processing isn't 1:1.

PiperOrigin-RevId: 466626369
(cherry picked from commit 9c366b3cfdd06cad046dd5ce1b0ecad21c5c44ba)
2022-08-10 09:56:24 +00:00
huangdarwin
dee5c56475 HDR: Update experimental_setEnableHdrEditing javadoc.
Previously, this feature interpreted SDR signals as HDR when called. Now, only HDR
streams are interpreted as HDR, so the javadoc should be updated. Not yet removing
this method, as there are still some loose ends to finish up (ex. PQ support, e2e
tests).

PiperOrigin-RevId: 466425738
(cherry picked from commit 2d2926b8c0b4cded25616558ed74cb30cc2932fd)
2022-08-09 18:56:08 +00:00
huangdarwin
b84945db62 Demo: Add legacy external storage permission for intents.
Without this permission, files in `/sdcard` or other directories cannot be read by the demo, as they're not in the transformer demo's scoped storage container.

For more information, see https://developer.android.com/training/data-storage/use-cases

Tested by uninstalling and re-installing the demo app, granting permission by
starting a transformation, and launching an intent using a local file in `/sdcard`
to start another transformation. Without this CL, this threw an error, and with
this CL it succeeded.

PiperOrigin-RevId: 466399023
(cherry picked from commit 051dee68e362b8d610a42ac01f7ed9cc5f6b894a)
2022-08-09 17:28:31 +00:00
hmzh
e138a2f0f1 Add JSyn library build instructions for the MIDI module
PiperOrigin-RevId: 466370644
(cherry picked from commit 96a2b149b185206d9e5f079251f8808d39a52e48)
2022-08-09 15:44:44 +00:00
Googler
f18e0f8287 Remove times(1) from effect and transformer tests as it is the default.
PiperOrigin-RevId: 466324322
(cherry picked from commit 95a7dcaedaf617802054e37acdb3d46d4923ccac)
2022-08-09 12:08:39 +00:00
huangdarwin
c0bef3dbf7 HDR: Rename ColorInfo#isHdr to isTransferHdr.
While HDR is most closely tied to the color transfer (ex.
COLOR_TRANSFER_SDR is the only one explicitly mentioning dynamic
range), technically color spaces may be associated with HDR as well,
like BT.2020 commonly being used for HDR rather than BT.709 for SDR.

Therefore, it's more specific to mention just that the transfer is HDR.

PiperOrigin-RevId: 466316960
(cherry picked from commit 7075f78eb26daef44275a6fde5362d5139e6df37)
2022-08-09 11:28:31 +00:00
Googler
c33a8e3d3a Split GlTextureProcessor.Listener into input/output/error listener.
This simplifies ChainingGlTextureProcessor as it now only connects a
consuming and a producing GlTextureProcessor rather than a previous,
current, and next GlTextureProcessor.

Also use default no-op implementations of the listeners in
SingleFrameGlTextureProcessor and MediaPipeProcessor to avoid
null-checks.

PiperOrigin-RevId: 466301642
(cherry picked from commit a2166a414212a4e10c31b72dfa21ff45367ee31a)
2022-08-09 10:05:14 +00:00
huangdarwin
2503c0ee95 HDR: Input ColorInfo to the FrameProcessor.
This allows the GlEffectsFrameProcessor to later handle HLG and PQ
differently, or limited and full color range differently.

No functional change intended in this CL.

PiperOrigin-RevId: 466070764
(cherry picked from commit e444eaa5b76074bbf77a6cab6dfe288665a20204)
2022-08-08 16:55:22 +00:00
hmzh
fb85488d75 Add a custom MIME type for MIDI
PiperOrigin-RevId: 466032455
(cherry picked from commit 3aa99d5efbd87a410dd8177539e54185c6b17176)
2022-08-08 14:02:08 +00:00
andrewlewis
dfc04d8ddf Remove unused log tag constant
PiperOrigin-RevId: 466025324
(cherry picked from commit 273cf0866aad78018da3674ba1cbe11187d16afd)
2022-08-08 13:20:34 +00:00
hmzh
98dd4f88e2 Add support for multiple mid-track tempo changes
PiperOrigin-RevId: 466018462
(cherry picked from commit 4725cff70e3293f43bd11866f305041c6c18792e)
2022-08-08 12:35:28 +00:00
leonwind
1234470e35 Switch @param to @code tags in RgbAdjustment.
PiperOrigin-RevId: 465591877
(cherry picked from commit 650a9d21ec6582230f4cf0dc2120b17d86707715)
2022-08-05 17:20:54 +00:00
andrewlewis
01a4188d68 Throw if tone-mapping is requested but not enabled
In the case where this check fails, the downstream frame processor chain won't be able to handle the incoming (SDR) data anyway as we've already set it up for HDR.

PiperOrigin-RevId: 465584814
(cherry picked from commit 0e99d28a79ddca5ba9517ffba73d2c36fc2679a7)
2022-08-05 16:49:26 +00:00
andrewlewis
1db2c74fb3 Clarify SSIM request method name
`requestCalculateSsim` more clearly represents the intention of the caller.

Also rephrase the javadoc to simplify it and make it more precise.

PiperOrigin-RevId: 465575578
(cherry picked from commit d90d7d30789ec819d905fd98291f66ab7031f47b)
2022-08-05 16:02:07 +00:00
Googler
03b490b47f Fix ConcurrentHashMap usage in demo MediaPipeProcessor.
PiperOrigin-RevId: 465563540
(cherry picked from commit 6e4fc4752248f1a1d233dea041305718cae08cd0)
2022-08-05 14:56:54 +00:00
yschimke
7218cb961b Make AudioTrackBufferSizeProvider public.
Was getting "java.lang.IllegalAccessError: Illegal class access" in debug app.

PiperOrigin-RevId: 465562541
(cherry picked from commit c09b34a61be80f250bac6a5e1f56e8180f68b9e2)
2022-08-05 14:51:07 +00:00
andrewlewis
a0efd08b39 Fix frame processor reference
PiperOrigin-RevId: 465562260
(cherry picked from commit aafa31e996f30daebec12f5e9e61aab1dbd0ba81)
2022-08-05 14:49:23 +00:00
Googler
db2545b8a1 Use multiple output frames in transformer MediaPipe demo pre API 23.
PiperOrigin-RevId: 465545764
(cherry picked from commit 6da0a3543491a9d9bb3dbfaf1b203a04f7a19f5c)
2022-08-05 12:58:48 +00:00
leonwind
e8a4cceb12 Add RgbAdjustment class to build RgbaMatrices
* Add RgbaMatrix interface implementation.
* Add Builder class for easy adjustments.
* Adjust existing RgbaMatrixPixelTests to use new RgbAdjustment class.

PiperOrigin-RevId: 465545429
(cherry picked from commit 6502fce634913420af77ec78c275f97a61b8fac4)
2022-08-05 12:56:26 +00:00
huangdarwin
acf40801cf HDR: Add comment to clarify lack of support HDR10 for AVC
PiperOrigin-RevId: 465360186
(cherry picked from commit e63d594f490da6461bc5087d0526c5ca5215958d)
2022-08-04 18:18:18 +00:00
claincly
e9e7fb4e8a Factor out RTP timestamp to sample time method
PiperOrigin-RevId: 465337074
(cherry picked from commit a1be6d6eb39a40b91f9dee0524d13e5ac805246f)
2022-08-04 16:49:03 +00:00
yschimke
6865cd4d07 Expose AudioOffload track state.
Adds a new event to AudioOffloadListener to get the offload state of the track, which indicates when software decoding is taking place.

PiperOrigin-RevId: 465264362
(cherry picked from commit fe2b846552e1dc0095a409a3407c328e38bd6a30)
2022-08-04 09:47:41 +00:00
yschimke
318d838258 AudioOffload recovery.
Avoids disabling Offload on a write error, and instead relies on this being disabled on the AudioTrack init. It will no longer recover by disabling offload.

PiperOrigin-RevId: 465248917
(cherry picked from commit 2fbe1bbfb3c533c370c07a4f45068c00ea9c6efb)
2022-08-04 08:00:57 +00:00
leonwind
d7177ee733 Remove clamp function in contrast fragment shader.
* OpenGL automatically clamps the output colors to the [0, 1] interval.

PiperOrigin-RevId: 465071999
(cherry picked from commit 30fab8c00891b2a5423c169dd75ef0b7d40fe5b7)
2022-08-03 16:14:30 +00:00
andrewlewis
dce7c45cf0 Avoid encoder default color info when tone-mapping
The encoder color info [defaults](https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/foundation/ColorUtils.cpp;l=377;drc=891c19ccfa4953b5e5f7b87118e007b994d8074c) to a value that depends on the input resolution, but when tone-mapping is enabled we should always get BT.709 color space. Hard-code this constant for now to avoid behavior depending on the resolution. A future change should use the decoder output media format to populate the color info.

PiperOrigin-RevId: 465070378
(cherry picked from commit 40a28d5aeeb5f3c22e884690128182b68a9929f6)
2022-08-03 16:06:45 +00:00
Googler
8d1b91a413 Fix saving previous debugSurfaceView in FinalMatrixTPWrapper.
PiperOrigin-RevId: 465067306
(cherry picked from commit bbb7b1c0bc2dc004612d0644d862494fcdda294d)
2022-08-03 15:52:24 +00:00
claincly
19f6b5422b Clean up NOP constructor lines in RTP readers
PiperOrigin-RevId: 465067191
(cherry picked from commit 13e9ec9959b5dbd6f2f107f43d0a3a032ae8a717)
2022-08-03 15:51:48 +00:00
Googler
ff35958c54 Clean up FrameProcessor TODOs.
PiperOrigin-RevId: 465044342
(cherry picked from commit 245326a0433c82bf851e2fa556bb8399cf1ba2d6)
2022-08-03 13:53:53 +00:00
Googler
89a2685052 Move effects functionality out of transformer to effects module.
PiperOrigin-RevId: 465038852
(cherry picked from commit 707b0618384db17f6d9d4947a445c0eed1c9c630)
2022-08-03 13:19:15 +00:00
Googler
368d28268b Update Leanback library from androidx-platform-dev with build#8803384
TGP: https://fusion2.corp.google.com/presubmit/tap/459592967/OCL:459592967:BASE:464692555:1659412331108:1ed6eb4e/targets

If you need additional help investigating this issue, please consider using g/androidx-discuss to reach the wider Jetpack library owner and client community. For general questions about prebuilt drops, refer to go/androidx/g3_faq

PiperOrigin-RevId: 464852576
(cherry picked from commit a3de13c9a936691113325977924afe242dcbba31)
2022-08-02 19:01:58 +00:00
Googler
0b0475e81b Create effect module.
PiperOrigin-RevId: 464767396
(cherry picked from commit 26dcdcf1c01e1734cda5313487f27a19d4606513)
2022-08-02 12:36:47 +00:00
leonwind
5668c8a6a9 Implement RGBA color matrices processor
* Transform frame colors using a defined RGBA Matrix to apply filters.

PiperOrigin-RevId: 464523581
(cherry picked from commit 23f34f8d08855645b342a75b0adfc6c0d600c0ab)
2022-08-01 13:47:21 +00:00
leonwind
d354cd597b Migrate Contrast asset to emulator generated one.
PiperOrigin-RevId: 464519030
(cherry picked from commit ea213545e0ed3ae2ae7168a0c4ac791d95b594aa)
2022-08-01 13:14:49 +00:00
huangdarwin
153535a300 HDR: Have @C.ColorTransfer check consider NO_VALUE as SDR.
Format.NO_VALUE is a placeholder value for an invalid @C.ColorTransfer, used
for example when the decoder doesn't support this transfer function.

When encountering this invalid value, interpret this as COLOR_TRANSFER_SDR.

Confirmed locally that an exception is thrown when transcoding on p4head, and no exception is thrown when transcoding with this CL.

PiperOrigin-RevId: 464135080
(cherry picked from commit 1a22bcf1e59c1f8e1f8d1fb9d9208a916c92bdb2)
2022-07-29 19:33:44 +00:00