Resizing preview video causes flickering

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Sean Ng

  • Posts: 1
  • Joined: Thu Aug 17, 2017 1:01 pm

Resizing preview video causes flickering

PostThu Aug 17, 2017 1:23 pm

Hi

I have implemented an application based on the c++ example of the CapturePreview sample from the SDK. When moving the CStatic control while the preview is "live", the image shown on the PC will sometime flicker/flashes continuously. Only by resizing again will the image be back to normal. This does not occurs all the time but when it occurs, it is usually the first time the control is resized. Subsequent resizing will not cause the video to flicker/flash.

When the control is resized, the below function is called. It is base off the InitOpenGL function in the example code. What could be causing the flicker? If my source is 1080p60, is the capture preview running at the same resolution?

Code: Select all
bool MyPreview::onSize()
{
  // Create OpenGL rendering context
    if (NULL != _openGLctx)
    {
        wglDeleteContext(_openGLctx);
    }

    _openGLctx = wglCreateContext(_previewBoxDC->m_hDC);
    if (_openGLctx == NULL)
    {
        ReleaseDC(_previewBoxDC);
        _previewBoxDC = NULL;
        return false;
    }

    // Make the new OpenGL context the current rendering context so
    // we can initialise the DeckLink preview helper
    if (wglMakeCurrent(_previewBoxDC->m_hDC, _openGLctx) == FALSE)
    {
        ReleaseDC(_previewBoxDC);
        _previewBoxDC = NULL;
        return false;
    }

    //// Reset the OpenGL rendering context
    wglMakeCurrent(NULL, NULL);

    return true;
}


Thanks in advance. Any advice is greatly appreciated.

Ngsann

Return to Software Developers

Who is online

Users browsing this forum: Andy Coulthurst and 2 guests