VideoOutput: release video frames when the video surface is stopped.

It's necessary to release video frames during media pipeline shutdown
or reconfiguration.

Change-Id: I386ad4d173b8731f257ec9272ef8c46a27769bd0
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Dmytro Poplavskiy
2011-11-18 13:23:21 +10:00
committed by Qt by Nokia
parent 0e021ea4d1
commit 290523bc4c
3 changed files with 24 additions and 0 deletions

View File

@@ -41,6 +41,7 @@
#include "qsgvideonode_rgb.h"
#include <QtDeclarative/qsgtexturematerial.h>
#include <QtDeclarative/qsgmaterial.h>
#include <QtCore/qmutex.h>
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFunctions>
#include <QtOpenGL/qglshaderprogram.h>
@@ -187,6 +188,7 @@ public:
}
void setVideoFrame(const QVideoFrame &frame) {
QMutexLocker lock(&m_frameMutex);
m_frame = frame;
}
@@ -194,6 +196,7 @@ public:
{
QOpenGLFunctions *functions = QOpenGLContext::currentContext()->functions();
QMutexLocker lock(&m_frameMutex);
if (m_frame.isValid() && m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
if (m_textureSize != m_frame.size()) {
if (!m_textureSize.isEmpty())
@@ -230,6 +233,7 @@ public:
}
QVideoFrame m_frame;
QMutex m_frameMutex;
QSize m_textureSize;
QVideoSurfaceFormat m_format;
GLuint m_textureId;