Important: Please read the Qt Code of Conduct -

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

  • 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): [] 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 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.


  • Hi,

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

    Anyway, thanks.


Log in to reply