diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2020-05-04 11:56:22 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2020-05-15 07:12:48 +0000 |
commit | 76f5027181f690d6d0311f3d9f10061da7166ac9 (patch) | |
tree | 2f71a6c60011e275f9dc933fe4c2b1934f1036cc | |
parent | 0f2e2dba7e728596db2c7207032f04a9e1a82333 (diff) |
Vivante: Keep only one frame
The imx6 vivante implementation of videonode used by qtvideosink
holds reference to two frames during rendering.
It releases the first frame only when it receives the third frame.
This makes jerky playback when frames are not coming at constant rate.
It displays the previous frame during video playback.
Change-Id: If306bdcd358fac46a1fd0000ccb068424aee813a
Reviewed-by: Karim Pinter <karim.pinter@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit f48e16dc45cde8f634823c40aa573b18673cf13d)
-rw-r--r-- | src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp | 10 | ||||
-rw-r--r-- | src/plugins/videonode/imx6/qsgvivantevideomaterial.h | 2 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp index 4b68f47a4..7e5333457 100644 --- a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp +++ b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp @@ -102,7 +102,7 @@ void QSGVivanteVideoMaterial::updateBlending() { void QSGVivanteVideoMaterial::setCurrentFrame(const QVideoFrame &frame, QSGVideoNode::FrameFlags flags) { QMutexLocker lock(&mFrameMutex); - mNextFrame = frame; + mCurrentFrame = frame; mMappable = mMapError == GL_NO_ERROR && !flags.testFlag(QSGVideoNode::FrameFiltered); #ifdef QT_VIVANTE_VIDEO_DEBUG @@ -119,12 +119,8 @@ void QSGVivanteVideoMaterial::bind() } QMutexLocker lock(&mFrameMutex); - if (mNextFrame.isValid()) { - mCurrentFrame.unmap(); - - mCurrentFrame = mNextFrame; - mCurrentTexture = vivanteMapping(mNextFrame); - } + if (mCurrentFrame.isValid()) + mCurrentTexture = vivanteMapping(mCurrentFrame); else glBindTexture(GL_TEXTURE_2D, mCurrentTexture); } diff --git a/src/plugins/videonode/imx6/qsgvivantevideomaterial.h b/src/plugins/videonode/imx6/qsgvivantevideomaterial.h index adbd960a4..db59e8fc7 100644 --- a/src/plugins/videonode/imx6/qsgvivantevideomaterial.h +++ b/src/plugins/videonode/imx6/qsgvivantevideomaterial.h @@ -78,7 +78,7 @@ private: QVideoFrame::PixelFormat mFormat; QMap<const uchar*, GLuint> mBitsToTextureMap; - QVideoFrame mCurrentFrame, mNextFrame; + QVideoFrame mCurrentFrame; GLuint mCurrentTexture; bool mMappable; GLenum mMapError = GL_NO_ERROR; |