mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 19:13:03 +00:00
A few fixes for decoder crash notifications
This commit is contained in:
parent
fd2421618a
commit
38a6a2b74a
@ -231,7 +231,8 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
// We must use commit because the app will crash when we return from this function
|
||||
tombstonePrefs.edit().putInt("CrashCount", tombstonePrefs.getInt("CrashCount", 0) + 1).commit();
|
||||
}
|
||||
});
|
||||
},
|
||||
tombstonePrefs.getInt("CrashCount", 0));
|
||||
|
||||
// Display a message to the user if H.265 was forced on but we still didn't find a decoder
|
||||
if (prefConfig.videoFormat == PreferenceConfiguration.FORCE_H265_ON && !decoderRenderer.isHevcSupported()) {
|
||||
@ -465,11 +466,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
|
||||
// Destroy the capture provider
|
||||
inputCaptureProvider.destroy();
|
||||
|
||||
// Clear the tombstone count
|
||||
if (tombstonePrefs.getInt("CrashCount", 0) != 0) {
|
||||
tombstonePrefs.edit().putInt("CrashCount", 0).apply();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -511,6 +507,11 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
if (message != null) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
// Clear the tombstone count
|
||||
if (tombstonePrefs.getInt("CrashCount", 0) != 0) {
|
||||
tombstonePrefs.edit().putInt("CrashCount", 0).apply();
|
||||
}
|
||||
}
|
||||
|
||||
finish();
|
||||
|
@ -167,7 +167,13 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
|
||||
|
||||
SharedPreferences prefs = getSharedPreferences("DecoderTombstone", 0);
|
||||
int crashCount = prefs.getInt("CrashCount", 0);
|
||||
if (crashCount == 3) {
|
||||
int lastNotifiedCrashCount = prefs.getInt("LastNotifiedCrashCount", 0);
|
||||
|
||||
// Remember the last crash count we notified at, so we don't
|
||||
// display the crash dialog every time the app is started until
|
||||
// they stream again
|
||||
if (crashCount != 0 && crashCount != lastNotifiedCrashCount) {
|
||||
if (crashCount % 3 == 0) {
|
||||
// At 3 consecutive crashes, we'll forcefully reset their settings
|
||||
PreferenceConfiguration.resetStreamingSettings(this);
|
||||
Dialog.displayDialog(this,
|
||||
@ -175,12 +181,15 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
|
||||
getResources().getString(R.string.message_decoding_reset),
|
||||
false);
|
||||
}
|
||||
else if (crashCount >= 1) {
|
||||
else {
|
||||
Dialog.displayDialog(this,
|
||||
getResources().getString(R.string.title_decoding_error),
|
||||
getResources().getString(R.string.message_decoding_error),
|
||||
false);
|
||||
}
|
||||
|
||||
prefs.edit().putInt("LastNotifiedCrashCount", crashCount).apply();
|
||||
}
|
||||
}
|
||||
|
||||
private void startComputerUpdates() {
|
||||
|
@ -49,6 +49,8 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
||||
private SurfaceHolder renderTarget;
|
||||
private volatile boolean stopping;
|
||||
private CrashListener crashListener;
|
||||
private boolean reportedCrash;
|
||||
private int consecutiveCrashCount;
|
||||
|
||||
private boolean needsBaselineSpsHack;
|
||||
private SeqParameterSet savedSps;
|
||||
@ -111,11 +113,13 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
||||
this.renderTarget = renderTarget;
|
||||
}
|
||||
|
||||
public MediaCodecDecoderRenderer(int videoFormat, int bitrate, boolean batterySaver, CrashListener crashListener) {
|
||||
public MediaCodecDecoderRenderer(int videoFormat, int bitrate, boolean batterySaver,
|
||||
CrashListener crashListener, int consecutiveCrashCount) {
|
||||
//dumpDecoders();
|
||||
|
||||
this.bitrate = bitrate;
|
||||
this.crashListener = crashListener;
|
||||
this.consecutiveCrashCount = consecutiveCrashCount;
|
||||
|
||||
// Disable spinner threads in battery saver mode
|
||||
if (batterySaver) {
|
||||
@ -320,7 +324,10 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
||||
// This isn't the first time we've had an exception processing video
|
||||
if (System.currentTimeMillis() - initialExceptionTimestamp >= EXCEPTION_REPORT_DELAY_MS) {
|
||||
// It's been over 3 seconds and we're still getting exceptions. Throw the original now.
|
||||
if (!reportedCrash) {
|
||||
reportedCrash = true;
|
||||
crashListener.notifyCrash(initialException);
|
||||
}
|
||||
throw initialException;
|
||||
}
|
||||
}
|
||||
@ -916,6 +923,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
||||
str += "AVC Decoder: "+((renderer.avcDecoder != null) ? renderer.avcDecoder.getName():"(none)")+"\n";
|
||||
str += "HEVC Decoder: "+((renderer.hevcDecoder != null) ? renderer.hevcDecoder.getName():"(none)")+"\n";
|
||||
str += "Build fingerprint: "+Build.FINGERPRINT+"\n";
|
||||
str += "Consecutive crashes: "+renderer.consecutiveCrashCount+"\n";
|
||||
str += "Initial video dimensions: "+renderer.initialWidth+"x"+renderer.initialHeight+"\n";
|
||||
str += "FPS target: "+renderer.refreshRate+"\n";
|
||||
str += "Bitrate: "+renderer.bitrate+" Mbps \n";
|
||||
|
@ -48,7 +48,7 @@
|
||||
Using remote desktop software can also cause this error. Try rebooting your machine or reinstalling GFE.
|
||||
</string>
|
||||
<string name="title_decoding_error">Video Decoder Crashed</string>
|
||||
<string name="message_decoding_error">Moonlight has crashed due to a issue with this device\'s video decoder. Try adjusting the streaming settings if the crashes continue.</string>
|
||||
<string name="message_decoding_error">Moonlight has crashed due to a problem with this device\'s video decoder. Try adjusting the streaming settings if the crashes continue.</string>
|
||||
<string name="title_decoding_reset">Video Settings Reset</string>
|
||||
<string name="message_decoding_reset">Your device\'s video decoder continues to crash at your selected streaming settings. Your streaming settings have been reset to default.</string>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user