From b6f52db9c3731dedfd5f67e8ea43b177712cfd19 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 25 Nov 2017 13:35:46 -0800 Subject: [PATCH] Fix crash when input events are received and no H.264 decoder is present --- app/src/main/java/com/limelight/Game.java | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 1ad92b4f..e003c526 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -294,18 +294,6 @@ public class Game extends Activity implements SurfaceHolder.Callback, if (prefConfig.videoFormat == PreferenceConfiguration.FORCE_H265_ON && !decoderRenderer.isHevcSupported()) { Toast.makeText(this, "No H.265 decoder found.\nFalling back to H.264.", Toast.LENGTH_LONG).show(); } - - if (!decoderRenderer.isAvcSupported()) { - if (spinner != null) { - spinner.dismiss(); - spinner = null; - } - - // If we can't find an AVC decoder, we can't proceed - Dialog.displayDialog(this, getResources().getString(R.string.conn_error_title), - "This device or ROM doesn't support hardware accelerated H.264 playback.", true); - return; - } StreamConfiguration config = new StreamConfiguration.Builder() .setResolution(prefConfig.width, prefConfig.height) @@ -361,6 +349,18 @@ public class Game extends Activity implements SurfaceHolder.Callback, usbDriverServiceConnection, Service.BIND_AUTO_CREATE); } + if (!decoderRenderer.isAvcSupported()) { + if (spinner != null) { + spinner.dismiss(); + spinner = null; + } + + // If we can't find an AVC decoder, we can't proceed + Dialog.displayDialog(this, getResources().getString(R.string.conn_error_title), + "This device or ROM doesn't support hardware accelerated H.264 playback.", true); + return; + } + // The connection will be started when the surface gets created streamView.getHolder().addCallback(this); }