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,

Nicolas
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to