Closed cameralis closed 2 years ago
Please test #2947.
I builded the dev branch but it doesn't seem to work. (Same issue still)
I builded the dev branch but it doesn't seem to work. (Same issue still)
How do you run what you built from the dev
branch? Did you also build the server?
Found some additional logs that might be related:
01-23 21:00:24.937 22042 22042 D MediaCodecsXmlParser: parsing /vendor/etc/media_codecs.xml...
01-23 21:00:24.937 22042 22042 D MediaCodecsXmlParser: parsing /vendor/etc/media_codecs_google_audio.xml...
01-23 21:00:24.937 22042 22042 D MediaCodecsXmlParser: parsing /vendor/etc/media_codecs_google_telephony.xml...
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: parsing /vendor/etc/media_codecs_google_video.xml...
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: parsing /vendor/etc/media_codecs_performance.xml...
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.qti.avc.encoder at line 53 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.avc.encoder at line 77 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.hevc.encoder at line 83 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.h263.encoder at line 86 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.mpeg4.encoder at line 89 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.vp8.encoder at line 92 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.qti.avc.encoder at line 98 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.938 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.qti.avc.decoder at line 141 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.939 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.avc.decoder at line 182 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.939 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.hevc.decoder at line 188 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.939 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.h263.decoder at line 195 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.939 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.mpeg4.decoder at line 199 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.939 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.vp8.decoder at line 202 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.939 22042 22042 D MediaCodecsXmlParser: MediaCodec: cannot update non-existing codec: c2.android.vp9.decoder at line 207 of /vendor/etc/media_codecs_performance.xml
01-23 21:00:24.939 22042 22042 I MediaCodecsXmlParser: Did not find media_codecs_shaping.xml in search path
01-23 21:00:24.939 22042 22042 E MediaCodecsXmlParser: Cannot find the role for a decoder of type video/divx4
01-23 21:00:24.939 22042 22042 E MediaCodecsXmlParser: Cannot find the role for a decoder of type video/divx
01-23 21:00:24.939 22042 22042 E MediaCodecsXmlParser: Cannot find the role for a decoder of type video/mp4v-esdp
How do you run what you built from the
dev
branch? Did you also build the server?
$ git clone https://github.com/Genymobile/scrcpy
$ git checkout dev
$ ./install_release.sh
install_release
is just for building the official release (it downloads the prebuilt server).
Anyway, with the official release, just execute scrcpy -m1024
: https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#exception
Okay I'm sorry, I just realized this doesn't build the server. I'll try again with building the server.
Anyway, with the official release, just execute
scrcpy -m1024
:
In the describe this bug section I wrote:
I've tried different resolutions and encoders, but none of them helped.
So yeah, it didn't help unfortunately.
Here's the output with scrcpy-server
built from the dev branch:
$ build/app/scrcpy -m1024
scrcpy 1.21 <https://github.com/Genymobile/scrcpy>
DEBUG: Using server: /usr/local/share/scrcpy/scrcpy-server
/usr/local/share/scrcpy/scrcpy-server: 1 file pus...ed, 0 skipped. 509.8 MB/s (60376 bytes in 0.000s
DEBUG: Screensaver enabled
[server] INFO: Device: Xiaomi M2101K6G (Android 12)
DEBUG: Server connected
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 21.3.4
INFO: Trilinear filtering enabled
DEBUG: Using icon: /usr/local/share/icons/hicolor/256x256/apps/scrcpy.png
INFO: Initial texture: 464x1024
DEBUG: Starting stream thread
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
DEBUG: End of frames
WARN: Device disconnected
DEBUG: quit...
DEBUG: Receiver stopped
[server] DEBUG: Device message sender stopped
[server] DEBUG: Controller stopped
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3535)
at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:147)
at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:99)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:73)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:93)
at com.genymobile.scrcpy.Server.main(Server.java:303)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:357)
DEBUG: Server disconnected
DEBUG: Server terminated
INFO: Initial texture: 464x1024 DEBUG: Starting stream thread [server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc' [server] ERROR: Encoding error: java.lang.IllegalStateException: null
Hmm, weird, it should retry with -m800 (that might not solve your problem, but this is still unexpected):
Could you try with this additional diff, please?
diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index e4e87c72..4c23dd92 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -159,7 +159,10 @@ public class ScreenEncoder implements Device.RotationListener {
}
IO.writeFully(fd, codecBuffer);
- firstFrameSent = true;
+ if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) == 0) {
+ // If this is not a config packet, then it contains a frame
+ firstFrameSent = true;
+ }
}
} finally {
if (outputBufferId >= 0) {
$ build/app/scrcpy -m1024 scrcpy 1.21 <https://github.com/Genymobile/scrcpy> DEBUG: Using server: /usr/local/share/scrcpy/scrcpy-server
Also, you should run ./run build -m1024
instead, to use the correct scrcpy-server
:wink:
Before running it I copied build/server/scrcpy-server
to /usr/local/share/scrcpy/
so that should be fine but the run script is more convenient.
The patch didn't help unfortunately, everything still looks the same. :/ (Although now I can see it retrying in the logs)
(Although now I can see it retrying in the logs)
Thank you, that fixes the new retry feature in the next release (introduced by #2947): a9429efa34b3cbdc57847cb37d3621b889522c7f :tada:
everything still looks the same
This problem might be specific to my phone but it's worth a try.
Probably a device problem indeed.
Try with a tiny definition just to confim (scrcpy -m 200
).
Also try to record with screenrecord
:
adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4
Does it work?
This is specific to the
OMX.google.h264.encoder
andc2.android.avc.encoder
encoders.
Are there other encoders on the device? How do they behave?
Some more logs that might be related (this appears before scrcpy crashes):
01-23 21:48:36.125 25213 25355 E Adreno-C2D: <c2d_surface_createYUV:1468>: Error Surface creation failed, error=1, one or more attributes are not aligned for this surface type: surf_bits=11, format=8388760, stride0=1152, stride1=1, stride2=1152, height0=2400, height1=1200, height2=0, phys0=0x00e00000, phys1=0x010a8000, phys2=0x01152000
01-23 21:48:36.125 25213 25355 E C2DColorConvert: convertC2D: Update dst surface def failed (1)
01-23 21:48:36.127 25213 25355 E OMX-VENC: Color Conversion failed
01-23 21:48:36.130 25213 25355 E OMX-VENC: ERROR: ETBProxy() failed!
01-23 21:48:36.130 25213 25355 E OMX-VENC: ERROR: send OMX_ErrorHardware to Client
01-23 21:48:36.131 25332 25353 E ACodec : [OMX.qcom.video.encoder.avc] ERROR(0x80001009)
01-23 21:48:36.131 25332 25353 E ACodec : signalError(omxError 0x80001009, internalError -2147483648)
01-23 21:48:36.131 25332 25352 E MediaCodec: Codec reported err 0x80001009, actionCode 0, while in state 6/STARTED
01-23 21:48:36.134 25332 25332 E scrcpy : Encoding error: java.lang.IllegalStateException: null
01-23 21:48:36.138 25332 25351 D scrcpy : Device message sender stopped
01-23 21:48:36.144 25332 25350 D scrcpy : Controller stopped
01-23 21:48:36.145 25332 25332 D AndroidRuntime: Shutting down VM
01-23 21:48:36.146 25332 25353 E ACodec : signalError(omxError 0x80001001, internalError -2147483646)
I'll test the things you've suggested in a minute.
scrcpy --encoder _
lists:
OMX.qcom.video.encoder.avc
crashesc2.android.avc.encoder
draws a few frames then hangsOMX.google.h264.encoder
draws a few frames then hangsc2.qti.avc.encoder
draws a few frames then hangsclosing because of inactivity and possibly a specific hardware problem
at least I'm not the only one... #3051
Updating to Android 12L solved this issue. Everything is working fine as it should.
@rom1v I've noticed recently that on v2.4, even though it's not crashing as written here, I get a similar error log, all the time, about 20 times every second, as such:
CompositionEngine surfaceflinger ANativeWindow::dequeueBuffer failed for display [scrcpy] with error: -32
Is it a known issue? Related to here? Why does it occur? It's spamming logcat...
This was tested on Pixel 6 with Android 14.
Environment
Describe the bug
scrcpy
crashes after a few frames. I've tried different resolutions and encoders, but none of them helped. This problem might be specific to my phone but it's worth a try. Also i couldn't find this exactCompositionEngine
error in the issues. Also there is a weird thing. This is specific to theOMX.google.h264.encoder
andc2.android.avc.encoder
encoders. They don't crash immediately they just start spamming the above mentioned CompositeEngine lines in the logcat.Terminal output:
Logcat: