8000 Minicap getting blocked while capturing images · Issue #51 · openstf/minicap · GitHub
[go: up one dir, main page]

Skip to content

Minicap getting blocked while capturing images #51

Open

Description

@parasharg8

Phone Details:

manufacturer: 'Google/Motorola'
model: 'Nexus 6'
version: '7.0'
abi: 'armeabi-v7a'
sdk: '24'

After starting the minicap on the above mentioned device, the minicap is getting blocked and is not returning any output

adb shell LD_LIBRARY_PATH=/data/local/tmp/minicap-devel /data/local/tmp/minicap-devel/minicap -P 1440x2560@1440x2560/0
PID: 29358
INFO: Using projection 1440x2560@1440x2560/0
INFO: (external/MY_minicap/src/minicap_24.cpp:240) Creating SurfaceComposerClient
INFO: (external/MY_minicap/src/minicap_24.cpp:243) Performing SurfaceComposerClient init check
INFO: (external/MY_minicap/src/minicap_24.cpp:250) Creating virtual display
INFO: (external/MY_minicap/src/minicap_24.cpp:256) Creating buffer queue
INFO: (external/MY_minicap/src/minicap_24.cpp:261) Creating CPU consumer
INFO: (external/MY_minicap/src/minicap_24.cpp:265) Creating frame waiter
INFO: (external/MY_minicap/src/minicap_24.cpp:269) Publishing virtual display
INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 11061252 bytes for JPG encoder

The minicap will be blocked at this and will not continue.
What could be possible reason for this?

Activity

  1. sorccu commented on Dec 27, 2016

    @sorccu
    Member
  2. parasharg8 commented on Dec 28, 2016

    @parasharg8
    Author

    Yes I am reading the frames from the socket it opens. But the minicap is blocking even before I start reading the frames.

    Steps of execution in our code:

    1. Starting minicap using command === adb shell LD_LIBRARY_PATH=/data/local/tmp/minicap-devel /data/local/tmp/minicap-devel/minicap -P 1440x2560@1440x2560/0

    2. Creating a local forward to connect to the socket using command === adb forward tcp:$(port) localabstract:minicap .

    3. Reading the frames from the socket created on the port used in the command in step 2.

    I am facing problem in step 1 itself where while starting minicap, the minicap is getting blocked due to which we are not able to move to step 2.

    Please Note : I am facing this issue only on Android 7. Devices on earlier android versions are working fine with the same code and same steps of execution.

  3. parasharg8 commented on Dec 28, 2016

    @parasharg8
    Author

    Here is the new finding on this issue.

    If I run the manually command to start the minicap once, then the minicap gets hanged and we are not able to proceed.
    But on the other hand if I run the command twice and that too seperately on two different command prompts, then the minicap runs fine on second command prompt.

    Find below the output of commands run :

    1. The minicap startup command run for first time

               **D:\>adb shell LD_LIBRARY_PATH=/data/local/tmp/minicap-devel /data/local/tmp/minicap-   devel/minicap -P 1440x2560@1440x2560/0
             PID: 4345
             INFO: Using projection 1440x2560@1440x2560/0
             INFO: (external/MY_minicap/src/minicap_24.cpp:240) Creating SurfaceComposerClient
              INFO: (external/MY_minicap/src/minicap_24.cpp:243) Performing SurfaceComposerClient init check
             INFO: (external/MY_minicap/src/minicap_24.cpp:250) Creating virtual display
             INFO: (external/MY_minicap/src/minicap_24.cpp:256) Creating buffer queue
              INFO: (external/MY_minicap/src/minicap_24.cpp:261) Creating CPU consumer
             INFO: (external/MY_minicap/src/minicap_24.cpp:265) Creating frame waiter
             INFO: (external/MY_minicap/src/minicap_24.cpp:269) Publishing virtual display
             INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 11061252 bytes for JPG encoder**
      
    2. The minicap startup command run for second time

            **D:\>adb shell LD_LIBRARY_PATH=/data/local/tmp/minicap-devel /data/local/tmp/minicap-devel/minicap -P 1440x2560@1440x2560/0
           PID: 3459
           INFO: Using projection 1440x2560@1440x2560/0
           INFO: (external/MY_minicap/src/minicap_24.cpp:240) Creating SurfaceComposerClient
           INFO: (external/MY_minicap/src/minicap_24.cpp:243) Performing SurfaceComposerClient init check
           INFO: (external/MY_minicap/src/minicap_24.cpp:250) Creating virtual display
           INFO: (external/MY_minicap/src/minicap_24.cpp:256) Creating buffer queue
           INFO: (external/MY_minicap/src/minicap_24.cpp:261) Creating CPU consumer
           INFO: (external/MY_minicap/src/minicap_24.cpp:265) Creating frame waiter
           INFO: (external/MY_minicap/src/minicap_24.cpp:269) Publishing virtual display
           INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 11061252 bytes for JPG encoder
           INFO: (external/MY_minicap/src/minicap_24.cpp:284) Destroying virtual display
      
           D:\>**
      

    As we can see from the above mentioned outputs of the minicap startup command that the minicap started successfully in the second attempt while the first attempt continues to block. What can be the possible root cause for this behaviour?

    Please Note: The minicap startup command which we are using is adb shell LD_LIBRARY_PATH=/data/local/tmp/minicap-devel /data/local/tmp/minicap-devel/minicap -P 1440x2560@1440x2560/0

  4. sorccu commented on Dec 28, 2016

    @sorccu
    Member

    You should check logcat. First, before running anything, clear it:

    adb logcat -c
    

    Then run

    adb logcat > out.log
    

    (or whatever the windows equivalent might be)

    Now run that command again, wait for it to hang, stop logcat and go through the file to see if there's anything interesting in there.

  5. parasharg8 commented on Dec 28, 2016

    @parasharg8
    Author

    @sorccu : Thanks for the advice. We ran the steps as mentioned by you and we are not seeing anything faulty except that I have seen the below line 2-3 times.

            **SurfaceFlinger: couldn't log to binary event log: overflow.**
    

    Will this cause any unexpected behavior in minicap?

  6. sorccu commented on Dec 28, 2016

    @sorccu
    Member
  7. parasharg8 commented on Dec 28, 2016

    @parasharg8
    Author

    Yes I am running stock Android. I updated the Nexus 6 from Android-6 to Android-7 by going to Settings->About Phone-> System Updates.

    Also, I have made a fresh clone of the repository and created new minicap binaries. And before pushing the new binaries, I made sure that old binaries are deleted from the device and then only new binaries are pushed into the device

  8. parasharg8 commented on Jan 6, 2017

    @parasharg8
    Author

    Hi

    Do you have any suggestion i am still getting this problem?. When i am executing this below command using Java Process API, The Input stream got hanged and execution blocks at BufferedReader.readline().

    adb shell LD_LIBRARY_PATH=/data/local/tmp/minicap-devel /data/local/tmp/minicap-devel/minicap -P 1440x2560@1440x2560/0

    Hope this will help.

  9. sorccu commented on Jan 6, 2017

    @sorccu
    Member

    You can't use readLine, there are no lines in the minicap stream.

  10. parasharg8 commented on Jan 6, 2017

    @parasharg8
    Author

    Below is the log related to minicap which i am getting from Logcat.

    01-06 12:41:37.555 13864 13864 W minicap : type=1400 audit(0.0:810): avc: denied { accept } for scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=unix_stream_socket permissive=0

    I am executing this command through Java Process Api.

    adb -s ZX1G424G66 shell LD_LIBRARY_PATH=/data/local/tmp/minicap-devel /data/local/tmp/minicap-devel/minicap -P 1440x2560@1440x2560/0

    Thanks, Do let me know if you found any thing suspicious in this.

  11. parasharg8 commented on Jan 6, 2017

    @parasharg8
    Author

    As of now it appear Minicap is not opening any stream, That is why program execution got hanged even if i read character from stream.

    Your thoughts?.

  12. sorccu commented on Jan 6, 2017

    @sorccu
    Member
  13. parasharg8 commented on Jan 6, 2017

    @parasharg8
    Author

    Java program run on Computer.

  14. sorccu commented on Jan 6, 2017

    @sorccu
    Member
  15. parasharg8 commented on Jan 6, 2017

    @parasharg8
    Author

    minicap : type=1400 audit(0.0:20): avc: denied { accept } for scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=unix_stream_socket permissive=0

    01-06 14:46:08.236 6064 6067 E BufferQueueProducer: [minicap] dequeueBuffer: BufferQueue has been abandoned
    01-06 14:46:08.245 299 299 E SurfaceFlinger: [minicap] advanceFrame: no buffer, bailing out
    01-06 14:46:08.245 299 299 E DisplayDevice: [minicap] failed pushing new frame to HWC: -12

    I found these on the device logcat. Please have a look.

  16. sorccu commented on Jan 6, 2017

    @sorccu
    Member
  17. uname commented on Dec 13, 2018

    @uname

    maybe it's not blocked, try to scroll your screen?

  18. sorccu commented on Dec 13, 2018

    @sorccu
    Member

    On some devices, mostly older ones, it can get stuck if you don’t read frames quickly enough. It’ll run out of buffer space and stop. On most devices it simply discards unread frames on pressure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      0