Skip to content
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

IllegalStateException #465

Closed
lancevalour opened this issue Mar 21, 2019 · 33 comments
Closed

IllegalStateException #465

lancevalour opened this issue Mar 21, 2019 · 33 comments

Comments

@lancevalour
Copy link

lancevalour commented Mar 21, 2019

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?

@rom1v
Copy link
Collaborator

rom1v commented Mar 21, 2019

When this happens, are there more relevant logs in the output of adb logcat, please?

@rom1v
Copy link
Collaborator

rom1v commented Mar 21, 2019

This will not solve your problem, but this will avoid to call stop() on an invalid state: 3eda38e.

That way, you should get the root cause exception printed.

scrcpy-server.jar
SHA256: 897d5c7b4178870093d6cd30a84b966b4b2c4585a5e71e3ba9ef472b86d7b56d

@lancevalour
Copy link
Author

@rom1v thanks I will try the new jar. Will update if I see that again.

@chandru-m
Copy link

I see a similar exception recently .

image

@chandru-m
Copy link

"adb shell screenrecord /sdcard/video.mp4" works. Vysor works. However on running scrcpy , I see the device crashing as well. Tried the jar file suggested in the comments above.

@rom1v
Copy link
Collaborator

rom1v commented May 4, 2019

And with a lower definition?

scrcpy -m1024

@rom1v
Copy link
Collaborator

rom1v commented May 4, 2019

The exception in the screenshot is with the jar above, or with v1.8? (or is it the very same on both?)

(btw, please copy paste instead of screenshot, so that the content is searchable)

@chandru-m
Copy link

chandru-m commented May 5, 2019

Hi Rom, thanks for the reply. On few builds when I try scrcpy -m 512 , I get a green screen . Few builds device crashes.BTW, I tried both the jar files.

scrcpy-server.jar: 1 file pushed. 0.4 MB/s (19734 bytes in 0.045s)
INFO: Initial texture: 1440x2880
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:2110)
        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:338)
ERROR: Could not open video stream
Press any key to continue...

Not sure why I see this. Need your help.

@rom1v
Copy link
Collaborator

rom1v commented May 5, 2019

When this happens, are there errors in the output of adb logcat?

@lancevalour
Copy link
Author

Just happened to me with the new JAR, logcat output as follows:

2019-05-07 13:38:49.436 2699-2716/? W/ACodec: do not know color format 0x7f000789 = 2130708361
2019-05-07 13:38:49.439 704-13337/? E/OMX-VENC: Does not handle dataspace request
2019-05-07 13:38:49.439 704-13337/? E/OMXNodeInstance: getConfig(2c00052:qcom.encoder.avc, ??(0x7f000062)) ERROR: UnsupportedSetting(0x80001019)
2019-05-07 13:38:49.441 704-1399/? D/GraphicBufferSource: setting dataspace: 0x104
2019-05-07 13:38:49.442 704-1008/? E/OMXNodeInstance: getParameter(2c00052:qcom.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
2019-05-07 13:38:49.442 704-1096/? D/GraphicBufferSource: requesting color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M))
2019-05-07 13:38:49.462 527-527/? I/SurfaceFlinger: EGL information:
2019-05-07 13:38:49.462 527-527/? I/SurfaceFlinger: vendor    : Android
2019-05-07 13:38:49.462 527-527/? I/SurfaceFlinger: version   : 1.4 Android META-EGL
2019-05-07 13:38:49.462 527-527/? I/SurfaceFlinger: extensions: EGL_KHR_get_all_proc_addresses EGL_ANDROID_presentation_time EGL_KHR_swap_buffers_with_damage EGL_ANDROID_create_native_client_buffer EGL_ANDROID_front_buffer_auto_refresh EGL_KHR_image EGL_KHR_image_base EGL_KHR_lock_surface EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_fence_sync EGL_KHR_create_context EGL_EXT_create_context_robustness EGL_ANDROID_image_native_buffer EGL_KHR_wait_sync EGL_ANDROID_recordable EGL_KHR_partial_update
2019-05-07 13:38:49.462 527-527/? I/SurfaceFlinger: Client API: OpenGL_ES
2019-05-07 13:38:49.462 527-527/? I/SurfaceFlinger: EGLSurface: 8-8-8-8, config=0x5
2019-05-07 13:38:49.486 2699-2699/? I/MediaCodec: (0xa98d7080) start
2019-05-07 13:38:49.497 2699-2715/? I/MediaCodec: (0xa98d7080) input buffers allocated
2019-05-07 13:38:49.497 2699-2715/? I/MediaCodec: (0xa98d7080) numBuffers (9)
2019-05-07 13:38:49.503 2699-2715/? I/MediaCodec: (0xa98d7080) output buffers allocated
2019-05-07 13:38:49.503 2699-2715/? I/MediaCodec: (0xa98d7080) numBuffers (4)
2019-05-07 13:38:49.504 704-2725/? D/GraphicBufferSource: got buffer with new dataSpace #104
2019-05-07 13:38:49.504 704-2725/? I/OMX-VENC: get_config (dataspace changed): ColorSpace: Recommend 601-limited for RGBA8888
2019-05-07 13:38:49.504 704-2725/? D/GraphicBufferSource: Codec resolved it to (R:2(Limited), P:3(BT601_6_625), M:3(BT601_6), T:3(SMPTE170M)) err=0(NO_ERROR)
2019-05-07 13:38:49.504 2699-2716/? D/ACodec: dataspace changed to 0x10c10000 (R:2(Limited), P:3(BT601_6_625), M:3(BT601_6), T:3(SMPTE170M)) (R:2(Limited), S:1(BT709), T:3(SMPTE_170M))
2019-05-07 13:38:49.504 704-2725/? I/OMX-VENC: open Color conv forW: 720, H: 1280
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: send OMX_ErrorHardware to Client
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.529 2699-2716/? E/ACodec: [OMX.qcom.video.encoder.avc] ERROR(0x80001009)
2019-05-07 13:38:49.529 2699-2716/? E/ACodec: signalError(omxError 0x80001009, internalError -2147483648)
2019-05-07 13:38:49.529 2699-2715/? E/MediaCodec: Codec reported err 0x80001009, actionCode 0, while in state 6
2019-05-07 13:38:49.530 2699-2699/? I/MediaCodec: (0xa98d7080) stop
2019-05-07 13:38:49.530 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.530 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.530 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.530 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.530 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.530 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.531 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.532 2699-2699/? D/AndroidRuntime: Shutting down VM
2019-05-07 13:38:49.533 2699-2699/? E/scrcpy: 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)
2019-05-07 13:38:49.571 704-1399/? E/OMXNodeInstance: !!! Observer died. Quickly, do something, ... anything...
2019-05-07 13:38:49.671 704-1399/? W/GraphicBufferSource: Dropped back down to Loaded without Executing
2019-05-07 13:38:49.676 704-2726/? E/OMX-VENC: async_venc_message_thread interrupted to be exited

@rom1v
Copy link
Collaborator

rom1v commented May 7, 2019

Thank you for the details.

2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: Failed to qbuf (ftb) to driver
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: dev_fill_buf() Failed
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: FTBProxy() failed!
2019-05-07 13:38:49.529 704-2725/? E/OMX-VENC: ERROR: send OMX_ErrorHardware to Client

So the root cause seems a hardware encoder crash. The exception is just a harmless consequence (the video streaming already stopped due to this issue, and calling stop() to stop the encoder fails with an exception afterwards).

@lancevalour
Copy link
Author

@rom1v , any idea why hardware encoder crashes?

@chandru-m
Copy link

chandru-m commented May 14, 2019

Again, as I mentioned before, I see green screen on trying scrcpy -m 640 -b 500000 , also tried with -m 320..
Vysor works though.. thats the catch.. not able to figure how that works and not scrcpy..

Vysor:

05-13 21:47:27.919 20575 21246 I ACodec  : setupVideoEncoder succeeded
05-13 21:47:27.919 20575 21246 I ExtendedACodec: [OMX.qcom.video.encoder.avc] configure, AMessage : AMessage(what = 'conf', target = 4) = {
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   int32_t color-format = 2130708361
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   int32_t i-frame-interval = 30
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   string mime = "video/avc"
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   int32_t width = 320
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   int32_t bitrate = 500000
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   int32_t frame-rate = 30
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   int32_t height = 640
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   int64_t repeat-previous-frame-after = 33000
05-13 21:47:27.919 20575 21246 I ExtendedACodec:   int32_t encoder = 1
05-13 21:47:27.919 20575 21246 I ExtendedACodec: }

Scrcpy:

static metadata. Ignoring.
05-13 22:21:32.565  6535  6550 I ACodec  : setupVideoEncoder succeeded
05-13 22:21:32.565  6535  6550 I ExtendedACodec: [OMX.qcom.video.encoder.avc] configure, AMessage : AMessage(what = 'conf', target = 1) = {
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   int32_t color-format = 2130708361
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   int32_t i-frame-interval = 10
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   string mime = "video/avc"
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   int32_t width = 320
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   int32_t bitrate = 5000000
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   int32_t frame-rate = 60
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   int64_t repeat-previous-frame-after = 100000
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   int32_t height = 640
05-13 22:21:32.565  6535  6550 I ExtendedACodec:   int32_t encoder = 1
05-13 22:21:32.565  6535  6550 I ExtendedACodec: }

@chandru-m
Copy link

image

@rom1v
Copy link
Collaborator

rom1v commented May 14, 2019

Then you could try to play with these parameters, and find values which does not crash your encoder (maybe use the same values as Vysor):

format.setString(MediaFormat.KEY_MIME, "video/avc");
format.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);
format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, iFrameInterval);
// display the very first frame, and recover from bad quality when no new frames
format.setLong(MediaFormat.KEY_REPEAT_PREVIOUS_FRAME_AFTER, MICROSECONDS_IN_ONE_SECOND * REPEAT_FRAME_DELAY / frameRate); // µs

@axti
Copy link

axti commented Oct 1, 2019

We have simmilar issue, logs:

E/OMXMaster: OMX plugin failed w/ error 0x80001001 after registering 0 components
E/SoftAVCEncoder: Failed to initialize the encoder: -8
E/ACodec: [OMX.google.h264.encoder] ERROR(0x80001001)
E/ACodec: signalError(omxError 0x80001001, internalError -2147483648)
E/MediaCodec: Codec reported err 0x80001001, actionCode 0, while in state 6
E/scrcpy: Exception on thread Thread[main,5,main]

@rom1v
Copy link
Collaborator

rom1v commented Oct 1, 2019

@axti This might help: #666 (comment)

@zackae92
Copy link

zackae92 commented Nov 7, 2019

hi.... please help me....

i have a problem to load scrcpy. its show like this

PS C:\scrcpy-win32-v1.10> scrcpy
INFO: scrcpy 1.10 https://github.com/Genymobile/scrcpy
C:\scrcpy-win32-v1.10\scrcpy-server.jar: 1 file pushed. 7.6 MB/s (73119 bytes in 0.009s)
ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalArgumentException: Expecting 5 parameters
at com.genymobile.scrcpy.Server.createOptions(Server.java:53)
at com.genymobile.scrcpy.Server.main(Server.java:109)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:361)

PLease help me

@rom1v
Copy link
Collaborator

rom1v commented Nov 7, 2019

This error happens when you use a scrcpy-server.jar from a version different from scrcpy.exe. For exemple, one in v1.8 and the other in v1.10.

@zackae92
Copy link

zackae92 commented Nov 7, 2019

i changed but still out like this

PS C:\scrcpy64> adb devices
List of devices attached
9T4TWCTCGYGAONGQ        device

PS C:\scrcpy64> scrcpy
INFO: scrcpy 1.10 <https://github.com/Genymobile/scrcpy>
C:\scrcpy64\scrcpy-server.jar: 1 file pushed. 0.9 MB/s (22546 bytes in 0.023s)
INFO: Initial texture: 1080x2336
[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:2637)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:91)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:72)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:32)
        at com.genymobile.scrcpy.Server.main(Server.java:133)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:361)
Press any key to continue...
PS C:\scrcpy64>

@zackae92
Copy link

zackae92 commented Nov 8, 2019

Sir... please help me... it still out like that

PS C:\scrcpywin64110> adb devices
List of devices attached
9T4TWCTCGYGAONGQ device

PS C:\scrcpywin64110> scrcpy.exe
INFO: scrcpy 1.10 https://github.com/Genymobile/scrcpy
C:\scrcpywin64110\scrcpy-server.jar: 1 file pushed. 4.2 MB/s (22546 bytes in 0.005s)
INFO: Initial texture: 1080x2336
[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:2637)
at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:91)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:72)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:32)
at com.genymobile.scrcpy.Server.main(Server.java:133)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:361)
Press any key to continue...
PS C:\scrcpywin64110>

@Genymobile Genymobile deleted a comment from zackae92 Nov 8, 2019
@rom1v
Copy link
Collaborator

rom1v commented Nov 8, 2019

Sir... please help me... it still out like that

I can't help without a device to reproduce.

But you can help:

#465 (comment)
#666 (comment)

@lefrankleal
Copy link

lefrankleal commented Nov 27, 2019

This was my problem:
[server] 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:1967) at android.media.MediaCodec.configure(MediaCodec.java:1896) at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:157) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:67) at com.genymobile.scrcpy.Server.scrcpy(Server.java:32) at com.genymobile.scrcpy.Server.main(Server.java:133) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:371) Exit due to uncaughtException in main thread:

and this worked for me

scrcpy -m1024

@rom1v
Copy link
Collaborator

rom1v commented Jan 22, 2020

and this worked for me

scrcpy -m1024

Indeed, it seems it solves the problem for other users too: #1103 (comment)

@tony8077616
Copy link

and this worked for me

scrcpy -m1024

Indeed, it seems it solves the problem for other users too: #1103 (comment)

scrcpy -m1024
this isn't work for me...same error

@maddinmcfly
Copy link

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

@Rivelles12
Copy link

Someone can help me? Please...

C:\Scrcpy>scrcpy -m 1024
scrcpy 1.23 https://github.com/Genymobile/scrcpy
C:\Scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 30.9 MB/s (41123 bytes in 0.001s)
[server] INFO: Device: Xiaomi M2101K6G (Android 12)
INFO: Renderer: direct3d
INFO: Initial texture: 464x1024
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
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:152)
at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:102)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:101)
at com.genymobile.scrcpy.Server.main(Server.java:331)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:363)

    Device: RedmiNote10PRO - Version MIUI 13

@vielavlrs
Copy link

Someone can help me? Please...

C:\Scrcpy>scrcpy -m 1024 scrcpy 1.23 https://github.com/Genymobile/scrcpy C:\Scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 30.9 MB/s (41123 bytes in 0.001s) [server] INFO: Device: Xiaomi M2101K6G (Android 12) INFO: Renderer: direct3d INFO: Initial texture: 464x1024 [server] ERROR: Encoding error: java.lang.IllegalStateException: null 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:152) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:102) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74) at com.genymobile.scrcpy.Server.scrcpy(Server.java:101) at com.genymobile.scrcpy.Server.main(Server.java:331) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:363)

    Device: RedmiNote10PRO - Version MIUI 13

Have you found any fix for this? I have the same device and just upgraded to MIUI13

@Rivelles12
Copy link

Nothing to here, bro! I still have the same problem...

@rom1v
Copy link
Collaborator

rom1v commented Mar 7, 2022

It seems there is a bug in MIUI13 (many reports from users after the upgrade).

@Rivelles12
Copy link

Is there any solution? Also notice that the transmission is a little stuck.

@spannm
Copy link

spannm commented Mar 12, 2022

Also getting MediaCodec error using latest 64-bit scrcpy v1.23 on Xiaomi M2101K6G (Android 12) under 64-bit Windows 10 v10.0.19044.1586. Stopped working after Android 12 upgrade (I think). Tried various workarounds to no avail.

C:\bin\scrcpy-win64>scrcpy-console.bat
scrcpy 1.23 <https://github.com/Genymobile/scrcpy>
C:\bin\scrcpy-win64\scrcpy-server: 1 file pushed, 0 skipped. 59.4 MB/s (41123 bytes in 0.001s)
[server] INFO: Device: Xiaomi M2101K6G (Android 12)
INFO: Renderer: direct3d
INFO: Initial texture: 1080x2400
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
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:152)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:102)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:101)
        at com.genymobile.scrcpy.Server.main(Server.java:331)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:363)

@rom1v
Copy link
Collaborator

rom1v commented Mar 12, 2022

#3051

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests