summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2016-04-01 14:13:38 +0200
committerYoann Lopes <yoann.lopes@qt.io>2016-05-09 13:10:55 +0000
commit80d8466a470565d1d823b66e3b81dcc306d04f61 (patch)
tree403a6b49ce489643fe213ead0c3b5717e522c1aa
parent6f3e6a78ca885096b8864638bfb64724c486e7d1 (diff)
Android: correctly use mutex for texture rendering.
Some sections were not protected by the mutex, even though they should have been. An example of problem that could happen because of this was if the SurfaceTexture was reset while the render thread was rendering that texture. Change-Id: Ie95860fd4eb722bbac04cccc430cc1a8abf1df4d Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
-rw-r--r--src/plugins/android/src/common/qandroidvideooutput.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/android/src/common/qandroidvideooutput.cpp b/src/plugins/android/src/common/qandroidvideooutput.cpp
index 82c27035d..87a725a93 100644
--- a/src/plugins/android/src/common/qandroidvideooutput.cpp
+++ b/src/plugins/android/src/common/qandroidvideooutput.cpp
@@ -218,6 +218,8 @@ bool QAndroidTextureVideoOutput::initSurfaceTexture()
return false;
}
+ QMutexLocker locker(&m_mutex);
+
m_surfaceTexture = new AndroidSurfaceTexture(m_externalTex);
if (m_surfaceTexture->surfaceTexture() != 0) {
@@ -235,6 +237,7 @@ bool QAndroidTextureVideoOutput::initSurfaceTexture()
void QAndroidTextureVideoOutput::clearSurfaceTexture()
{
+ QMutexLocker locker(&m_mutex);
if (m_surfaceTexture) {
delete m_surfaceTexture;
m_surfaceTexture = 0;