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>
This commit is contained in:
Jonas Rabbe
2011-07-19 14:09:22 +10:00
committed by Qt by Nokia
parent eccb43d73c
commit 07438ca4f0

View File

@@ -108,9 +108,14 @@ public:
QAudioRingBuffer::Region region = m_buffer->acquireReadRegion((maxFrames - framesRead) * m_bytesPerFrame); QAudioRingBuffer::Region region = m_buffer->acquireReadRegion((maxFrames - framesRead) * m_bytesPerFrame);
if (region.second > 0) { if (region.second > 0) {
// Ensure that we only read whole frames.
region.second -= region.second % m_bytesPerFrame; 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 else
wecan = false; wecan = false;