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:
committed by
Qt by Nokia
parent
0e021ea4d1
commit
290523bc4c
@@ -95,6 +95,12 @@ public:
|
||||
return QAbstractVideoSurface::start(format);
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
m_item->stop();
|
||||
QAbstractVideoSurface::stop();
|
||||
}
|
||||
|
||||
virtual bool present(const QVideoFrame &frame)
|
||||
{
|
||||
if (!frame.isValid()) {
|
||||
@@ -272,10 +278,18 @@ void QDeclarativeVideoOutput::_q_updateMediaObject()
|
||||
|
||||
void QDeclarativeVideoOutput::present(const QVideoFrame &frame)
|
||||
{
|
||||
m_frameMutex.lock();
|
||||
m_frame = frame;
|
||||
m_frameMutex.unlock();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void QDeclarativeVideoOutput::stop()
|
||||
{
|
||||
present(QVideoFrame());
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlproperty enumeration VideoOutput::fillMode
|
||||
|
||||
@@ -353,6 +367,8 @@ QSGNode *QDeclarativeVideoOutput::updatePaintNode(QSGNode *oldNode, UpdatePaintN
|
||||
{
|
||||
QSGVideoNode *videoNode = static_cast<QSGVideoNode *>(oldNode);
|
||||
|
||||
QMutexLocker lock(&m_frameMutex);
|
||||
|
||||
if (videoNode && videoNode->pixelFormat() != m_frame.pixelFormat()) {
|
||||
#ifdef DEBUG_VIDEOITEM
|
||||
qDebug() << "updatePaintNode: deleting old video node because frame format changed...";
|
||||
|
||||
Reference in New Issue
Block a user