summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-11-12 14:33:33 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-11-12 14:33:33 (GMT)
commit437e83e7707516129f68ee26aca5349845b7cc7b (patch)
tree0d4c8721f21acc5398e4eabff88a902cb23d0521 /src/multimedia
parent7b3880475d02bd3db630387bccccc7e1ef9d4e9a (diff)
parente61071a2a170eaeb524778e9e903100323b88bbe (diff)
downloadQt-437e83e7707516129f68ee26aca5349845b7cc7b.zip
Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.gz
Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: configure doc/src/snippets/code/doc_src_qmake-manual.qdoc mkspecs/features/symbian/application_icon.prf mkspecs/features/symbian/default_post.prf mkspecs/features/symbian/symbian_building.prf qmake/generators/symbian/initprojectdeploy_symbian.cpp src/multimedia/audio/audio.pri src/network/access/qnetworkaccessmanager.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/qgl_p.h src/plugins/bearer/corewlan/qcorewlanengine.mm src/plugins/phonon/mmf/mmf.pro tests/auto/qscriptvalue/tst_qscriptvalue.cpp tests/auto/qscriptvalue/tst_qscriptvalue.h tools/qdoc3/doc/qdoc-manual.qdocconf
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/audio.pri4
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.cpp21
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp11
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.cpp2
4 files changed, 22 insertions, 16 deletions
diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri
index f03d0ac..7b2f9ad 100644
--- a/src/multimedia/audio/audio.pri
+++ b/src/multimedia/audio/audio.pri
@@ -42,8 +42,8 @@ mac {
wince*:LIBS += -lcoredll
} else:symbian {
- INCLUDEPATH += $${EPOCROOT}/epoc32/include/mmf/common
- INCLUDEPATH += $${EPOCROOT}/epoc32/include/mmf/server
+ INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/common
+ INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/server
HEADERS += $$PWD/qaudio_symbian_p.h \
$$PWD/qaudiodeviceinfo_symbian_p.h \
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp
index ddafa3d..5265915 100644
--- a/src/multimedia/audio/qaudioinput_alsa_p.cpp
+++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp
@@ -482,19 +482,18 @@ int QAudioInputPrivate::bytesReady() const
qint64 QAudioInputPrivate::read(char* data, qint64 len)
{
- Q_UNUSED(len)
-
// Read in some audio data and write it to QIODevice, pull mode
if ( !handle )
return 0;
- bytesAvailable = checkBytesReady();
+ // bytesAvaiable is saved as a side effect of checkBytesReady().
+ int bytesToRead = checkBytesReady();
- if (bytesAvailable < 0) {
+ if (bytesToRead < 0) {
// bytesAvailable as negative is error code, try to recover from it.
- xrun_recovery(bytesAvailable);
- bytesAvailable = checkBytesReady();
- if (bytesAvailable < 0) {
+ xrun_recovery(bytesToRead);
+ bytesToRead = checkBytesReady();
+ if (bytesToRead < 0) {
// recovery failed must stop and set error.
close();
errorState = QAudio::IOError;
@@ -504,9 +503,11 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
}
}
+ bytesToRead = qMin<qint64>(len, bytesToRead);
+ bytesToRead -= bytesToRead % period_size;
int count=0, err = 0;
while(count < 5) {
- int chunks = bytesAvailable/period_size;
+ int chunks = bytesToRead/period_size;
int frames = chunks*period_frames;
if(frames > (int)buffer_frames)
frames = buffer_frames;
@@ -554,6 +555,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
emit stateChanged(deviceState);
}
} else {
+ bytesAvailable -= err;
totalTimeValue += err;
resuming = false;
if (deviceState != QAudio::ActiveState) {
@@ -566,6 +568,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
} else {
memcpy(data,audioBuffer,err);
+ bytesAvailable -= err;
totalTimeValue += err;
resuming = false;
if (deviceState != QAudio::ActiveState) {
@@ -661,7 +664,7 @@ bool QAudioInputPrivate::deviceReady()
{
if(pullMode) {
// reads some audio data and writes it to QIODevice
- read(0,0);
+ read(0, buffer_size);
} else {
// emits readyRead() so user will call read() on QIODevice to get some audio data
InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp
index 1cde159..0ec2492 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.cpp
+++ b/src/multimedia/audio/qaudioinput_win32_p.cpp
@@ -400,9 +400,12 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
resuming = false;
}
} else {
+ l = qMin<qint64>(len, waveBlocks[header].dwBytesRecorded);
// push mode
- memcpy(p,waveBlocks[header].lpData,waveBlocks[header].dwBytesRecorded);
- l = waveBlocks[header].dwBytesRecorded;
+ memcpy(p, waveBlocks[header].lpData, l);
+
+ len -= l;
+
#ifdef DEBUG_AUDIO
qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l;
#endif
@@ -457,7 +460,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
mutex.lock();
if(!pullMode) {
- if(l+period_size > len && waveFreeBlockCount == buffer_size/period_size)
+ if(len < period_size || waveFreeBlockCount == buffer_size/period_size)
done = true;
} else {
if(waveFreeBlockCount == buffer_size/period_size)
@@ -568,7 +571,7 @@ bool QAudioInputPrivate::deviceReady()
if(pullMode) {
// reads some audio data and writes it to QIODevice
- read(0,0);
+ read(0, buffer_size);
} else {
// emits readyRead() so user will call read() on QIODevice to get some audio data
InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp
index 1f304e3..1b054e5 100644
--- a/src/multimedia/audio/qaudiooutput_win32_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp
@@ -586,7 +586,7 @@ bool QAudioOutputPrivate::deviceReady()
}
}
if ( out < l) {
- // Didnt write all data
+ // Didn't write all data
audioSource->seek(audioSource->pos()-(l-out));
}
if(startup)