Fix pullmode data lost problem in QAudioOutput(pulseaudio)

At each userFeed, m_bytesAvailable is not updated properly in pullmode,
so the pull data size become irrelevent to the size we can actually write.
This problem is fixed by checking the actual writable size each time
before pulling the data and limit the size of the pulled and written data.

Change-Id: I6f53e6348693ddf4e3c79e90d3c3d0c1ffc713aa
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Ling Hu
2011-11-07 11:49:09 +10:00
committed by Qt by Nokia
parent 9eeb1389f5
commit a8be7b6053
2 changed files with 36 additions and 42 deletions

View File

@@ -107,7 +107,6 @@ private:
qint64 write(const char *data, qint64 len);
private Q_SLOTS:
bool deviceReady();
void userFeed();
private:
@@ -119,7 +118,6 @@ private:
bool m_pullMode;
bool m_opened;
QIODevice *m_audioSource;
int m_bytesAvailable;
QTimer m_periodTimer;
pa_stream *m_stream;
int m_notifyInterval;