-
Bug
-
Resolution: Duplicate
-
P2: Important
-
1.1.0, 1.1.2
-
None
-
MeeGo Harmattan, possibly other Linux environments using pulseaudio.
-
c814598251ccc83f71e32157e990f4de7cc30fae
QPulseAudioOutput (plugins/multimedia/pulseaudio/qaudiooutput_pulse.cpp) writes data as follows:
368 qint64 bytesWritten = write(buffer, l);
369 Q_UNUSED(bytesWritten);
The write function boils down to:
389 pa_threaded_mainloop_lock(pulseEngine->mainloop());
390 len = qMin(len, pa_stream_writable_size(m_stream));
391 pa_stream_write(m_stream, data, len, 0, 0, PA_SEEK_RELATIVE);
392 pa_threaded_mainloop_unlock(pulseEngine->mainloop());
393 m_totalTimeValue += len;
Note that write function actually writes qMin(len, pa_stream_writable_size), so not all data from the buffer is guaranteed to be written. Correct implementation should do:
368 +
qint64 bytesWritten = 0;
while( bytesWritten < l )
bytesWritten += write(buffer, l);
}
I am experiencing unreliable playback on Harmattan and this could be one of the reasons. I had not experienced any problems with other QAudioOutput implementations.