This listener is used by apps to associate render timestamp and presentation
timestamp when using a SurfaceTexture, so this timestamp must match up with
what's set in `eglPresentationTimeANDROID`.
PiperOrigin-RevId: 736494784
This timeout can be very low in these tests because we are always
trying to connect to an in-process `MockWebServer`. With the default
timeout value any 'resource not found' tests which use a domain that
can't be connected to take the max timeout (between 8s and 16s depending
on the HTTP stack).
PiperOrigin-RevId: 736466854
This change uses the duration and byte count of the Xing frame, if
they're present, to estimate the bitrate of the stream. The seeking
will still be inaccurate (because we're doing CBR seeking in a VBR
stream), but it will be more accurate than basing the bitrate on the
first MP3 frame we read. It will also mean the duration reported is
accurate.
This change also ensures that if the Xing frame contains the number of
audio bytes but no ToC, the audio data length is still propagated into
the `XingSeeker` (and therefore into the `ConstantBitrateSeeker` too).
Issue: androidx/media#2194
PiperOrigin-RevId: 736100104
A problem was discovered in Composition demo app where after playing a composition using CompositionPlayer, pressing the "play" button again would not restart the playback. This issue has been resolved, just adding a test to make sure we're not missing any regressions.
PiperOrigin-RevId: 735793488
In certain bluetooth playback scenarios, it was found that the delta of audio duration written by the AudioSink from the current playback position was greater than the size of the audio track buffer, causing underruns.
The solution is to utilize the audio track buffer size as an upper limit for an audio renderer's getDurationToProgress.
PiperOrigin-RevId: 735761604
After this change, updates of the live HLS playlists are reflected
in the ad playback state. Interstitials are inserted into new
or existing ad groups according to the current ad playback state.
PiperOrigin-RevId: 735733207
Before this CL:
- MediaCodecVideoRenderer.onProcessedStreamChanged was called for the
first stream in CompositionPlayer.
- MediaCodecVideoRenderer.onProcessedStreamChanged was NOT called for
the first stream in ExoPlayer.setVideoEffects.
This discrepancy was adding some complexity to the code, making it less robust.
PiperOrigin-RevId: 735439320
This improves consistency by grouping it with other test builders and resolves a missing build rule, ensuring developers can properly use it for testing.
PiperOrigin-RevId: 735396181
This is a step towards merging setStreamStartPositionUs with
onInputStreamChanged, which makes sense as the start position can only
change on stream change.
PiperOrigin-RevId: 735309009
This is part of an effort to remove VideoSink.onRendererEnabled,
which is a step towards making the VideoSink interface renderer
agnostic. The plan is to merge onRendererEnabled, setStreamTimestampInfo
and onInputStreamChanged into a single method in VideoSink.
This change is a no-op refactoring
PiperOrigin-RevId: 735293983
We currently combine stopping the FGS and optionally removing the
notification in one method, which unnecessarily gates its logic on
checking the desired foreground state again. This causes a bug where
the notification should be removed (because shouldShowNotification
returns false), but stays visible because the service is allowed
to stay in the foreground and the notification removal code is not
triggered.
#cherrypick
Issue: androidx/media#2211
PiperOrigin-RevId: 735126704
Removed test that attempted to verify behavior when the lib-effect dependency is missing. This is because it fails when adding lib-transformer to test-util dependency. The introduction of lib-transformer brought in lib-effect as a transitive dependency, which conflicted with the test's expectation of the class not being present.
PiperOrigin-RevId: 734547629
This is a step towards unifying ShadowMediaCodecConfig for ExoPlayer and Transcoding tests.
The buffer size for ExoPlayer's CodecConfig is set to 150_000. This is because some test media has samples larger than 100kB. We can increase the buffer size for Transcoding-related codec configurations.
PiperOrigin-RevId: 734297632
When `forceTransformerToFail` is set to true, the builder will use a `FailingMuxerFactory` which creates a `FailingMuxer` that throws a `MuxerException` when attempting to write sample data. This ensures Transformer will fail as muxers are used for all cases (transmuxing and transcoding).
PiperOrigin-RevId: 734281681
These tests show the current behaviour:
1. Without customization: not seekable
2. With 'enable CBR' flag:
* File length known: seekable but duration very incorrect
* File length unknown: not seekable (even though the Xing frame
contains the number of bytes in the mp3 stream).
Follow-up test changes will:
1. Add a test for the cbr-always case for this file (branched from the
files submitted in this change).
2. Add a new similar test asset with no ToC but with trailing garbage
bytes, to verify that the length from the Xing frame is used.
Then follow-up implementation changes will update Mp3Extractor to use
duration and byte length from a Xing frame when falling back to CBR
seeking.
Issue: androidx/media#2194
PiperOrigin-RevId: 734164879
If feature is enabled, MediaCodecVideoRenderer will include the `MediaCodec.BUFFER_FLAG_DECODE_ONLY` flag when queuing decode-only input buffers. This flag will signal the decoder to skip the decode-only buffers thereby resulting in faster seeking.
PiperOrigin-RevId: 734152464
This is a step towards unifying ShadowMediaCodecConfig for ExoPlayer and Transcoding tests.
This change includes extracting encoder/decoder configurtion logic to a static method that can be called by `ShadowMediaCodecConfig.CodecImpl#configure()` and `TestUtil#addCodec()`.
This is a non-functional refactor.
PiperOrigin-RevId: 734137675
The start position and buffer adjustement are only allowed to change
when the stream changes so it makes more sense to call
setStreamTimestampInfo when the stream changes.
This is part of an effort to simplify stream change notification to the
video sink, to ease implementation of multi sequences preview.
PiperOrigin-RevId: 734062686
This is a step towards removing the assumption that there is only one
sequence and therefore one renderer feeding data to DefaultVideoSink and
VideoFrameReleaseControl.
PiperOrigin-RevId: 734062629
This is a step towards removing the assumption that there is only one
sequence and therefore one renderer feeding data to DefaultVideoSink and
VideoFrameReleaseControl.
This is a no-op refactoring.
PiperOrigin-RevId: 734044100
This was requested in Issue: androidx/media#2191 for playback of Opus and Vorbis
files with more than two channels with a float PCM pipeline.
Also, add ChannelMappingAudioProcessorTest.
PiperOrigin-RevId: 733766680
This is analagous to `String.codePointAt` and similar methods. By
dealing only in unicode code points, and returning an `int`, we can
avoid having to reason about how to handle UTF-8 code units that
require two UTF-16 code units (each one a Java `char`) to represent
them.
The zero-arg `peekChar` method remains undeprecated, because it behaves
as "you'd expect" when compared to `peekUnsignedByte` (always reads two
big-endian bytes).
PiperOrigin-RevId: 733752645
With using the `MediaPeriodId` from the `ExoPlaybackException`, ExoPlayerImplInternal can set the same id to the renderer group(primary and secondary).
Tested with `ExoPlayerWithPrewarmingRenderersTest` error-based unit tests like `play_errorByPrewarmingSecondaryRendererAfterAdvancingReadingPeriod_doesNotResetPrimaryRenderer`. If the media period was not set in BaseRenderer then the exception would have the incorrect mediaperiod, attribute the error to the non-prewarming renderer, and the test would fail.
PiperOrigin-RevId: 733744777
The gap item earlier meant audio gap.
Now the gap item will be filled with audio, video
or both based upon what all tracks are present in the
Sequence.
If the very first item is a gap then it is filled with
audio only. Support for video gap at start will be added in
a follow up CL.
If the first item is a gap then `forceAudioTrack`
is set to true.
PiperOrigin-RevId: 733422557
This change exposes a flag in `DefaultAudioMixer#Factory` to set whether
to upmix/downmix using constant power or constant gain mixing matrices.
This is a non-functional change.
PiperOrigin-RevId: 733339367
This change introduces `GainProcessor` to apply gain automation over an
audio stream. The gain automation is defined with a `GainProvider`.
`DefaultGainProvider` implements a basic `GainProvider` that allows
populating a gain automation line additively by adding fade shapes
(`FadeProvider`) at specific positions with specific durations.
`DefaultGainProvider` also implements basic equal gain and equal power
fades.
The current `DefaultGainProvider` implementation does not support adding
fades at relative offsets from the stream end. Users must know the
stream duration in advance and add fades at absolute positions.
PiperOrigin-RevId: 733311314
With multi video sequences previewing in CompositionPlayer,
VideoFrameReleaseHelper won't be connected to a single renderer.
Multiple renderers will feed the VideoGraph at the same time, and the
VideoGraph output will be connected to the VideoFrameReleaseHelper.
PiperOrigin-RevId: 733250499
The original behaviour of the `handleSetCookieRequests` is preserved.
A bug is addressed, where it woulld set `Set-Cookie` header in the client request (as opposed to the expected `Cookies`).
PiperOrigin-RevId: 732945338