OpenSL: don't try to enqueue new buffers when the buffer queue is full.
authorYoann Lopes <yoann.lopes@digia.com>
Wed, 21 May 2014 10:47:03 +0000 (12:47 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 30 May 2014 12:47:20 +0000 (14:47 +0200)
It could lead to corrupted sound since we were overwritting buffers
that weren't played yet.

Task-number: QTBUG-39015
Change-Id: I4c015c5383b813955998145d6316acc8c22f19a3
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
src/plugins/opensles/qopenslesaudiooutput.cpp

index df91e6f..49bea0b 100644 (file)
@@ -568,7 +568,7 @@ void QOpenSLESAudioOutput::destroyPlayer()
 
 qint64 QOpenSLESAudioOutput::writeData(const char *data, qint64 len)
 {
-    if (!len)
+    if (!len || !m_availableBuffers.load())
         return 0;
 
     if (len > m_bufferSize)