mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 03:52:48 +00:00
Propagate the possible exceptions during codec capability checks to the caller so a nice dialog can be displayed instead of crashing on buggy ROMs. Small change to evdev shutdown.
This commit is contained in:
parent
2c23dbd2be
commit
178c53ee84
@ -198,7 +198,16 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
controllerHandler = new ControllerHandler(conn);
|
controllerHandler = new ControllerHandler(conn);
|
||||||
|
|
||||||
decoderRenderer = new ConfigurableDecoderRenderer();
|
decoderRenderer = new ConfigurableDecoderRenderer();
|
||||||
|
|
||||||
|
try {
|
||||||
decoderRenderer.initializeWithFlags(drFlags);
|
decoderRenderer.initializeWithFlags(drFlags);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Dialog.displayDialog(this, "Hardware Decoder Failure",
|
||||||
|
"The hardware decoder failed to initialize. First, try restarting your device."+
|
||||||
|
"If the issue persists, please send an email to the app developer. Forcing software decoding" +
|
||||||
|
"can circumvent this error if needed.", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SurfaceHolder sh = sv.getHolder();
|
SurfaceHolder sh = sv.getHolder();
|
||||||
if (stretchToFit || !decoderRenderer.isHardwareAccelerated()) {
|
if (stretchToFit || !decoderRenderer.isHardwareAccelerated()) {
|
||||||
@ -301,7 +310,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LimelightBuildProps.ROOT_BUILD) {
|
if (evdevWatcher != null) {
|
||||||
evdevWatcher.shutdown();
|
evdevWatcher.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class ConfigurableDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
return decoderRenderer.setup(width, height, redrawRate, renderTarget, drFlags);
|
return decoderRenderer.setup(width, height, redrawRate, renderTarget, drFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeWithFlags(int drFlags) {
|
public void initializeWithFlags(int drFlags) throws Exception {
|
||||||
if ((drFlags & VideoDecoderRenderer.FLAG_FORCE_HARDWARE_DECODING) != 0 ||
|
if ((drFlags & VideoDecoderRenderer.FLAG_FORCE_HARDWARE_DECODING) != 0 ||
|
||||||
((drFlags & VideoDecoderRenderer.FLAG_FORCE_SOFTWARE_DECODING) == 0 &&
|
((drFlags & VideoDecoderRenderer.FLAG_FORCE_SOFTWARE_DECODING) == 0 &&
|
||||||
MediaCodecDecoderRenderer.findSafeDecoder() != null)) {
|
MediaCodecDecoderRenderer.findSafeDecoder() != null)) {
|
||||||
|
@ -91,7 +91,10 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MediaCodecInfo findSafeDecoder() {
|
// We declare this method as explicitly throwing Exception
|
||||||
|
// since some bad decoders can throw IllegalArgumentExceptions unexpectedly
|
||||||
|
// and we want to be sure all callers are handling this possibility
|
||||||
|
public static MediaCodecInfo findSafeDecoder() throws Exception {
|
||||||
for (int i = 0; i < MediaCodecList.getCodecCount(); i++) {
|
for (int i = 0; i < MediaCodecList.getCodecCount(); i++) {
|
||||||
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
|
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user