mirror of
https://github.com/samsonjs/media.git
synced 2026-04-26 14:57:47 +00:00
Wire CodecException.isRecoverable to ExoPlaybackException
PiperOrigin-RevId: 355896218
This commit is contained in:
parent
91c2f891a0
commit
01b6061bd2
1 changed files with 29 additions and 1 deletions
|
|
@ -359,6 +359,7 @@ 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 enableRecoverableCodecExceptionRetries;
|
||||||
@Nullable private ExoPlaybackException pendingPlaybackException;
|
@Nullable private ExoPlaybackException pendingPlaybackException;
|
||||||
protected DecoderCounters decoderCounters;
|
protected DecoderCounters decoderCounters;
|
||||||
private long outputStreamStartPositionUs;
|
private long outputStreamStartPositionUs;
|
||||||
|
|
@ -465,6 +466,17 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
enableSynchronizeCodecInteractionsWithQueueing = enabled;
|
enableSynchronizeCodecInteractionsWithQueueing = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable internal player retries for codec exceptions if the underlying platform indicates that
|
||||||
|
* they are recoverable.
|
||||||
|
*
|
||||||
|
* <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 experimentalSetRecoverableCodecExceptionRetriesEnabled(boolean enabled) {
|
||||||
|
enableRecoverableCodecExceptionRetries = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AdaptiveSupport
|
@AdaptiveSupport
|
||||||
public final int supportsMixedMimeTypeAdaptation() {
|
public final int supportsMixedMimeTypeAdaptation() {
|
||||||
|
|
@ -836,7 +848,15 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
decoderCounters.ensureUpdated();
|
decoderCounters.ensureUpdated();
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
if (isMediaCodecException(e)) {
|
if (isMediaCodecException(e)) {
|
||||||
throw createRendererException(createDecoderException(e, getCodecInfo()), inputFormat);
|
boolean isRecoverable =
|
||||||
|
enableRecoverableCodecExceptionRetries
|
||||||
|
&& Util.SDK_INT >= 21
|
||||||
|
&& isRecoverableMediaCodecExceptionV21(e);
|
||||||
|
if (isRecoverable) {
|
||||||
|
releaseCodec();
|
||||||
|
}
|
||||||
|
throw createRendererException(
|
||||||
|
createDecoderException(e, getCodecInfo()), inputFormat, isRecoverable);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
@ -2263,6 +2283,14 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
return error instanceof MediaCodec.CodecException;
|
return error instanceof MediaCodec.CodecException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(21)
|
||||||
|
private static boolean isRecoverableMediaCodecExceptionV21(IllegalStateException error) {
|
||||||
|
if (error instanceof MediaCodec.CodecException) {
|
||||||
|
return ((MediaCodec.CodecException) error).isRecoverable();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the decoder is known to fail when flushed.
|
* Returns whether the decoder is known to fail when flushed.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue