Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.31k stars 10.67k forks source link

[server] ERROR: Exception on thread Thread[main,5,main] #1917

Open HilbertPurba opened 3 years ago

HilbertPurba commented 3 years ago

Device

I run scrcpy command but it shows the output below. I'm not sure what's wrong with it, is it because I'm using Android 11?

hilbert@Mint:~$ scrcpy
INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...shed. 0.3 MB/s (24773 bytes in 0.072s)
INFO: Initial texture: 720x1440
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
    at android.media.MediaCodec.releaseOutputBuffer(Native Method)
    at android.media.MediaCodec.releaseOutputBufferInternal(MediaCodec.java:3568)
    at android.media.MediaCodec.releaseOutputBuffer(MediaCodec.java:3489)
    at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:110)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:73)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:34)
    at com.genymobile.scrcpy.Server.main(Server.java:163)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:401)
WARN: Device disconnected

I've read the faq you've given here: https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#i-get-an-error-could-not-open-video-stream

So I tried to use a lower resolution. But still outputs the same error message

hilbert@Mint:~$ scrcpy -m 1024
INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 3.2 MB/s (24773 bytes in 0.007s)
INFO: Initial texture: 512x1024
[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:3452)
    at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:92)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:73)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:34)
    at com.genymobile.scrcpy.Server.main(Server.java:163)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:401)
WARN: Device disconnected

hilbert@Mint:~$ scrcpy -m 800
INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 1.4 MB/s (24773 bytes in 0.017s)
INFO: Initial texture: 400x800
[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:3452)
    at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:92)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:73)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:34)
    at com.genymobile.scrcpy.Server.main(Server.java:163)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:401)
WARN: Device disconnected

What shoud I do?

rom1v commented 3 years ago

Try with another encoder: https://github.com/Genymobile/scrcpy/pull/1827#issuecomment-725933512

HilbertPurba commented 3 years ago

Ok i reinstall scrcpy with the snap package, and downloaded the scrcpy-server file from #1827 but im not sure what to do with it. I run the command the build it didn't work

hilbert@Mint:~$ meson x --buildtype release --strip -Db_lto=true \
>     -Dprebuilt_server=~/Downloads/scrcpy-server

ERROR: Neither directory contains a build file meson.build.

I tried copying the new scrcpy-server to the /path/to/scrcpy-server on the snap package but it wont allow me.

hilbert@Mint:~$ sudo cp ~/Downloads/scrcpy-server /snap/scrcpy/254/usr/local/share/scrcpy/scrcpy-server 
[sudo] password for hilbert:          
cp: cannot create regular file '/snap/scrcpy/254/usr/local/share/scrcpy/scrcpy-server': Read-only file system

hilbert@Mint:~$ sudo cp ~/Downloads/scrcpy-server /snap/scrcpy/current/usr/local/share/scrcpy/scrcpy-server
cp: cannot create regular file '/snap/scrcpy/current/usr/local/share/scrcpy/scrcpy-server': Read-only file system