scrcpy: CompositionEngine: ANativeWindow::dequeueBuffer failed for display [scrcpy] with error: -32

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: Arch Linux
  • scrcpy version: 1.21
  • installation method: pacman
  • device model: Xiaomi M2101K6G
  • Android version: 12

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 exact CompositionEngine error in the issues. Also there is a weird thing. This is specific to the OMX.google.h264.encoder and c2.android.avc.encoder encoders. They don’t crash immediately they just start spamming the above mentioned CompositeEngine lines in the logcat.

Terminal output:

$ scrcpy
scrcpy 1.21 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 488.1 MB/s (40067 bytes in 0.000s)
[server] INFO: Device: Xiaomi M2101K6G (Android 12)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 21.3.4
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2400
WARN: Device disconnected
[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:110)
	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:65)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:93)
	at com.genymobile.scrcpy.Server.main(Server.java:309)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:357)

Logcat:

01-23 20:36:17.443 18781 18781 D AndroidRuntime: Calling main entry com.genymobile.scrcpy.Server
01-23 20:36:17.445 18781 18781 I scrcpy  : Device: Xiaomi M2101K6G (Android 12)
01-23 20:36:17.670 18796 18796 D AndroidRuntime: Calling main entry com.genymobile.scrcpy.CleanUp
01-23 20:36:18.090   640   640 E CompositionEngine: Error when queueing buffer for display [scrcpy]: -32
01-23 20:36:18.103   640   640 E CompositionEngine: ANativeWindow::dequeueBuffer failed for display [scrcpy] with error: -32
01-23 20:36:18.103   640   640 W CompositionEngine: Dequeuing buffer for display [scrcpy] failed, bailing out of client composition for this frame
01-23 20:36:18.117 18781 18781 E AndroidRuntime: 	at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:110)
01-23 20:36:18.117 18781 18781 E AndroidRuntime: 	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
01-23 20:36:18.117 18781 18781 E AndroidRuntime: 	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:65)
01-23 20:36:18.117 18781 18781 E AndroidRuntime: 	at com.genymobile.scrcpy.Server.scrcpy(Server.java:93)
01-23 20:36:18.117 18781 18781 E AndroidRuntime: 	at com.genymobile.scrcpy.Server.main(Server.java:309)
01-23 20:36:18.117 18781 18781 E scrcpy  : Exception on thread Thread[main,5,main]
01-23 20:36:18.117 18781 18781 E scrcpy  : java.lang.IllegalStateException
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3535)
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:110)
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:65)
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at com.genymobile.scrcpy.Server.scrcpy(Server.java:93)
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at com.genymobile.scrcpy.Server.main(Server.java:309)
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
01-23 20:36:18.117 18781 18781 E scrcpy  : 	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:357)
01-23 20:36:19.017 18796 18796 I scrcpy  : Cleaning up
01-23 20:36:19.024 18796 18796 I scrcpy  : Restoring normal power mode

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19

Commits related to this issue

Most upvoted comments

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.