17426 Commits

Author SHA1 Message Date
tofunmi
18f58d1790 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 21:43:33 +00:00
samrobinson
88fd9e18f5 Simplify TransformerEndToEndTest and TransformerTestRunner.
PiperOrigin-RevId: 497335605
2023-01-04 21:42:37 +00:00
samrobinson
d09fdd1b52 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 21:41:41 +00:00
bachinger
fc22f89fde Remove player listener on the application thread of the player
PiperOrigin-RevId: 497183220
2023-01-04 21:40:32 +00:00
ibaker
69583d0ac1 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 21:39:27 +00:00
ibaker
80603427ab Fix order of playback controls in RTL layout
Issue: androidx/media#227

#minor-release

PiperOrigin-RevId: 497159283
2023-01-04 21:38:29 +00:00
tofunmi
283cbcb464 Specify units for VideoEncoderSettings.
PiperOrigin-RevId: 497113780
2023-01-04 21:37:18 +00:00
tofunmi
bea32abefc Use OverlayEffect for ‘Overlay logo & timer' in transformer demo.
PiperOrigin-RevId: 497112875
2023-01-04 21:36:27 +00:00
kimvde
e8572be6d5 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 21:35:35 +00:00
kimvde
431108063c 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 21:34:25 +00:00
rohks
7fc2cdbe1b 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 21:33:18 +00:00
tofunmi
65dcfbd727 Add support for customizing overlay anchor point.
PiperOrigin-RevId: 496956035
2023-01-04 21:32:10 +00:00
rohks
13c93a3dd6 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 21:31:13 +00:00
bachinger
63352e97e9 Bump IMA SDK version to 3.29.0
Issue: google/ExoPlayer#10845
PiperOrigin-RevId: 496947392
2023-01-04 21:29:59 +00:00
kimvde
f67849afa1 Add IntRange annotation to onTrackCount
PiperOrigin-RevId: 496942702
2023-01-04 21:28:49 +00:00
kimvde
5c4d85c2ed 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 21:27:39 +00:00
bachinger
50090e3927 Update migration script
Issue: google/ExoPlayer#10854
PiperOrigin-RevId: 496922055
2023-01-04 21:26:42 +00:00
kimvde
7c3cffdebe 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 21:25:44 +00:00
rohks
2a77f1e2f9 Optimise bundling for Timeline.Window and Timeline.Period
Improves the time taken to construct playerInfo from its bundle from ~400 ms to ~300 ms.

Also made `Timeline.Window.toBundle(boolean excludeMediaItem)` public as it was required to assert a condition in tests.

PiperOrigin-RevId: 499512353
2023-01-04 20:03:19 +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
samrobinson
7d727c88af Improve encoder resolution capability checking.
Whilst testing fallback functionality, I found that we were
aggressively reducing the resolution if it was not supported. A quick
test found that we could reduce by a much smaller increments.
Performance wise it appears these checks are incredibly quick.

The code for checking supported sizes was duplicated, with one case
having a bug because of this duplication (2/3 case). This CL abstracts
this into a loop.

PiperOrigin-RevId: 499497646
2023-01-04 19:54:54 +00:00
kimvde
e6527ec1dd Merge BaseSamplePipeline and SamplePipeline
PiperOrigin-RevId: 499469006
2023-01-04 19:50:56 +00:00
rohks
9d431a52ef Check bundles in MediaItem to verify keys are skipped
Added another check in each of these tests to make sure we don't add keys to bundle for fields with default values.

Also fixed comments of similar changes in `AdPlaybackStateTest` and `MediaMetadataTest`.

PiperOrigin-RevId: 499463581
2023-01-04 19:47:02 +00:00
kimvde
8a8c81d57f Move video decoding to AssetLoader
PiperOrigin-RevId: 499454273
2023-01-04 19:43:10 +00:00
andrewlewis
bec46b66eb Reduce flakiness of GL release test
Based on experimentation it seems that buffers can occasionally (roughly 1% of test runs) be dropped when rendering off-screen from EGL on the emulator. Specifically, in this test, sometimes after rendering three buffers with distinct timestamps only the first and third buffers' timestamps are handled in the `ImageReader`'s image available callback causing the assertion checking all frames rendered to fail. This behavior seems to be independent of the nanosecond presentation time attached to the buffers (as expected for off-screen rendering).

Introducing a pause of 1 second between rendering each frame reduces the flake rate to around 1/2000. This increases the run time of some of the tests, so this change also removes the 5 second `FRAME_PROCESSING_WAIT_MS` (it seems to be unnecessary when rendering off-screen) and instead uses a latch to wait until the frame processor has handled 'end of stream'.

PiperOrigin-RevId: 499440591
2023-01-04 19:39:12 +00:00
kimvde
6729460993 Demo app fixes
- Do not fail silently if selectedEffects is null.
- Do not add an empty overlay effect to the Transformer to avoid
  transcoding video all the time.

PiperOrigin-RevId: 499168759
2023-01-04 19:35:15 +00:00
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