Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.56k stars 10.69k forks source link

scrcpy crashes with NullPointerException displaying screen on TCL C805 Smart TV #5140

Closed algrimes closed 3 months ago

algrimes commented 3 months ago

Environment

Describe the bug

Reproduces on all valid codec/encoder combinations Framework jar attached

scrcpy --video-codec=h264 --video-encoder='OMX.google.h264.encoder' -b2M --no-audio -m1024  
scrcpy 2.5 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     --> (tcpip)  192.168.x.xxx:5555              device  Smart_TV_Pro
/usr/local/Cellar/scrcpy/2.5/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 47.6 MB/s (69624 bytes in 0.001s)
[server] INFO: Device: [TCL] TCL Smart TV Pro (Android 12)
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
    at android.media.MediaCodec.saveSetData(MediaCodec.java:2314)
    at android.media.MediaCodec.configure(MediaCodec.java:2345)
    at android.media.MediaCodec.configure(MediaCodec.java:2268)
    at com.genymobile.scrcpy.SurfaceEncoder.streamCapture(SurfaceEncoder.java:70)
    at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:257)
    at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
    at java.lang.Thread.run(Thread.java:920)
INFO: Renderer: metal
ERROR: Controller error

framework.jar.zip

Scrcpy works on TCL C745 running android 11 with different processor, so possible to be confined to Android 12 devices with the new Mediatek pentonic 700 chip.

algrimes commented 3 months ago

some adb logcat output for the encoder : --video-codec=h264 --video-encoder='c2.mtk.avc.encoder'

adb-logcat.txt

algrimes commented 3 months ago

framework.jar MediaCodec is trying to obtain ActivityThread.currentPackageName() which is returning null, and calling equals on it.