scrcpy: IllegalStateException

I saw this exception every now and then and it will close the connection. See below screenshot:

scrcpy bug

scrcpy-server.jar: 1 file pushed. 1.3 MB/s (19346 bytes in 0.014s)
INFO: Initial texture: 720x1280
ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
        at android.media.MediaCodec.native_stop(Native Method)
        at android.media.MediaCodec.stop(MediaCodec.java:2015)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:75)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:28)
        at com.genymobile.scrcpy.Server.main(Server.java:110)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
Press any key to continue...

It happens when the screen orientation is changed most likely.

Does anyone know or understand what is going wrong in this case?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 33

Most upvoted comments

And with a lower definition?

scrcpy -m1024

i changed the encoder to: scrcpy --encoder OMX.google.h264.encoder and with this one it works perfectly, also in higher resolution, like 1920x1200, which is perfect. see here: https://github.com/Genymobile/scrcpy/blob/master/README.md#encoder