Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to allow Android Stagefright use Qt's SurfaceView to get GraphicBuffers?
QtWS25 Last Chance

How to allow Android Stagefright use Qt's SurfaceView to get GraphicBuffers?

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 1 Posters 3.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DominikM
    wrote on last edited by
    #1

    Hi,

    I'm trying to decode video by hardware using Android's Stagefright library.

    All is working OK when I use OMXCodec's flags kClientNeedsFramebuffer which tells OMXCodec to pass decoded frame to RAM. Then I have to pass it to graphic memory and show. But copying frame to RAM is very slow on almost all devices. So, i would like to let OMXCodec to pass frame to graphic memory and I will show it from there.

    OMXCodec needs ANativeWindow (from SurfaceView) to create GraphicBuffers for frames. SurfaceView can be only one in application, so I'm giving to it a ANativeWindow from SurfaceView (QtSurface) created by Qt.

    But there is a problem with that surface because it's probably somehow already managed by Qt. This is what I get when I try to create OMXCodec with ANativeWindow from Qt's surface:
    @
    //on Nexus 4
    E/OMXCodec(14819): [OMX.qcom.video.decoder.avc] registering GraphicBuffer with OMX IL component failed: -2147483648

    //on Nexus 7
    E/BufferQueue( 121): [SurfaceView] setBufferCount: client owns some buffers
    E/Surface (31197): IGraphicBufferProducer::setBufferCount(5) returned Invalid argument
    E/OMXCodec(31197): native_window_set_buffer_count failed: Invalid argument (22)
    @

    I've found both errors in https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/OMXCodec.cpp on lines 1832 (Nexus 4) and 1801 (Nexus 7). But nothing about how Qt manages ANativeWindow or GraphicBuffers in Qt's source.

    Can anybody help me to solve this problem to share Qt's surface with Stagefright or give some advice how to solve it?

    I believe that it must be possible to use Qt and Stagefright together otherwise it's a serious problem for me.

    Thank you very much for any help.

    Dominik

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DominikM
      wrote on last edited by
      #2

      Hi,

      no help needed for this. I've solved it using another Surface and SurfaceTexture.

      Anyway, thanks.

      D.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved