mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-22 08:20:12 +00:00
Don't begin codec recovery if stopping
This commit is contained in:
@@ -506,6 +506,8 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
|
|||||||
|
|
||||||
// All threads that interact with the MediaCodec instance must call this function regularly!
|
// All threads that interact with the MediaCodec instance must call this function regularly!
|
||||||
private boolean doCodecRecoveryIfRequired(int quiescenceFlag) {
|
private boolean doCodecRecoveryIfRequired(int quiescenceFlag) {
|
||||||
|
// NB: We cannot check 'stopping' here because we could end up bailing in a partially
|
||||||
|
// quiesced state that will cause the quiesced threads to never wake up.
|
||||||
if (!needsReset && !needsRestart) {
|
if (!needsReset && !needsRestart) {
|
||||||
// Common case
|
// Common case
|
||||||
return false;
|
return false;
|
||||||
@@ -611,6 +613,11 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
|
|||||||
// Print the stack trace for debugging purposes
|
// Print the stack trace for debugging purposes
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
|
// Eat decoder exceptions if we're in the process of stopping
|
||||||
|
if (stopping) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
if (e instanceof CodecException) {
|
if (e instanceof CodecException) {
|
||||||
CodecException codecExc = (CodecException) e;
|
CodecException codecExc = (CodecException) e;
|
||||||
@@ -646,8 +653,8 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only throw if we're not stopping and aren't in the middle of codec recovery
|
// Only throw if we're not in the middle of codec recovery
|
||||||
if (!stopping && !needsReset && !needsRestart) {
|
if (!needsReset && !needsRestart) {
|
||||||
//
|
//
|
||||||
// There seems to be a race condition with decoder/surface teardown causing some
|
// There seems to be a race condition with decoder/surface teardown causing some
|
||||||
// decoders to to throw IllegalStateExceptions even before 'stopping' is set.
|
// decoders to to throw IllegalStateExceptions even before 'stopping' is set.
|
||||||
|
|||||||
Reference in New Issue
Block a user