Genymobile / Genymobile/scrcpy

Connection TCPIP: android.media.MediaCodec.native_dequeueOutputBuffer [scrcpy 1.24]

Open
#3,367 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
150k
Forks
13.7k
Avg merge
4d 13h
Merged PRs (30d)
2

Description

- [x] I have read the [FAQ](https://github.com/Genymobile/scrcpy/blob/master/FAQ.md).
- [x] I have searched in existing [issues](https://github.com/Genymobile/scrcpy/issues).
- [x] I have tried https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#exception

**Environment**
- OS: macOS 12.4 (chip M1)
- scrcpy version: 1.24
- SDL: 2.0.22 / 2.0.22
- libavcodec: 59.18.100 / 59.18.100
- libavformat: 59.16.100 / 59.16.100
- libavutil: 57.17.100 / 57.17.100
- libusb: - / 1.0.2
- installation method: brew
- device model: Generic Android-x86_64
- Android version: 11

**Describe the bug**
Device connected via tcpip 5555

```
scrcpy
scrcpy 1.24
/opt/homebrew/Cellar/scrcpy/1.24/share...ped. 59.1 MB/s (41159 bytes in 0.001s)
[server] INFO: Device: unknown Generic Android-x86_64 (Android 11)
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m2560...
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m1920...
2022-07-05 13:41:58.014 scrcpy[13923:6436890] INFO: Renderer: metal
2022-07-05 13:41:58.032 scrcpy[13923:6436890] INFO: Initial texture: 2160x3840
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m1600...
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m1280...
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m1024...
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m800...
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
2022-07-05 13:42:18.132 scrcpy[13923:6436890] 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: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:335)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
```

I've tried the cases that are described on this page https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#exception

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with com.genymobile.scrcpy.ScreenEncoder.encode() at the MediaCodec.dequeueOutputBuffer() call shown in the stack trace, then review the surrounding stream setup in ScreenEncoder.internalStreamScreen() and Server.scrcpy(). Reproduce the TCP/IP connection with the reported Android-x86_64 device and Android 11 environment. Done means determining why MediaCodec fails at each fallback resolution and documenting or correcting the failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.