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

Randomly stuck when capture screen #71

Open
nzm001 opened this issue Feb 21, 2025 · 0 comments
Open

Randomly stuck when capture screen #71

nzm001 opened this issue Feb 21, 2025 · 0 comments

Comments

@nzm001
Copy link

nzm001 commented Feb 21, 2025

Environment: Ubuntu 24.04 Python 3.12.3

  1. Open a terminal
ABI=$(adb shell getprop ro.product.cpu.abi | tr -d '\r') # arm64-v8a
adb push libs/$ABI/minicap /data/local/tmp/
SDK=$(adb shell getprop ro.build.version.sdk | tr -d '\r') # 28
adb push jni/minicap-shared/aosp/libs/android-$SDK/$ABI/minicap.so /data/local/tmp/
adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -P 1080x2246@1080x2246/0 -t # OK
adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -P 1080x2246@1080x2246/0
###
PID: 8802
INFO: Using projection 1080x2246@1080x2246/0
INFO: (external/MY_minicap/src/minicap_28.cpp:241) Creating SurfaceComposerClient
INFO: (external/MY_minicap/src/minicap_28.cpp:244) Performing SurfaceComposerClient init check
INFO: (external/MY_minicap/src/minicap_28.cpp:255) Creating virtual display
INFO: (external/MY_minicap/src/minicap_28.cpp:261) Creating buffer queue
INFO: (external/MY_minicap/src/minicap_28.cpp:264) Setting buffer options
INFO: (external/MY_minicap/src/minicap_28.cpp:268) Creating CPU consumer
INFO: (external/MY_minicap/src/minicap_28.cpp:272) Creating frame waiter
INFO: (external/MY_minicap/src/minicap_28.cpp:276) Publishing virtual display
INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 7365636 bytes for JPG encoder
  1. Run in another terminal: adb forward tcp:1717 localabstract:minicap
  2. Capture screen every 3s (power on the phone and not touch it)
import socket
import time

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 1717))
header = sock.recv(24)

chunks = []
time1 = time.time()
for i in range(60):
    img_size = int.from_bytes(sock.recv(4), byteorder='little')
    img_data = b''
    while len(img_data) < img_size:
        img_data = img_data + sock.recv(img_size - len(img_data))
    chunks.append(img_data)
    print(time.time()-time1)
    time.sleep(3)
  1. The result
0.1657731533050537
8.868185043334961
11.86864423751831
42.7123498916626
45.713329553604126
56.110617876052856
59.11154508590698
68.86678743362427
71.86773037910461
102.70998978614807
105.71042013168335
121.26741003990173
124.26833581924438
128.86619520187378
131.86692070960999
142.60658764839172
145.60753345489502
148.6083743572235
151.60873293876648
162.69664883613586
165.69757890701294

All the picture are almost the same as expected (except current time on the top). Both my computer and phone's CPU and memory usage are low. The problem is it stuck randomly.

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

1 participant