mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 19:13:03 +00:00
Remove the decoder stop hack and try to workaround the issue differently
This commit is contained in:
parent
d1e41e41a1
commit
4b9c6b149a
@ -993,14 +993,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
@Override
|
@Override
|
||||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||||
if (connected) {
|
if (connected) {
|
||||||
// HACK: Android is supposed to let you return from this function
|
|
||||||
// before throwing a fit if you access the surface again. Unfortunately,
|
|
||||||
// MediaCodec often tries to access the destroyed surface and triggers
|
|
||||||
// an IllegalStateException. To workaround this, we will invoke
|
|
||||||
// the DecoderRenderer's stop function ourselves, so it will hopefully
|
|
||||||
// happen early enough to not trigger the bug
|
|
||||||
decoderRenderer.stop();
|
|
||||||
|
|
||||||
stopConnection();
|
stopConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,10 +416,18 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
|
|
||||||
// Halt the rendering thread
|
// Halt the rendering thread
|
||||||
rendererThread.interrupt();
|
rendererThread.interrupt();
|
||||||
|
|
||||||
|
// Invalidate pending decode buffers
|
||||||
|
videoDecoder.flush();
|
||||||
|
|
||||||
|
// Wait for the renderer thread to shut down
|
||||||
try {
|
try {
|
||||||
rendererThread.join();
|
rendererThread.join();
|
||||||
} catch (InterruptedException ignored) { }
|
} catch (InterruptedException ignored) { }
|
||||||
|
|
||||||
|
// Stop the video decoder
|
||||||
|
videoDecoder.stop();
|
||||||
|
|
||||||
// Halt the spinner threads
|
// Halt the spinner threads
|
||||||
for (Thread t : spinnerThreads) {
|
for (Thread t : spinnerThreads) {
|
||||||
t.interrupt();
|
t.interrupt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user