17426 Commits

Author SHA1 Message Date
ibaker
37fd65a8e5 Fix recursive loop when registering controller visibility listeners
There are two overloads of this method due to a type 'rename' from
`PlayerControlView.VisibilityListener` to
`PlayerView.ControllerVisibilityListener`. Currently when you call one
overload it passes `null` to the other one (to clear the other listener).
Unfortunately this results in it clearing itself, because it receives
a null call back!

This change tweaks the documentation to clarify that the 'other'
listener is only cleared if you pass a non-null listener in. This solves
the recursive problem, and allows the 'legacy' visibility listener to be
successfully registered.

Issue: androidx/media#229

#minor-release

PiperOrigin-RevId: 496876397
2022-12-21 17:57:57 +00:00
tonihei
b7e887a58d Add error messages to correctness assertions in SimpleBasePlayer
Users of this class may run into these assertions when creating the
State and they need to check the source code to understand why
the State is invalid. Adding error messages to all our correctness
assertions helps to understand the root cause more easily.

PiperOrigin-RevId: 496875109
2022-12-21 17:54:00 +00:00
kimvde
def6f64ea5 Simplify AssetLoader.Listener interface
Replace onTrackRegistered and onAllTracksRegistered with onTrackCount.

PiperOrigin-RevId: 496853037
2022-12-21 17:50:04 +00:00
huangdarwin
904253df07 HDR: Use SDR settings for gamma 2.2 in createEglSurface
PiperOrigin-RevId: 496768072
2022-12-21 17:46:13 +00:00
huangdarwin
ef35170e21 HDR: Add Transformer GL tone mapping test.
PiperOrigin-RevId: 496727803
2022-12-21 17:42:17 +00:00
claincly
8ab8dadf43 Simplify concurrency in FrameProcessingTaskExecutor
This CL replaces concurrent collections and atomic primitives with a single
lock, this way the code is easier to reason about.

PiperOrigin-RevId: 496718057
2022-12-21 17:38:25 +00:00
huangdarwin
dea7ab314a HDR: Implement Transformer HDR to SDR GL tone-mapping API
Note that we simply use GlEffectsFrameProcessor in-app / GL tone-mapping, so PQ->SDR tone-mapping isn't yet implemented.

Tested manually using the demo on Pixel 7, to confirm that device and in-app tone
mapping behave similarly.

PiperOrigin-RevId: 496700231
2022-12-21 17:34:35 +00:00
steveanton
3481d4a15e Add low level audio mixing algorithms
Adds the AudioMixerAlgorithm interface which allows for specialized
implementations of audio mixing that also efficiently convert between
source and mixing formats.

Initial implementation has two algorithms:
1. Float -> float (with channel mixing)
2. S16 -> float (with channel mixing)

PiperOrigin-RevId: 496686805
2022-12-21 17:30:45 +00:00
ibaker
54e79689e9 Document the relationship between Player methods and available commands
#minor-release

PiperOrigin-RevId: 496668378
2022-12-21 17:26:47 +00:00
tofunmi
b055010c11 Create local fallbackDetails to remove checkNotNull.
PiperOrigin-RevId: 496664711
2022-12-21 17:22:55 +00:00
ibaker
f47ad3c2d0 Clarify some Player command and method javadoc
#minor-release

PiperOrigin-RevId: 496661152
2022-12-21 17:19:02 +00:00
tofunmi
987354e5b5 Add fallback details to analysis json.
PiperOrigin-RevId: 496660388
2022-12-21 17:15:08 +00:00
kimvde
18031e25bb Make AssetLoader progress not Transformer specific
To do that, rename PROGRESS_STATE_NO_TRANSFORMATION to
PROGRESS_STATE_NOT_STARTED and update Javadoc of ProgressState to not be
Transformer specific.

PiperOrigin-RevId: 496653460
2022-12-21 17:11:15 +00:00
andrewlewis
14517e463d Fix local asset naming
PiperOrigin-RevId: 496410502
2022-12-21 17:07:21 +00:00
huangdarwin
597fa3f694 HDR: Use local instead of remote file for testing.
This should allow us to focus on HDR failures instead of network buffering
failures when debugging HDR issues.

These files are each used on several files, so it should be more worth the
test binary impact to move these files to local first.

Locally, tests did take less time after this diff

PiperOrigin-RevId: 496398130
2022-12-21 17:03:28 +00:00
kimvde
cd70a5cef5 Move setMediaSourceFactory to ExoPlayerAssetLoader
The MediaSourceFactory won't be used by the other AssetLoaders

In order to do that, ExoPlayerAssetLoader has been made public, and the
DefaultAssetLoaderFactory has become a wrapper around
ExoPlayerAssetLoader.

PiperOrigin-RevId: 496386853
2022-12-21 16:59:35 +00:00
tofunmi
ce766d7622 Create dynamically created shaders for multiple overlays.
PiperOrigin-RevId: 496379904
2022-12-21 16:55:44 +00:00
ibaker
d2a3d8f6fa Fix Dackka error due to param name mismatch
https://developer.android.com/reference/androidx/leanback/media/PlayerAdapter#seekTo(long)

#minor-release

PiperOrigin-RevId: 496378709
2022-12-21 16:51:52 +00:00
ibaker
844428ea32 Remove ellipsis from Player javadoc
PiperOrigin-RevId: 496377192
2022-12-21 16:47:57 +00:00
tonihei
09d37641d1 Add playlist and seek operations to SimpleBasePlayer
These are the remaining setter operations. They all share the same
logic that handles playlist and/or position changes. The logic to
create the placeholder state is mostly copied from ExoPlayerImpl's
maskTimelineAndPosition and getPeriodPositonUsAfterTimelineChanged.

PiperOrigin-RevId: 496364712
2022-12-21 16:40:15 +00:00
tonihei
a032da58a4 Rollback of c566b77449
*** Original commit ***

Add TransformerTestBuilderFactory to make transformer testable by apps

***

PiperOrigin-RevId: 496342997
2022-12-21 16:36:23 +00:00
tonihei
9e4ec92bfd Rollback of 9b82d5317f
*** Original commit ***

Remove extra colons in `build.gradle`s

modulePrefix should include this already.

***

PiperOrigin-RevId: 496337833
2022-12-21 16:32:28 +00:00
claincly
a4bc0959be Support previewing HDR on API33+
FrameProcessor already support using different transfer function for input and
output color. This CL has two major changes:

- Create an eglSurface that recognizes BT.2020 PQ
  - This requires a separate extension that works only after 33
  - So we current throw, if input is HDR, and this extension doesn't work
- Create FrameProcessor with PQ output transfer function

PiperOrigin-RevId: 496023758
2022-12-21 16:28:37 +00:00
tonihei
5e23b8bfd5 Check if codec still exists before handling tunneling events
The tunneling callbacks are sent via Handler messages and may be
handled after the codec/surface was changed or released.

We already guard against the codec/surface change condition by
creating a new listener and verifying that the current callback
happens for the correct listener instance, but we don't guard
against a released codec yet.

PiperOrigin-RevId: 495882353
2022-12-21 16:24:44 +00:00
samrobinson
e4695048a8 Make clear video encoder HighQualityTargeting is experimental.
PiperOrigin-RevId: 495860300
2022-12-21 16:20:47 +00:00
tonihei
a1c0b10482 Clarify behavior for out-of-bounds indices and align implementations
Some Player methods operate relative to existing indices in the
playlist (add,remove,move,seek). As these operations may be issued
from a place with a stale playlist (e.g. a controller that sends
a command while the playlist is changing), we have to handle out-
of-bounds indices gracefully. In most cases this is already
documented and implemented correctly. However, some cases are not
documented and the existing player implementations don't handle
these cases consistently (or in some cases not even correctly).

PiperOrigin-RevId: 495856295
2022-12-21 16:16:54 +00:00
andrewlewis
9b82d5317f Remove extra colons in build.gradles
modulePrefix should include this already.

PiperOrigin-RevId: 495853065
2022-12-21 16:13:05 +00:00
rohks
74559b4a18 Rename EMPTY_MEDIA_ITEM to PLACEHOLDER_MEDIA_ITEM
The `MediaItem` instances in the following cases are not actually empty but acts as a placeholder. `EMPTY_MEDIA_ITEM` can also be confused with `MediaItem.EMPTY`.

PiperOrigin-RevId: 495843012
2022-12-21 16:09:14 +00:00
samrobinson
aecc810937 Pass required value into TransformationTestResult.Builder constructor
PiperOrigin-RevId: 495842393
2022-12-21 16:05:22 +00:00
tofunmi
c566b77449 Add TransformerTestBuilderFactory to make transformer testable by apps
PiperOrigin-RevId: 495821660
2022-12-21 16:01:31 +00:00
claincly
4a3d693c3e Replace Pair with Size in effects.
PiperOrigin-RevId: 495646341
2022-12-21 15:57:19 +00:00
bachinger
33f8f40692 Use theme when loading drawables on API 21+
Issue: androidx/media#220
PiperOrigin-RevId: 495642588
2022-12-21 15:53:14 +00:00
rohks
8dea624c98 Remove parameters with null values from bundle in MediaMetadata
Improves the time taken to construct `playerInfo` from its bundle from ~450 ms to ~400 ms. Each `MediaItem` inside `Timeline.Window` contains `MediaMetadata` and hence is a good candidate for bundling optimisations. There already exists a test to check all parameters for null values when unset.

PiperOrigin-RevId: 495614719
2022-12-21 15:49:22 +00:00
samrobinson
59166cce9c Ensure supported request only updates changes fields.
The TransformationRequest passed to FallbackListener (and
createSupportedTransformationRequest) can have null for values that
are inferred from source. Within fallback, this can be height, width,
video mime type and audio mime type (HDR mode is not linked to source).
requestedFormat has these values populated from source, and
supportedFormat then finds the closest supported values to the
requested.

If any of the values in supportedFormat do not match the
requestedFormat, then this method would build upon the
TransformationRequest and update ALL possible fallback fields. This is
a problem because the fallback listener compares the original request
to the fallback one and notifies about all the fields that have
changed.

This CL changes this so that only the values that are not the same as
requested are changed in the supported request that is given to the
fallback listener.

PiperOrigin-RevId: 496908492
2022-12-21 15:38:48 +00:00
kimvde
cad713d0a3 Fix AS warnings and errors in FloatAudioMixingAlgorithmTest
When trying to run the test on Android Studio, error "incompatible
types: Buffer cannot be converted to ByteBuffer" is logged. This is
because ByteBuffer.flip() returns a Buffer (and not a ByteBuffer).
Annotation @CovariantReturnType on ByteBuffer.flip() should resolve this
automatically but it doesn't seem supported at the moment.
PiperOrigin-RevId: 496894723
2022-12-21 15:38:02 +00:00
ibaker
4087a011e2 Fix recursive loop when registering controller visibility listeners
There are two overloads of this method due to a type 'rename' from
`PlayerControlView.VisibilityListener` to
`PlayerView.ControllerVisibilityListener`. Currently when you call one
overload it passes `null` to the other one (to clear the other listener).
Unfortunately this results in it clearing itself, because it receives
a null call back!

This change tweaks the documentation to clarify that the 'other'
listener is only cleared if you pass a non-null listener in. This solves
the recursive problem, and allows the 'legacy' visibility listener to be
successfully registered.

Issue: androidx/media#229

#minor-release

PiperOrigin-RevId: 496876397
2022-12-21 15:36:58 +00:00
tonihei
6c98f238e4 Add error messages to correctness assertions in SimpleBasePlayer
Users of this class may run into these assertions when creating the
State and they need to check the source code to understand why
the State is invalid. Adding error messages to all our correctness
assertions helps to understand the root cause more easily.

PiperOrigin-RevId: 496875109
2022-12-21 15:35:50 +00:00
kimvde
a4c3038b16 Simplify AssetLoader.Listener interface
Replace onTrackRegistered and onAllTracksRegistered with onTrackCount.

PiperOrigin-RevId: 496853037
2022-12-21 15:34:58 +00:00
huangdarwin
06ccb6e8ed HDR: Use SDR settings for gamma 2.2 in createEglSurface
PiperOrigin-RevId: 496768072
2022-12-21 15:33:51 +00:00
huangdarwin
99b665ca3f HDR: Add Transformer GL tone mapping test.
PiperOrigin-RevId: 496727803
2022-12-21 15:32:50 +00:00
claincly
cb0bc28af2 Simplify concurrency in FrameProcessingTaskExecutor
This CL replaces concurrent collections and atomic primitives with a single
lock, this way the code is easier to reason about.

PiperOrigin-RevId: 496718057
2022-12-21 15:32:00 +00:00
huangdarwin
84c81b8575 HDR: Implement Transformer HDR to SDR GL tone-mapping API
Note that we simply use GlEffectsFrameProcessor in-app / GL tone-mapping, so PQ->SDR tone-mapping isn't yet implemented.

Tested manually using the demo on Pixel 7, to confirm that device and in-app tone
mapping behave similarly.

PiperOrigin-RevId: 496700231
2022-12-21 15:30:54 +00:00
steveanton
9465fe2f98 Add low level audio mixing algorithms
Adds the AudioMixerAlgorithm interface which allows for specialized
implementations of audio mixing that also efficiently convert between
source and mixing formats.

Initial implementation has two algorithms:
1. Float -> float (with channel mixing)
2. S16 -> float (with channel mixing)

PiperOrigin-RevId: 496686805
2022-12-21 15:29:47 +00:00
ibaker
d8c964cfe6 Document the relationship between Player methods and available commands
#minor-release

PiperOrigin-RevId: 496668378
2022-12-21 15:28:56 +00:00
tofunmi
81ffe47b23 Create local fallbackDetails to remove checkNotNull.
PiperOrigin-RevId: 496664711
2022-12-21 15:27:49 +00:00
ibaker
31e875b7a0 Clarify some Player command and method javadoc
#minor-release

PiperOrigin-RevId: 496661152
2022-12-21 15:26:38 +00:00
tofunmi
e1775eeb21 Add fallback details to analysis json.
PiperOrigin-RevId: 496660388
2022-12-21 15:25:48 +00:00
kimvde
97e49ac312 Make AssetLoader progress not Transformer specific
To do that, rename PROGRESS_STATE_NO_TRANSFORMATION to
PROGRESS_STATE_NOT_STARTED and update Javadoc of ProgressState to not be
Transformer specific.

PiperOrigin-RevId: 496653460
2022-12-21 15:24:47 +00:00
tianyifeng
d848d3358a Add BitmapLoader injection in MediaController
Also clean up the strict mode violations of using `BitmapFactory.convertToByteArray` on the main thread.

PiperOrigin-RevId: 496422355
2022-12-21 15:23:38 +00:00
andrewlewis
0744a52b8d Fix local asset naming
PiperOrigin-RevId: 496410502
2022-12-21 15:22:27 +00:00