20685 Commits

Author SHA1 Message Date
sheenachhabra
71e36ac6d2 Remove missing frame workaround from TransformerPauseResumeTest
Two devices were producing B-frames earlier and were causing
frame mismatch. So we had added a workaround for them.
Those devices does not produce B-frames now
after disabling high profile on them, so we don't need workaround now.

PiperOrigin-RevId: 633127755
2024-05-13 01:35:34 -07:00
jbibik
8fa72714db Fail MediaSourceFactory creation if the right module is not added
Due to loading a MediaSourceFactory via reflection:

Before this change
* the content type was logged as an integer, rather than a human-readable string
* `ClassNotFoundException` was swallowed silently by `maybeLoadSupplier` without telling the user what module they were missing

After:
* ClassNotFoundException is swallowed silently ONLY when determining supported types
* ClassNotFoundException is bubbled up when we are trying to play media without the corresponding module properly loaded
PiperOrigin-RevId: 632568989
2024-05-10 12:18:53 -07:00
tonihei
e1d8044ccc Fix flushing logic of SpeedChangingAudioProcessor
When the processor is flushed, it needs to reset its internal state
in preparation for receiving fresh input data.

Flushing the internal SonicAudioProcessor on the other hand should
not go through the parent flush() method and instead flush the
internal processor only when needed.

PiperOrigin-RevId: 632530395
2024-05-10 10:12:03 -07:00
tonihei
daa8750382 Ensure silence skipping doesn't interfere with other discontinuities
The same doSomeWork iteration that triggers the silence skipping
discontinuity may already have another discontinuities (like
AUTO_TRANSITION), which should take precedence over the silence
skipping.

PiperOrigin-RevId: 632432851
2024-05-10 02:51:58 -07:00
tofunmi
1749726bc9 Texture input tests: use separate textures to queue to transformer
Use different textures in calls to queueInputTexture(). Allows the texture to be deleted one it is used in transformer and effect.

PiperOrigin-RevId: 632430866
2024-05-10 02:41:51 -07:00
samrobinson
325f4ec502 Add debug trace JSON nesting per component.
PiperOrigin-RevId: 632424814
2024-05-10 02:13:56 -07:00
samrobinson
fff68f1932 Order DebugTraceUtil JSON output by each component.
PiperOrigin-RevId: 632193924
2024-05-09 10:28:49 -07:00
tofunmi
753f607a81 Test: Remove the invalid dataspace device list when asserting sdr
PiperOrigin-RevId: 632137474
2024-05-09 07:07:51 -07:00
ibaker
861e8218c0 Bump IMA dependency to 3.33.0 to fix NPE with data:// URIs
Issue: androidx/media#700
PiperOrigin-RevId: 632135478
2024-05-09 06:59:53 -07:00
tonihei
971486f5f9 Round bytesToNextSpeedChange up instead of down
Rounding down means that very small diferrences (e.g. 1 us) result
in bytesToNextSpeedChange==0, which stalls progress forever as no
new bytes are read. Rounding up instead ensures that we always read
at least one audio frame if nextSpeedChangeTimeUs is in the future.

PiperOrigin-RevId: 632116560
2024-05-09 05:36:49 -07:00
samrobinson
49fa343127 Remove unused DebugTraceUtil VFP event.
PiperOrigin-RevId: 632109159
2024-05-09 05:00:39 -07:00
tofunmi
e432005653 make TransformerUtil public
help apps statically calculate what transformer will do with certain inputs without running transformer.

PiperOrigin-RevId: 632087821
2024-05-09 03:06:30 -07:00
claincly
145e0faf3d Make DefaultVideoCompositor use the first registered input as primary
PiperOrigin-RevId: 632079022
2024-05-09 02:21:31 -07:00
Googler
524181d7f2 DefaultHttpDS: Allow forcing cross protocol redirects to original
One can set crossProtocolRedirectsForceOriginal to force cross protocol redirects to use the original protocol. This might cause the connection to fail so it can only used when allowCrossProtocolRedirects is set to false or unset (default false).

PiperOrigin-RevId: 631937956
2024-05-08 15:11:04 -07:00
claincly
d977eab5f1 Minor code move for readability
PiperOrigin-RevId: 631922318
2024-05-08 14:19:04 -07:00
samrobinson
8b14d71ff0 Handle null extraFormat on entry in DebugTraceUtil.
PiperOrigin-RevId: 631821753
2024-05-08 09:14:06 -07:00
tofunmi
ad2fc4fbb1 move Output Mime Type And Hdr Mode Fallback logic to TransformerUtil
allows apps to use the logic statically before running transformer.

Also ensure the mime type reported is the mime type outputted

PiperOrigin-RevId: 631811763
2024-05-08 08:40:01 -07:00
tianyifeng
1a5f57e9eb Complete preloading when the period has loaded to the end of the source
When the period has loaded to the end of the source, the `period.getBufferedPositionUs` will be set to `C.TIME_END_OF_SOURCE`, which is a negative value. Thus, the original `continueLoadingPredicate` will never turn to `false`, as the `bufferedPositionUs` is definitely less than the target preload position that is expected to be positive.

In this change, we added `PreloadMediaSource.PreloadControl.onLoadedToTheEndOfSource(PreloadMediaSource)` to indicate that the source has loaded to the end. This allows the `DefaultPreloadManager` and the custom `PreloadMediaSource.PreloadControl` implementations to preload the next source or take other actions.

This bug was not revealed by the the `DefaultPreloadManagerTest` because the related tests were all using the `FakeMediaSource` and only setting the preload target to `STAGE_TIMELINE_REFRESHED`. Thus, the tests for testing the `invalidate()` behaviors were modified to use the real progressive media whenever possible, unless we have to use `FakeMediaSource` to squeeze a chance to do more operations between the preloading of sources to test some special scenarios.

PiperOrigin-RevId: 631776442
2024-05-08 06:16:44 -07:00
tonihei
9ece3932e8 Add time unit to variable names and methods
This helps with readability of the code

PiperOrigin-RevId: 631771454
2024-05-08 05:54:16 -07:00
samrobinson
8b78e04ba3 Add time units to DebugTraceUtil logging.
PiperOrigin-RevId: 631764751
2024-05-08 05:29:04 -07:00
michaelkatz
ab64ca809a Reset tracker for offload track completion prior to stopping AudioTrack
For offloaded playback, reset the tracking field for stream completion in `DefaultAudioSink` prior to calling `AudioTrack.stop()` so that `AudioTrack.StreamEventCallback#onPresentationEnded` correctly identifies when all pending data has been played.

#minor-release

PiperOrigin-RevId: 631744805
2024-05-08 04:02:26 -07:00
kimvde
9adb532b6c Only set image duration on images in demo app
The Javadoc is stating that the image duration is ignored for non-image
input but this is incorrect (for example, it affects seeking
performance). The Javadoc will be updated in another CL.

PiperOrigin-RevId: 631730980
2024-05-08 03:25:04 -07:00
tonihei
38b9a5d441 Always check audio processor chain for media playout duration
When the PlaybackParameters are set to their DEFAULT value, we
currently bypass the audio processor chain when determining the
output media position, under the assumption that no timestamp
change happens in the audio processors. This assumption may not
be true as the audio processors can change playout durations on
their own accord independent of the provided PlaybackParameters.

To correctly reflect any updated playout duration, we can just
always check the audio processor chain. The default implementation
will continue to assume that only the SonicAudioProcessor changes
the playout duration.

PiperOrigin-RevId: 631726112
2024-05-08 03:12:40 -07:00
kimvde
49c75fdd37 Add unit tests for seeking
Other tests will follow

PiperOrigin-RevId: 631711913
2024-05-08 02:39:45 -07:00
Copybara-Service
c5964d197c Merge pull request #1055 from AradiPatrik:z-order-fix
PiperOrigin-RevId: 631616905
2024-05-07 18:45:09 -07:00
Luyuan Chen
766ff44a2c Fix review comment 2024-05-08 00:11:21 +00:00
Luyuan Chen
0403e5881d Format with google-java-format 2024-05-08 00:07:38 +00:00
Patrik Aradi
51a9bcca61 Refactor according to reviews. 2024-05-08 00:07:38 +00:00
Patrik Aradi
52adaf8d26 implement top down approach for passing input source id 2024-05-08 00:07:38 +00:00
Luyuan Chen
3cccecf368 Format with google-java-format 2024-05-08 00:07:38 +00:00
Patrik Aradi
84df55c6e8 fix naming and formatting 2024-05-08 00:07:38 +00:00
Patrik Aradi
b909162daa Use sparse array in MultipleInputVideoGraph, fix formatting 2024-05-08 00:07:37 +00:00
Patrik Aradi
177f1f33d0 Fix indeterminate z-order of EditedMediaItemSequences by passing sequenceIndex when registeringInput 2024-05-08 00:07:37 +00:00
claincly
bef3d518d2 Revise seeking in ExternalTextureManager (ETM)
After this CL, DVFP waits for flushing until all frames registered previously
arrives.

Previously, ETM records the difference between the number of registered frames,
and the number of frames arrivd on the SurfaceTexture, when flushing. (Note
that ETM is flushed the last in the chain, as flushing is done backwards from
FinalShaderProgramWrapper). ETM then waits until the number of frames arrive
after flush.

The normal flow is, MediaCodecVideoRenderer (MCVR) registers a new decoded
frame, in `processOutputBuffer()` to DVFP, MCVR call `codec.releaseOutputBuffer()`
to have MediaCodec render the frame, and then the frame arrives in DVFP's ETM.

However there might be a discrepancy. When registering the frame, ETM records
the frame on the calling thread, ~instantly. Later when the rendered frame
arrive, ETM records a frame is available on the task executor thread (or
commonly known as the GL thread). More specifically, when a frame arrives
in `onFrameAvailableListener`, ETM posts all subsequent processing to
the task executor. When seeking, the task executor is flushed as the first
step. It might be a frame that has already arrived on ETM, and the processing
of such frame has already been queued into the task executor; only to be
flushed as a result of flushing the task executor. If this happens, the frame
is considered to be never have arrived. This causes a freeze on the app,
because ETM'll wait until this frame arrives to declare flushing has completed.

PiperOrigin-RevId: 631524332
2024-05-07 13:15:46 -07:00
tonihei
6ac60c6dff Disable enhanced Java 8 desugaring
This avoids that apps have to depend on this additional config

Issue: androidx/media#1312
PiperOrigin-RevId: 631447767
2024-05-07 09:26:36 -07:00
Copybara-Service
096904301f Merge pull request #1299 from cedricxperi:encoding-dts-uhd-p2-issue
PiperOrigin-RevId: 631405992
2024-05-07 06:47:13 -07:00
samrobinson
9942255894 Allow any pcm encoding raw input pre-effects in AudioGraphInput.
AudioGraphInput now accepts a range of inputs, as long as the effects
provided modify the audio to be int 16.

As part of this, add the workaround to DefaultCodec to ensure pcm
encoding is correct, and remove parameterized tests that are not valid.

PiperOrigin-RevId: 631404152
2024-05-07 06:39:09 -07:00
microkatz
6363017e88 Fix DTS:X Profile 2 encoding attributes for passthrough playback 2024-05-07 12:05:37 +00:00
Cedric T
de2bc944ca Fix ENCODING_DTS_UHD_P2 Issue 2024-05-07 12:05:37 +00:00
tonihei
16df05ec29 Upgrade Gradle and AGP
The newer versions include a bugfix that automatically highlights
when our project requires enhanced Java 8 desugaring.

Issue: androidx/media#1312
PiperOrigin-RevId: 631373018
2024-05-07 04:20:55 -07:00
michaelkatz
75733e294e Fix GitHub ref url typo in 'non-square Dash Thumbnail' release note
PiperOrigin-RevId: 631368681
2024-05-07 04:02:40 -07:00
tofunmi
b2d30a5722 Fallback to hevc transcoding for hdr AV1 files
PiperOrigin-RevId: 631362735
2024-05-07 03:34:31 -07:00
claincly
4aa15e9463 Change test golden files, as default color space chagned
Degamming is removed in cb4b2ea55c, update the test golden files to match
the new working color space.

PiperOrigin-RevId: 631361692
2024-05-07 03:31:32 -07:00
bachinger
4841f8f8b3 Run ExoPlayerTest with preloading enabled and disabled
Replace with parametrized test when  https://issuetracker.google.com/316040980
is resolved.

PiperOrigin-RevId: 631096883
2024-05-06 09:58:09 -07:00
bachinger
0ab6ea5668 Add preload pool to media period MediaPeriodQueue
The pool is created and the queue uses holder instances found
to enqueue. No preloading is done yet though.

PiperOrigin-RevId: 631053172
2024-05-06 08:07:49 -07:00
kimvde
4a54db7cc7 Remove VideoSinkProvider class member from MCVR
PiperOrigin-RevId: 631037709
2024-05-06 07:31:02 -07:00
kimvde
a03f30bea9 Add surface setters on VideoSink
PiperOrigin-RevId: 631025710
2024-05-06 06:31:39 -07:00
kimvde
506944dcfd Move effect setters to VideoSink
PiperOrigin-RevId: 631011252
2024-05-06 05:23:54 -07:00
bachinger
2c912aa697 Handle displayTitle and title in legacy conversions
When converting `MediaMetadata` to the legacy `MediaDescriptionCompat`
the selection and order of properties to use has been aligned with the
behavior of media1. This selection is relevant for users that use a
platform or legacy controller or browser. Before and up to the current
API version 34, this includes System UI, Android Auto/Automotive and
AVRCP (Bluetooth).

PiperOrigin-RevId: 630999535
2024-05-06 04:21:19 -07:00
Googler
1ef0b7c616 Automated Code Change
PiperOrigin-RevId: 630995654
2024-05-06 04:04:20 -07:00