Make SkipAndContinueIfSampleTooLarge as default behavior.

Remove experimentalSetSkipAndContinueIfSampleTooLarge() api

PiperOrigin-RevId: 382383498
This commit is contained in:
olly 2021-06-30 22:17:41 +01:00 committed by kim-vde
parent 3c97815d55
commit 91cb54b84e

View File

@ -353,7 +353,6 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
private boolean enableAsynchronousBufferQueueing; private boolean enableAsynchronousBufferQueueing;
private boolean forceAsyncQueueingSynchronizationWorkaround; private boolean forceAsyncQueueingSynchronizationWorkaround;
private boolean enableSynchronizeCodecInteractionsWithQueueing; private boolean enableSynchronizeCodecInteractionsWithQueueing;
private boolean enableSkipAndContinueIfSampleTooLarge;
@Nullable private ExoPlaybackException pendingPlaybackException; @Nullable private ExoPlaybackException pendingPlaybackException;
protected DecoderCounters decoderCounters; protected DecoderCounters decoderCounters;
private long outputStreamStartPositionUs; private long outputStreamStartPositionUs;
@ -470,18 +469,6 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
enableSynchronizeCodecInteractionsWithQueueing = enabled; enableSynchronizeCodecInteractionsWithQueueing = enabled;
} }
/**
* Enables skipping and continuing playback from the next key frame if a sample is encountered
* that's too large to fit into one of the decoder's input buffers. When not enabled, playback
* will fail in this case.
*
* <p>This method is experimental, and will be renamed or removed in a future release. It should
* only be called before the renderer is used.
*/
public void experimentalSetSkipAndContinueIfSampleTooLarge(boolean enabled) {
enableSkipAndContinueIfSampleTooLarge = enabled;
}
@Override @Override
@AdaptiveSupport @AdaptiveSupport
public final int supportsMixedMimeTypeAdaptation() { public final int supportsMixedMimeTypeAdaptation() {
@ -1254,19 +1241,11 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
result = readSource(formatHolder, buffer, /* readFlags= */ 0); result = readSource(formatHolder, buffer, /* readFlags= */ 0);
} catch (InsufficientCapacityException e) { } catch (InsufficientCapacityException e) {
onCodecError(e); onCodecError(e);
if (enableSkipAndContinueIfSampleTooLarge) { // Skip the sample that's too large by reading it without its data. Then flush the codec so
// Skip the sample that's too large by reading it without its data. Then flush the codec so // that rendering will resume from the next key frame.
// that rendering will resume from the next key frame. readSourceOmittingSampleData(/* readFlags= */ 0);
readSourceOmittingSampleData(/* readFlags= */ 0); flushCodec();
flushCodec(); return true;
return true;
} else {
throw createRendererException(
createDecoderException(e, getCodecInfo()),
inputFormat,
/* isRecoverable= */ false,
PlaybackException.ERROR_CODE_DECODING_FAILED);
}
} }
if (hasReadStreamToEnd()) { if (hasReadStreamToEnd()) {