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

Device encoder crashes in a Nox android virtual machine #1876

Open
2 tasks done
jamespharvey20 opened this issue Nov 2, 2020 · 4 comments
Open
2 tasks done

Device encoder crashes in a Nox android virtual machine #1876

jamespharvey20 opened this issue Nov 2, 2020 · 4 comments

Comments

@jamespharvey20
Copy link

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

Environment

  • OS: Arch Linux
  • scrcpy version: git dev~3 - 56d237f
  • installation method: manual build
  • device model: NoxPlayer 6.6.1.3 emulating a Samsung Galaxy S10
  • Android version: 5.1.1

Describe the bug

I created a virtual android using Nox, on Windows 10. I set it up to use network bridging, and connected to it via tcpip from scrcpy on linux. (I'd much prefer QEMU, but android-x86 is randomly crashing...) Right away, there's an exception on the server. It sort of looks to me like this could be a Nox issue. Perhaps they haven't implemented an h264 encoder or it's not working properly? Does this look like a Nox issue to you, and is there anything scrcpy could do to work around a device not having a working encoder? Like, could it transmit separate images instead? (Obviously this would transmit a lot more data over the network, and the FPS might even need to be lowered.)

I saw #1810 which has the same error, but my virtual device only has the single encoder according to CheckVideoCodecs.

scrcpy output

INFO: scrcpy 1.16 (https://github.com/Genymobile/scrcpy)
C:\Users\user\Downloads\scrcpy-win64-v...ped. 24.2 MB/s (33622 bytes in 0.001s)
ERROR: "adb reverse" returned with value 1
WARN: 'adb reverse' failed, fallback to 'adb forward'
27183
[server] INFO: Device: samsung SM-G973N (Android 5.1.1)
[server] ERROR: Exception on thread Thread[main.5,main]
android.media.MediaCodec$CodecException: Error 0x80001001
        at android.media.MediaCodec.native_configuration(Native Method)
        at android.media.MediaCodec.configure(MediaCodec.java:577)
        at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:205)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:84)
        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: 264)
INFO: Renderer: software
INFO: Initial texture: 720x1280
WARN: Device disconnected
Preass any key to continue...

adb logcat output

...
W/        ( 3016): Failed to bind-mount /system/lib/x86/cpuinfo as /proc/cpuinfo: No such file or directory
E/        ( 3016): Cannot create code cache directory ./code_cache: Read-only file system.
E/memtrack( 3016): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 3016): failed to load memtrack module: -2
D/AndroidRuntime( 3016): Calling main entry com.genymobile.scrcpy.Server
I/scrcpy  ( 3016): Device: samsung SM-G973N (Android 5.1.1)
I/art     ( 3016): Thread[1,tid=3016,WaitingForJniOnLoad,Thread*=0xb3c27800,peer=0x12c31100,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
D/MtpDeviceJNI( 3016): register_android_mtp_MtpDevice
I/art     ( 3016): Thread[1,tid=3016,WaitingForJniOnLoad,Thread*=0xb3c27800,peer=0x12c31100,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
I/art     ( 3016): Thread[1,tid=3016,WaitingForJniOnLoad,Thread*=0xb3c27800,peer=0x12c31100,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
I/OMXClient( 3016): Using client-side OMX mux.
I/SoftAVCEncoder( 3016): Construct SoftAVCEncoder
W/ACodec  ( 3016): do not know color format 0x7f000789 = 2130708361
E/SoftAVCEncoder( 3016): ConvertAvcSpecLevelToOmxAvcLevel: 31 level not supported
E/OMXNodeInstance( 3016): getParameter(1:google.h264.encoder, ParamVideoAvc(0x600000d)) ERROR: Undefined(0x80001001)
I/ACodec  ( 3016): setupVideoEncoder succeeded
E/ACodec  ( 3016): [OMX.google.h264.encoder] configureCodec returning error -2147483648
E/ACodec  ( 3016): signalError(omxError 0x80001001, internalError -2147483648)
E/MediaCodec( 3016): Codec reported err 0x80001001, actionCode 0, while in state3
E/MediaCodec( 3016): configure failed with err 0x80001001, resetting...
I/OMXClient( 3016): Using client-side OMX mux.
I/SoftAVCEncoder( 3016): Construct SoftAVCEncoder
D/AndroidRuntime( 3016): Shutting down VM
E/scrcpy  ( 3016): Exception on thread Thread[main,5,main]
E/scrcpy  ( 3016): android.media.MediaCodec$CodecException: Error 0x80001001
E/scrcpy  ( 3016):      at android.media.MediaCodec.native_configure(Native Method)
E/scrcpy  ( 3016):      at android.media.MediaCodec.configure(MediaCodec.java:577)
E/scrcpy  ( 3016):      at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:205)
E/scrcpy  ( 3016):      at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:84)
E/scrcpy  ( 3016):      at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:55)
E/scrcpy  ( 3016):      at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
E/scrcpy  ( 3016):      at com.genymobile.scrcpy.Server.main(Server.java:225)
E/scrcpy  ( 3016):      at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
E/scrcpy  ( 3016):      at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:264)
E/art     ( 3016): Thread attaching while runtime is shutting down: OMXCallbackDisp
I/AndroidRuntime( 3016): NOTE: attach of thread 'OMXCallbackDisp' failed

CheckVideoCodecs -- make run output

adb push app/build/outputs/apk/debug/app-debug.apk /data/local/tmp/cvc.jar
app/build/outputs/apk/debug/app-debug.apk: 1 file pushed, 0 skipped. 39.0 MB/s (7206 bytes in 0.000s)
./run
video/avc -> OMX.google.h264.encoder

=== OMX.google.aac.encoder ===
Supported types: [audio/mp4a-latm]

=== OMX.google.amrnb.encoder ===
Supported types: [audio/3gpp]

=== OMX.google.amrwb.encoder ===
Supported types: [audio/amr-wb]

=== OMX.google.h263.encoder ===
Supported types: [video/3gpp]

=== OMX.google.h264.encoder ===
Supported types: [video/avc]
video/avc capabilities:
    default format: {mime=video/avc, bitrate-mode=1}
    profile levels: [0x1/0x20]
    color formats: [2135033992, 19, 21, 2130708361]
    bitrate: [1, 2000000]
    framerate: [0, 960]
    widths: [2, 896]
    heights: [2, 896]
    w,h alignment: 2,2
TEST OK

=== OMX.google.mpeg4.encoder ===
Supported types: [video/mp4v-es]

=== OMX.google.flac.encoder ===
Supported types: [audio/flac]

=== OMX.google.vp8.encoder ===
Supported types: [video/x-vnd.on2.vp8]

@rom1v
Copy link
Collaborator

rom1v commented Nov 2, 2020

E/SoftAVCEncoder( 3016): ConvertAvcSpecLevelToOmxAvcLevel: 31 level not supported

profile levels: [0x1/0x20]

Try another profile level:

scrcpy --codec-options profile=1,level=4096

@jamespharvey20
Copy link
Author

Other than PID's differing, same output as in original post with:

  • --codec-options profile=1,level=4096
  • --codec-options profile=20,level=4096
  • --codec-options profile=32,level=4096 (assuming logcat level shown 0x20 would be written as 32 here)

@rom1v
Copy link
Collaborator

rom1v commented Nov 2, 2020

same output as in original post with:

Except:

E/SoftAVCEncoder( 3016): ConvertAvcSpecLevelToOmxAvcLevel: 31 level not supported

I guess?

@jamespharvey20
Copy link
Author

jamespharvey20 commented Nov 6, 2020

same output as in original post with:

Except:

E/SoftAVCEncoder( 3016): ConvertAvcSpecLevelToOmxAvcLevel: 31 level not supported

I guess?

Even that's the same.

$ bash -x ./run x
+ [[ 1 = 0 ]]
+ BUILDDIR=x
+ shift
+ [[ ! -d x ]]
+ SCRCPY_SERVER_PATH=x/server/scrcpy-server
+ x/app/scrcpy
...
$ $ bash -x ./run x --codec-options profile=1,level=4096
+ [[ 3 = 0 ]]
+ BUILDDIR=x
+ shift
+ [[ ! -d x ]]
+ SCRCPY_SERVER_PATH=x/server/scrcpy-server
+ x/app/scrcpy --codec-options profile=1,level=4096
...
$ bash -x ./run x --codec-options profile=20,level=4096
+ [[ 3 = 0 ]]
+ BUILDDIR=x
+ shift
+ [[ ! -d x ]]
+ SCRCPY_SERVER_PATH=x/server/scrcpy-server
+ x/app/scrcpy --codec-options profile=20,level=4096
...
$ bash -x ./run x --codec-options profile=32,level=4096
+ [[ 3 = 0 ]]
+ BUILDDIR=x
+ shift
+ [[ ! -d x ]]
+ SCRCPY_SERVER_PATH=x/server/scrcpy-server
+ x/app/scrcpy --codec-options profile=32,level=4096
...
opt_none:E/SoftAVCEncoder( 3797): ConvertAvcSpecLevelToOmxAvcLevel: 31 level not supported
opt_1_4096:E/SoftAVCEncoder( 3854): ConvertAvcSpecLevelToOmxAvcLevel: 31 level not supported
opt_20_4096:E/SoftAVCEncoder( 3910): ConvertAvcSpecLevelToOmxAvcLevel: 31 level not supported
opt_32_4096:E/SoftAVCEncoder( 3966): ConvertAvcSpecLevelToOmxAvcLevel: 31 level not supported

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

2 participants