mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-06-18 23:01:06 +00:00
Only try to recover from CodecExceptions or IllegalStateExceptions
This commit is contained in:
@@ -618,8 +618,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (e instanceof CodecException) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && e instanceof CodecException) {
|
||||
CodecException codecExc = (CodecException) e;
|
||||
|
||||
if (codecExc.isTransient()) {
|
||||
@@ -643,15 +642,20 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we got here, this is most likely an IllegalStateException which was used prior to L
|
||||
// to indicate codec errors (unexpected transition to the error state). Recovery from this
|
||||
// requires a full decoder reset.
|
||||
else if (e instanceof IllegalStateException) {
|
||||
// IllegalStateException was primarily used prior to the introduction of CodecException.
|
||||
// Recovery from this requires a full decoder reset.
|
||||
//
|
||||
// NB: CodecException is an IllegalStateException, so we must check for it first.
|
||||
if (codecRecoveryAttempts < CR_MAX_TRIES) {
|
||||
needsReset = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If it's not a CodecException or IllegalStateException, it's not an "expected" failure.
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Only throw if we're not in the middle of codec recovery
|
||||
if (!needsReset && !needsRestart) {
|
||||
|
||||
Reference in New Issue
Block a user