Bring back the warning displayed if video decoder initialization fails

This commit is contained in:
Cameron Gutman 2017-06-16 19:50:50 -07:00
parent fe7148dbd4
commit f6e40118a9
2 changed files with 14 additions and 1 deletions

View File

@ -944,6 +944,16 @@ public class Game extends Activity implements SurfaceHolder.Callback,
displayedFailureDialog = true;
LimeLog.severe(stage+" failed: "+errorCode);
// If video initialization failed and the surface is still valid, display extra information for the user
if (stage.contains("video") && streamView.getHolder().getSurface().isValid()) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(Game.this, "Video decoder failed to initialize. Your device may not support the selected resolution.", Toast.LENGTH_LONG).show();
}
});
}
Dialog.displayDialog(this, getResources().getString(R.string.conn_error_title),
getResources().getString(R.string.conn_error_msg)+" "+stage, true);
}

View File

@ -440,12 +440,15 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
startSpinnerThreads();
}
// !!! May be called even if setup()/start() fails !!!
public void prepareForStop() {
// Let the decoding code know to ignore codec exceptions now
stopping = true;
// Halt the rendering thread
rendererThread.interrupt();
if (rendererThread != null) {
rendererThread.interrupt();
}
}
@Override