Skip to content

minicap causes UI to block on Android 4.3 device #73

@hitch45

Description

@hitch45

I'm developing for a custom Android 4.3 device.

What I've found is that when I execute minicap like:

adb shell LD_LIBRARY_PATH=/data/local/vnc/ /data/local/vnc/minicap -P 1280x800@1280x800/0 -S -Q 50 -r 5

I get this output:

INFO: (jni/minicap/minicap.cpp:260) framerate: 5.00 (period 200 ms)
PID: 2511
INFO: Using projection 1280x800@1280x800/0
INFO: (external/MY_minicap/src/minicap_18.cpp:239) Creating SurfaceComposerClient
INFO: (external/MY_minicap/src/minicap_18.cpp:242) Performing SurfaceComposerClient init check
INFO: (external/MY_minicap/src/minicap_18.cpp:249) Creating virtual display
INFO: (external/MY_minicap/src/minicap_18.cpp:255) Creating CPU consumer
INFO: (external/MY_minicap/src/minicap_18.cpp:259) Creating buffer queue
INFO: (external/MY_minicap/src/minicap_18.cpp:264) Creating frame waiter
INFO: (external/MY_minicap/src/minicap_18.cpp:268) Publishing virtual display
INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 3074052 bytes for JPG encoder

(I've had the same experience using the "run.sh autosize" command)

I believe that where it gets stuck and is blocking the UI is in SimpleServer.cpp line 50 in the socket "::accept" function :

Image

According to ChatGPT, "accept() is a system call that blocks until a client connects to the server. It accepts a connection and returns a new socket file descriptor for the client connection."

As soon as I connect a client to it, the UI is unblocked and becomes responsive again and everything is great.

That leaves me with 2 options I feel:

  1. Figure out why minicap is blocking the UI for my device.
    a) Just because it's waiting doesn't mean it should block the UI right?
    b) And other devices it does not block the UI right?
    c) Or is it intended that it would block the UI?

  2. If minicap is going to block my UI, then I would need to figure out how to start minicap and then connect my client to it immediately so as not to block the UI.
    a) Is it possible to start minicap from a non-system Android app? The README states: "Minicap works without root if started via ADB on SDK 28 (Android 9.0) and lower." When I run from my non-system Android app, I get the following output:

Image
I've set the file permissions to both minicap and minicap.so to 777.

Image
b) Is it possible to start minicap from a system Android app? This is an option if we think it would work.

#2 feels more straight-forward to me if I can figure out how to:
a) start minicap from my app directly OR
b) maybe use a BroadcastReceiver or something that could cause "adb" to launch minicap

But if anyone knows the answer to #1 I would be forever grateful!

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions