mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-06-18 06:41:13 +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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && e instanceof CodecException) {
|
||||||
if (e instanceof CodecException) {
|
|
||||||
CodecException codecExc = (CodecException) e;
|
CodecException codecExc = (CodecException) e;
|
||||||
|
|
||||||
if (codecExc.isTransient()) {
|
if (codecExc.isTransient()) {
|
||||||
@@ -643,15 +642,20 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (e instanceof IllegalStateException) {
|
||||||
|
// IllegalStateException was primarily used prior to the introduction of CodecException.
|
||||||
// If we got here, this is most likely an IllegalStateException which was used prior to L
|
// Recovery from this requires a full decoder reset.
|
||||||
// to indicate codec errors (unexpected transition to the error state). 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) {
|
if (codecRecoveryAttempts < CR_MAX_TRIES) {
|
||||||
needsReset = true;
|
needsReset = true;
|
||||||
return false;
|
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
|
// Only throw if we're not in the middle of codec recovery
|
||||||
if (!needsReset && !needsRestart) {
|
if (!needsReset && !needsRestart) {
|
||||||
|
|||||||
Reference in New Issue
Block a user