summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Rabbe <jonas.rabbe@nokia.com>2011-07-19 14:09:22 +1000
committerQt by Nokia <qt-info@nokia.com>2011-07-19 06:15:59 +0200
commit07438ca4f0afd9ebe352b48d978909d5baa4666f (patch)
treede8fc20857f37328ba772a30477c08c833fc0030
parenteccb43d73c08b85bab89d8f632d423b63592e14f (diff)
Fixed a hang of the QAudioOutput auto test on Mac OS X
Task-number: QTMOBILITY-1779 Change-Id: If4141ed848dd0475b0008ec85daba55fa5f086b3 Reviewed-on: http://codereview.qt.nokia.com/1805 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
-rw-r--r--src/multimediakit/audio/qaudiooutput_mac_p.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/multimediakit/audio/qaudiooutput_mac_p.cpp b/src/multimediakit/audio/qaudiooutput_mac_p.cpp
index fcaa3cbd2..17d3d1ff8 100644
--- a/src/multimediakit/audio/qaudiooutput_mac_p.cpp
+++ b/src/multimediakit/audio/qaudiooutput_mac_p.cpp
@@ -108,9 +108,14 @@ public:
QAudioRingBuffer::Region region = m_buffer->acquireReadRegion((maxFrames - framesRead) * m_bytesPerFrame);
if (region.second > 0) {
+ // Ensure that we only read whole frames.
region.second -= region.second % m_bytesPerFrame;
- memcpy(data + (framesRead * m_bytesPerFrame), region.first, region.second);
- framesRead += region.second / m_bytesPerFrame;
+
+ if (region.second > 0) {
+ memcpy(data + (framesRead * m_bytesPerFrame), region.first, region.second);
+ framesRead += region.second / m_bytesPerFrame;
+ } else
+ wecan = false; // If there is only a partial frame left we should exit.
}
else
wecan = false;