openstf / minicap

Stream real-time screen capture data out of Android devices.
Other
1.72k stars 622 forks source link

Can I run minicap on device in demon mode? #217

Open AndreySkorkin opened 4 years ago

AndreySkorkin commented 4 years ago

Hi, everyone!

I need to start the minicap on the Nexus 4X device and after that close the process "adb shell" on my client machine. Nexus 4X connected to my machine via USB. I do not need the adb process to be visible on the system and the user can delete it. I can close the minicap on the device through the "adb shell kill". I try to run the miniсap through a script from the device

export LD_LIBRARY_PATH=/data/local/tmp
trap "" HUP
exec /data/local/tmp/minicap -P 1080x1920@1080x1920/0 $@

but after starting the minimap process closed with this message like this

PID: 5610
INFO: Using projection 1080x1920@1080x1920/0
INFO: (external/MY_minicap/src/minicap_27.cpp:241) Creating SurfaceComposerClient
INFO: (external/MY_minicap/src/minicap_27.cpp:244) Performing SurfaceComposerClient init check
INFO: (external/MY_minicap/src/minicap_27.cpp:255) Creating virtual display
INFO: (external/MY_minicap/src/minicap_27.cpp:261) Creating buffer queue
INFO: (external/MY_minicap/src/minicap_27.cpp:264) Setting buffer options
INFO: (external/MY_minicap/src/minicap_27.cpp:268) Creating CPU consumer
INFO: (external/MY_minicap/src/minicap_27.cpp:272) Creating frame waiter
INFO: (external/MY_minicap/src/minicap_27.cpp:276) Publishing virtual display
INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 6268932 bytes for JPG encoder
INFO: (external/MY_minicap/src/minicap_27.cpp:291) Destroying virtual display

In Logcat I found some information, maybe related with it

--------- beginning of main
07-09 17:19:29.283   762   771 I zygote64: Background concurrent copying GC freed 11832(980KB) AllocSpace objects, 2(40KB) LOS objects, 4% free, 461MB/485MB, paused 607us total 5.346s
07-09 17:19:31.254  6501  6501 W minicap : type=1400 audit(0.0:72813): avc: denied { accept } for scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=unix_stream_socket permissive=0
07-09 17:19:31.255   426   426 E FrameEvents: Source mDeltas not empty.
07-09 17:19:31.256   426   426 E FrameEvents: Source mDeltas not empty.
07-09 17:19:31.262   426   426 I Adreno  : DequeueBuffer: dequeueBuffer failed
07-09 17:19:31.264   426   426 I Adreno  : flush reason set to EsxFlushModeReasonInvalidBinLayout
07-09 17:19:31.264   426   426 I Adreno  : flush reason set to EsxFlushModeReasonInvalidBinLayout
07-09 17:19:31.264   426   426 E DisplayDevice: eglSwapBuffers(0x1, 0x7a13c66bc0) failed with 0x0000300d
07-09 17:19:31.276   426   426 W libEGL  : EGLNativeWindowType 0x7a1391b010 disconnect failed

Can you help me launch the minicap in demon mode?

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.74. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

pavel-kolesnikov commented 4 years ago

@AndreySkorkin I think something like this will work

adb shell "LD_LIBRARY_PATH=/data/local/tmp/minicap nohup /data/local/tmp/minicap/minicap -P 1176x2400@720x1280/0 &>/dev/null &"

Tested on Win 10. /data/local/tmp/minicap - directory where my minicap binary is. &>/dev/null - prevents nohup hanging on standart streams, prevented exiting