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

scrcpy don't connect android 11 device #1950

Open
2 tasks
SatanKiss opened this issue Dec 3, 2020 · 11 comments
Open
2 tasks

scrcpy don't connect android 11 device #1950

SatanKiss opened this issue Dec 3, 2020 · 11 comments

Comments

@SatanKiss
Copy link

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

Environment

  • OS: ArchLinux
  • scrcpy version: 1.16
  • installation method: pacman -S scrcpy
  • device model: xiaomi mi 6 (sagit)
  • device rom: sbwml AOSP GMS 11
  • Android version: 11

Describe the bug
use scrcpy connected my device,throw IllegalStateException.

On errors, please provide the output of the console (and adb logcat if relevant).
12-03 11:58:26.931 9644 9644 E APM_AudioPolicyManager: onNewAudioModulesAvailableInt: Input device list is empty!

Please paste terminal output in a code block.
INFO: scrcpy 1.16 https://github.com/Genymobile/scrcpy

  • daemon not running; starting now at tcp:5037
  • daemon started successfully
    /usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 1.5 MB/s (33622 bytes in 0.021s)
    [server] INFO: Device: Xiaomi MI 6 (Android 11)
    [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:108)
    at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:89)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:55)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
    at com.genymobile.scrcpy.Server.main(Server.java:225)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
    INFO: Renderer: opengl
    INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.2.3
    INFO: Trilinear filtering enabled
    INFO: Initial texture: 1080x1920
    WARN: Device disconnected
@rom1v
Copy link
Collaborator

rom1v commented Dec 3, 2020

@SatanKiss
Copy link
Author

SatanKiss commented Dec 3, 2020

when I use the command,the bug still not resolved;
my terminal output :

~ >>> scrcpy -m 1920                                                                          
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed... 0 skipped. 190.6 MB/s (33622 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.2.3
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x1920
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:3452)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:108)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:89)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:55)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
        at com.genymobile.scrcpy.Server.main(Server.java:225)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
~ >>> scrcpy -m 1920                                                                       [1]
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed... 0 skipped. 145.4 MB/s (33622 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.2.3
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x1920
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:3452)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:108)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:89)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:55)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
        at com.genymobile.scrcpy.Server.main(Server.java:225)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
~ >>> scrcpy -m 1024                                                                       [1]
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed... 0 skipped. 206.1 MB/s (33622 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.2.3
INFO: Trilinear filtering enabled
INFO: Initial texture: 576x1024
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:3452)
        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:108)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:89)
~ >>> scrcpy -m 800                                                                        [1]
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed... 0 skipped. 203.7 MB/s (33622 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.2.3
INFO: Trilinear filtering enabled
INFO: Initial texture: 448x800
WARN: Device disconnected

@rom1v
Copy link
Collaborator

rom1v commented Dec 3, 2020

So the problem is with your device encoder. Try with another encoder if possible: #1827 (comment)

@nalakawula
Copy link

┌─[sumar][x240][~]
└─▪ SCRCPY_SERVER_PATH=/home/sumar/Downloads/scrcpy-server scrcpy --encoder _
scrcpy: unrecognized option '--encoder'
┌─[sumar][x240][~]
└─▪ SCRCPY_SERVER_PATH=/home/sumar/Downloads/scrcpy-server scrcpy -v
scrcpy 1.16

dependencies:
 - SDL 2.0.12
 - libavcodec 58.91.100
 - libavformat 58.45.100
 - libavutil 56.51.100

@SatanKiss
Copy link
Author

SatanKiss commented Dec 11, 2020 via email

@imzf
Copy link

imzf commented Dec 15, 2020

scrcpy --encoder _
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...ped. 98.3 MB/s (34482 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
[server] ERROR: Exception on thread Thread[main,5,main]
com.genymobile.scrcpy.InvalidEncoderException: There is no encoder having name '_"
	at com.genymobile.scrcpy.ScreenEncoder.createCodec(ScreenEncoder.java:176)
	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:77)
	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:78)
	at com.genymobile.scrcpy.Server.main(Server.java:239)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
[server] ERROR: Try to use one of the available encoders:
[server] ERROR:     scrcpy --encoder-name 'OMX.qcom.video.encoder.avc'
[server] ERROR:     scrcpy --encoder-name 'c2.android.avc.encoder'
[server] ERROR:     scrcpy --encoder-name 'OMX.google.h264.encoder'
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 455.45.01
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x1920
WARN: Device disconnected
scrcpy --encoder OMX.qcom.video.encoder.avc
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...ed. 100.7 MB/s (34482 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 455.45.01
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x1920
WARN: Device disconnected
scrcpy --encoder c2.android.avc.encoder
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...ped. 89.5 MB/s (34482 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 455.45.01
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x1920
WARN: Device disconnected
scrcpy --encoder OMX.google.h264.encoder
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...ed. 100.4 MB/s (34482 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 455.45.01
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x1920

then get stuck

@rom1v
Copy link
Collaborator

rom1v commented Dec 15, 2020

Does recording work with:

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4

?

Also, could you test scrcpy v1.13 (or earlier version), please? (ref #240)

@imzf
Copy link

imzf commented Dec 16, 2020

Does recording work with:

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4

?
work fine

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4
/sdcard/file.mp4: 1 file pulled, 0 ski... 13.1 MB/s (111244296 bytes in 8.116s)

Also, could you test scrcpy v1.13 (or earlier version), please? (ref #240)

scrcpy -v

scrcpy 1.13

dependencies:

  • SDL 2.0.12
  • libavcodec 58.91.100
  • libavformat 58.45.100
  • libavutil 56.51.100

scrcpy

INFO: scrcpy 1.13 https://github.com/Genymobile/scrcpy
/usr/share/scrcpy/scrcpy-server: 1 fil...ped. 84.4 MB/s (27694 bytes in 0.000s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
[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:93)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:35)
at com.genymobile.scrcpy.Server.main(Server.java:177)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 455.45.01
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x1920
WARN: Device disconnected

@rom1v
Copy link
Collaborator

rom1v commented Dec 16, 2020

I guess you'll get the same error with v1.13 and scrcpy -m800?

I don't know, it's probably an encoder parameter passed by scrcpy which is not correctly supported by your hardware encoder:

MediaFormat format = new MediaFormat();
format.setString(MediaFormat.KEY_MIME, MediaFormat.MIMETYPE_VIDEO_AVC);
format.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);
// must be present to configure the encoder, but does not impact the actual frame rate, which is variable
format.setInteger(MediaFormat.KEY_FRAME_RATE, 60);
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, DEFAULT_I_FRAME_INTERVAL);
// display the very first frame, and recover from bad quality when no new frames
format.setLong(MediaFormat.KEY_REPEAT_PREVIOUS_FRAME_AFTER, REPEAT_FRAME_DELAY_US); // µs
if (maxFps > 0) {
// The key existed privately before Android 10:
// <https://android.googlesource.com/platform/frameworks/base/+/625f0aad9f7a259b6881006ad8710adce57d1384%5E%21/>
// <https://github.com/Genymobile/scrcpy/issues/488#issuecomment-567321437>
format.setFloat(KEY_MAX_FPS_TO_ENCODER, maxFps);
}

@SatanKiss
Copy link
Author

SatanKiss commented Dec 16, 2020 via email

@imzf
Copy link

imzf commented Dec 17, 2020

I guess you'll get the same error with v1.13 and scrcpy -m800?

same error

$ scrcpy -m800
INFO: scrcpy 1.13 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...pped. 2.1 MB/s (27694 bytes in 0.012s)
[server] INFO: Device: Xiaomi MI 6 (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 455.45.01
INFO: Trilinear filtering enabled
INFO: Initial texture: 448x800
[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:93)
	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:35)
	at com.genymobile.scrcpy.Server.main(Server.java:177)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
WARN: Device disconnected

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

4 participants