Important: Please read the Qt Code of Conduct -

Segfault with rendering video with custom MediaService (QVideoRendererControl_iid)

  • I am getting segfault here in qopenglfunctions.h on d_ptr->f.TexImage2D(...).

    inline void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
    #if defined(QT_OPENGL_ES_2) && defined(Q_OS_ANDROID)
        ::glTexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
        d_ptr->f.TexImage2D(target, level, internalformat, width,height, border, format, type, pixels);

    Here is my code:

    Take a look at the presentFrame frame method. I suspect the error is because videoServuce->present(...) is called with a buffer that is short lived and later deleted. However, I did create a class-level char* buffer that I memcpy to, transforing ownership of the bytes to the class itself, and it still happened.

    Here is the stack trace.

    I am using Qt at the latest 5.10 branch.

  • Lifetime Qt Champion


    Why not create a QByteArray from your data and then trigger a copy when you pass it to QMemoryVideoBuffer ?

    Also, are you sure you are passing the right number of bytes per line ?

Log in to reply