Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved How does QVideoFilterRunnable manage the OpenGL Context

    Mobile and Embedded
    android opengl qml camera
    2
    3
    1174
    Loading More Posts
    • 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.
    • NFanjat
      NFanjat last edited by NFanjat

      Hi all,

      I am currently working on a mobile application that would display the camera stream.
      Since I need to process every frame before rendering I chose to use QAbstractVideoFilter and QVideoFilterRunnable classes. And since I am developing for Android devices (the video frames come as GL textures) I want to use as many raw OpenGL calls before sending back the video frame to the CPU.

      The run function would look to something like that :

      QVideoFrame MyFilterRunnable::run(QVideoFrame *input, const QVideoSurfaceFormat &surfaceFormat, RunFlags flags)
      {
          Q_UNUSED(surfaceFormat);
          Q_UNUSED(flags);
      
          // Checking Input first...
      
          // Getting the texture ID
          texture = input->handle().toUInt();
      
          // ...
          // Processing the frame using GL calls
          // ...
      
          return QVideoFrame(frameFromTexture(outTexture, inputSize, input->pixelFormat()));
      }
      

      The idea doesn't seem complicated but I noticed a few things about the GL context used by the filter that bother me, and I need some help understanding the whole picture behind it :

      • According to the documentation the run function is always called on the render thread (the one which is supposed to hold the OpenGL context) - that I'm ok with
      • The FilterRunnable object is created once and then the run function is launched at every new frame received - that I'm still ok with
      • On every new call to the run function the context seems to have been reset (I can provide some examples if needed) - that I'm not ok with

      Now, I wish I understood what happens just before and after run calls. To me it really looks like that between every call the GL context is somewhat cleared, but I'm not sure of it.
      I'm developing an app that needs to be as efficient as possible (processing the frames in less than 40ms), so that's why I really want to understand as clearly as possible what's happening so that I can optimize the process as much as possible.

      Thank you if anyone can explain me the behavior of these two classes,
      Best regards

      NFanjat

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        To discuss the internal implementation of these classes, I'd recommend posting this question on the interest mailing list You'll find the QtMultimedia's developers/maintainers. This forum is more user oriented.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • NFanjat
          NFanjat last edited by

          Thank you, I'll do that ASAP

          1 Reply Last reply Reply Quote 0
          • First post
            Last post