mirror of
https://github.com/androidx/media.git
synced 2025-04-29 14:26:50 +08:00
Fix bug where a MaskingMediaSource never throws prepare error
We suppressed the direct error throwing ability in <unknown commit> to avoid throwing errors later in the playlist too early. This logic got moved to MaskingMediaSource in <unknown commit>, but its original purpose was no longer needed when the player stopped calling this method directly in <unknown commit>. This left a pending bug that any other usage of MaskingMediaSource (e.g. within AdsMediaSource) no longer forwards source prepare errors. Issue: androidx/media#2337 PiperOrigin-RevId: 750537823
This commit is contained in:
parent
8483b92620
commit
a7c897003c
@ -9,6 +9,8 @@
|
||||
scrubber bar around). The behavior of scrubbing mode can be customized
|
||||
with `setScrubbingModeParameters(..)` on `ExoPlayer` and
|
||||
`ExoPlayer.Builder`.
|
||||
* Fix bug where prepare errors in the content of `AdsMediaSource` may be
|
||||
never reported ([#2337](https://github.com/androidx/media/issues/2337)).
|
||||
* Transformer:
|
||||
* Filling an initial gap (added via `addGap()`) with silent audio now
|
||||
requires explicitly setting `experimentalSetForceAudioTrack(true)` in
|
||||
|
@ -102,13 +102,6 @@ public final class MaskingMediaSource extends WrappingMediaSource {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("MissingSuperCall")
|
||||
public void maybeThrowSourceInfoRefreshError() {
|
||||
// Do nothing. Source info refresh errors will be thrown when calling
|
||||
// MaskingMediaPeriod.maybeThrowPrepareError.
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaskingMediaPeriod createPeriod(
|
||||
MediaPeriodId id, Allocator allocator, long startPositionUs) {
|
||||
|
@ -16818,6 +16818,27 @@ public final class ExoPlayerTest {
|
||||
assertThat(shouldRendererThrowRecoverableError.get()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void prepareMaskingMediaSource_withRealSourcePrepareError_reportsPlaybackException()
|
||||
throws Exception {
|
||||
ExoPlayer player = new TestExoPlayerBuilder(context).build();
|
||||
FakeMediaSource realSourceWithPrepareFailure =
|
||||
new FakeMediaSource() {
|
||||
@Override
|
||||
public void maybeThrowSourceInfoRefreshError() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
};
|
||||
realSourceWithPrepareFailure.setAllowPreparation(false);
|
||||
MediaSource maskingMediaSource =
|
||||
new MaskingMediaSource(realSourceWithPrepareFailure, /* useLazyPreparation= */ false);
|
||||
player.setMediaSource(maskingMediaSource);
|
||||
|
||||
player.prepare();
|
||||
// Assert the prepare error is reported.
|
||||
advance(player).untilPlayerError();
|
||||
}
|
||||
|
||||
// Internal methods.
|
||||
|
||||
private void addWatchAsSystemFeature() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user