16333 Commits

Author SHA1 Message Date
kimvde
09d431147d Remove unnecessary exceptions in tests
PiperOrigin-RevId: 499160043
2023-01-04 19:30:59 +00:00
kimvde
220a5b9ff3 Misc small fixes
- Improve AssetLoader Javadoc
- Fix Javadoc of sample pipelines
- Improve Javadoc of Transformer.startTransformation
- Move thread hops for Transformer listener callbacks to
  TransformerInternal

PiperOrigin-RevId: 499156604
2023-01-04 19:27:01 +00:00
samrobinson
46f5654643 Deprecated onTransformationError methods are not called.
When a listener method is deprecated, the new method should (by
default) called through to the deprecated one. This is because any
class that implements the method that is now deprecated needs to still
receive that callback.

It appears when onTransformationError(MediaItem, Exception) was
deprecated in favour of onTransformationError(MediaItem,
TransformationException), this deprecation was the wrong way round, and
the newer callback - onTransformationError(MediaItem,
TransformationResult, TransformationException) continued this mistake.

This CL now corrects this.

PiperOrigin-RevId: 498221504
2023-01-04 19:22:56 +00:00
kimvde
8e6daec955 Remove mentions of player in TransformationException
PiperOrigin-RevId: 497921432
2023-01-04 19:19:04 +00:00
tofunmi
967e44c066 Add TextureOverlay.configure() to configure overlay before frame processing
This change allows an overlay to be sized with respect to the video dimensions.

PiperOrigin-RevId: 497337734
2023-01-04 19:15:18 +00:00
samrobinson
2716ff89db Simplify TransformerEndToEndTest and TransformerTestRunner.
PiperOrigin-RevId: 497335605
2023-01-04 19:11:17 +00:00
samrobinson
c0bbfe929a Add a MuxerWrapper listener for events.
Events on the wrapper should be propagated to TransformerInternal as
soon as they occur, switching round the process so TransformerInternal
does not have to query MuxerWrapper.

This CL is a prerequisite for the child CL, where MuxerWrapper can
simplify the internal state and logic.

PiperOrigin-RevId: 497267202
2023-01-04 19:07:29 +00:00
bachinger
965606f7a7 Remove player listener on the application thread of the player
PiperOrigin-RevId: 497183220
2023-01-04 19:03:42 +00:00
ibaker
010c6b96e7 Enable RTL support in the demo app
We might as well keep this enabled by default, rather than having to
manually toggle it on to investigate RTL issues like Issue: androidx/media#227.

PiperOrigin-RevId: 497159744
2023-01-04 18:59:55 +00:00
ibaker
8313af1677 Fix order of playback controls in RTL layout
Issue: androidx/media#227

#minor-release

PiperOrigin-RevId: 497159283
2023-01-04 18:56:03 +00:00
tofunmi
7ce7e0aefd Specify units for VideoEncoderSettings.
PiperOrigin-RevId: 497113780
2023-01-04 18:52:15 +00:00
tofunmi
1fa7f22367 Use OverlayEffect for ‘Overlay logo & timer' in transformer demo.
PiperOrigin-RevId: 497112875
2023-01-04 18:48:33 +00:00
kimvde
7c980f12db Ensure AssetLoader callbacks are always called in the right order
Before, it was possible for onDurationUs() and onAllTracksRegistered()
to be called before onTrackAdded() because they are called from
different threads. onDurationUs() and onAllTracksRegistered() are called
from the Transformer internal thread, and onTrackAdded() is called from
the playback thread.

PiperOrigin-RevId: 497102556
2023-01-04 18:44:50 +00:00
kimvde
4dddcb00ff Specify the types of samples output by AssetLoader
This is useful if an app passes a custom AssetLoader that can only
output encoded or decoded samples.

PiperOrigin-RevId: 497097492
2023-01-04 18:40:57 +00:00
rohks
f2eac2df71 Optimise bundling for AdPlaybackState using AdPlaybackState.NONE
Did not do this optimisation for `AdPlaybackState.AdGroup` as its length is zero for `AdPlaybackState` with no ads.

No need to pass default values while fetching keys, which we always set in `AdPlaybackState.AdGroup.toBundle()`.

PiperOrigin-RevId: 496995048
2023-01-04 18:37:01 +00:00
tofunmi
4d1283f43e Add support for customizing overlay anchor point.
PiperOrigin-RevId: 496956035
2023-01-04 18:33:09 +00:00
rohks
890fd0a9fb Check MediaMetadata bundle to verify keys are skipped
Added another check in test to make sure we don't add keys to bundle for fields with `null` values.

PiperOrigin-RevId: 496948705
2023-01-04 18:29:15 +00:00
bachinger
8ed515880a Bump IMA SDK version to 3.29.0
Issue: google/ExoPlayer#10845
PiperOrigin-RevId: 496947392
2023-01-04 18:25:18 +00:00
kimvde
b0ac959e19 Add IntRange annotation to onTrackCount
PiperOrigin-RevId: 496942702
2023-01-04 18:21:30 +00:00
kimvde
6ffef38cad Change MuxerWrapper registerTrack to setTrackCount
AssetLoader declares the tracks with a setTrackCount() method. Setting
the track count on the MuxerWrapper is easier than calling
registerTrack() as many times as the number of tracks.

PiperOrigin-RevId: 496933501
2023-01-04 18:17:28 +00:00
bachinger
8e9f83867b Update migration script
Issue: google/ExoPlayer#10854
PiperOrigin-RevId: 496922055
2023-01-04 18:13:35 +00:00
kimvde
33cc844828 Change FallbackListener registerTrack to setTrackCount
AssetLoader declares the tracks with a setTrackCount() method. Setting
the track count on the FallbackListener is easier than calling
registerTrack() as many times as the number of tracks.

PiperOrigin-RevId: 496919969
2023-01-04 18:09:44 +00:00
samrobinson
f6434c6776 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 18:05:38 +00:00
kimvde
f3ec59c87f 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 18:01:52 +00:00
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