-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom android 12 root not working #2988
Comments
Oh, I think I missed to catch some errors to retry in #2947. Could you please replace this file in v1.22, and post the whole console output?
diffdiff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index 4c23dd92..79efc17c 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -89,13 +89,15 @@ public class ScreenEncoder implements Device.RotationListener {
Rect unlockedVideoRect = screenInfo.getUnlockedVideoSize().toRect();
int videoRotation = screenInfo.getVideoRotation();
int layerStack = device.getLayerStack();
-
setSize(format, videoRect.width(), videoRect.height());
- configure(codec, format);
- Surface surface = codec.createInputSurface();
- setDisplaySurface(display, surface, videoRotation, contentRect, unlockedVideoRect, layerStack);
- codec.start();
+
+ Surface surface = null;
try {
+ configure(codec, format);
+ surface = codec.createInputSurface();
+ setDisplaySurface(display, surface, videoRotation, contentRect, unlockedVideoRect, layerStack);
+ codec.start();
+
alive = encode(codec, fd);
// do not call stop() on exception, it would trigger an IllegalStateException
codec.stop();
@@ -119,7 +121,9 @@ public class ScreenEncoder implements Device.RotationListener {
} finally {
destroyDisplay(display);
codec.release();
- surface.release();
+ if (surface != null) {
+ surface.release();
+ }
}
} while (alive);
} finally { Thank you |
|
OK, great, the retry mechanism now works in your case. But it seems your device can't encode the screen at any definition. You could try with a different encoder: https://github.com/Genymobile/scrcpy#encoder Also, does
|
C:\Users\Fitertomus\Downloads\Новая папка (2)>adb shell screenrecord /sdcard/file.mp4 C:\Users\Fitertomus\Downloads\Новая папка (2)>adb pull /sdcard/file.mp4 C:\Users\Fitertomus\Downloads\Новая папка (2)>scrcpy --encoder 'OMX.google.h264.encoder' C:\Users\Fitertomus\Downloads\Новая папка (2)>scrcpy --encoder 'OMX.MTK.VIDEO.ENCODER.AVC' |
if anything on the official firmware miui 12.5 scrcpy worked without problems |
OK, if screenrecord does not work, then there's definitely a bug in the ROM. |
I have a built-in screen recording on my phone and from the very beginning it doesn’t work, maybe it’s somehow related, but third-party recording applications asked for access to broadcast / screen recording, it’s possible and it’s somehow connected with this, maybe the protection of android 12 does not allow third-party programs to record screen without permission and these applications simply do not request it |
The new retry mechanism with a lower definition only worked if the error occurred during encode(). For example: java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:114) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:95) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:61) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:255) However, MediaCodec may also fail before encoding, during configure() or start(). For example: ERROR: Exception on thread Thread[main,5,main] android.media.MediaCodec$CodecException: Error 0xfffffc0e at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:1956) at android.media.MediaCodec.configure(MediaCodec.java:1885) at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:158) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:68) at com.genymobile.scrcpy.Server.scrcpy(Server.java:28) at com.genymobile.scrcpy.Server.main(Server.java:110) Also downscale and retry in these cases. Refs #2947 <#2947> Refs #2988 <#2988>
The new retry mechanism with a lower definition only worked if the error occurred during encode(). For example: java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:114) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:95) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:61) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:255) However, MediaCodec may also fail before encoding, during configure() or start(). For example: android.media.MediaCodec$CodecException: Error 0xfffffc0e at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:1956) at android.media.MediaCodec.configure(MediaCodec.java:1885) at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:158) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:68) at com.genymobile.scrcpy.Server.scrcpy(Server.java:28) at com.genymobile.scrcpy.Server.main(Server.java:110) Also downscale and retry in these cases. Refs #2947 <#2947> Refs #2988 <#2988>
The new retry mechanism with a lower definition only worked if the error occurred during encode(). For example: java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:114) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:95) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:61) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:255) However, MediaCodec may also fail before encoding, during configure() or start(). For example: android.media.MediaCodec$CodecException: Error 0xfffffc0e at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:1956) at android.media.MediaCodec.configure(MediaCodec.java:1885) at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:158) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:68) at com.genymobile.scrcpy.Server.scrcpy(Server.java:28) at com.genymobile.scrcpy.Server.main(Server.java:110) Also downscale and retry in these cases. Refs #2947 <#2947> Refs #2988 <#2988>
The new retry mechanism with a lower definition only worked if the error occurred during encode(). For example: java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:114) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:95) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:61) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:255) However, MediaCodec may also fail before encoding, during configure() or start(). For example: android.media.MediaCodec$CodecException: Error 0xfffffc0e at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:1956) at android.media.MediaCodec.configure(MediaCodec.java:1885) at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:158) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:68) at com.genymobile.scrcpy.Server.scrcpy(Server.java:28) at com.genymobile.scrcpy.Server.main(Server.java:110) Also downscale and retry in these cases. Refs #2947 <#2947> Refs #2988 <#2988> PR #2990 <#2990>
The new retry mechanism with a lower definition only worked if the error occurred during encode(). For example: java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:114) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:95) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:61) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:255) However, MediaCodec may also fail before encoding, during configure() or start(). For example: android.media.MediaCodec$CodecException: Error 0xfffffc0e at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:1956) at android.media.MediaCodec.configure(MediaCodec.java:1885) at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:158) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:68) at com.genymobile.scrcpy.Server.scrcpy(Server.java:28) at com.genymobile.scrcpy.Server.main(Server.java:110) Also downscale and retry in these cases. Refs #2947 <#2947> Refs #2988 <#2988> PR #2990 <#2990>
The new retry mechanism with a lower definition only worked if the error occurred during encode(). For example: java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:114) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:95) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:61) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:255) However, MediaCodec may also fail before encoding, during configure() or start(). For example: android.media.MediaCodec$CodecException: Error 0xfffffc0e at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:1956) at android.media.MediaCodec.configure(MediaCodec.java:1885) at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:158) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:68) at com.genymobile.scrcpy.Server.scrcpy(Server.java:28) at com.genymobile.scrcpy.Server.main(Server.java:110) Also downscale and retry in these cases. Refs #2947 <#2947> Refs #2988 <#2988> PR #2990 <#2990>
I was getting the same error. once I started screen recording on android just once and stopped, scrcpy also started working. |
I have read the FAQ.
I have searched in existing issues.
OS: Windows 11
scrcpy version: 1.22
installation method: Windows release
device model: Xiaomi redmi note 8 pro mediatek
Android version: 12
i use android 12 i really need a script on it but it doesn't work i looked at similar threads on this topic but didn't find anything
The text was updated successfully, but these errors were encountered: