Display and control your Android device
Suggest workaround for error 0xfffffc0e
Romain Vimont8a694a978553
diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.javaindex d4691e7c..87aeacac 100644--- a/server/src/main/java/com/genymobile/scrcpy/Server.java+++ b/server/src/main/java/com/genymobile/scrcpy/Server.java@@ -1,6 +1,8 @@package com.genymobile.scrcpy;import android.graphics.Rect;+import android.media.MediaCodec;+import android.os.Build;import java.io.File;import java.io.IOException;@@ -133,11 +135,25 @@ public final class Server {}}+ private static void suggestFix(Throwable e) {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {+ if (e instanceof MediaCodec.CodecException) {+ MediaCodec.CodecException mce = (MediaCodec.CodecException) e;+ if (mce.getErrorCode() == 0xfffffc0e) {+ Ln.e("The hardware encoder is not able to encode at the given definition.");+ Ln.e("Try with a lower definition:");+ Ln.e(" scrcpy -m 1024");+ }+ }+ }+ }+public static void main(String... args) throws Exception {Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {@Overridepublic void uncaughtException(Thread t, Throwable e) {Ln.e("Exception on thread " + t, e);+ suggestFix(e);}});