summaryrefslogtreecommitdiffstats
path: root/src/multimedia/audio/qaudioinput_symbian_p.cpp
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-09-14 14:02:03 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-09-17 13:21:06 (GMT)
commit737b75e19b7206cb9888e87930cb37b1906a6345 (patch)
tree3cb777f81837eb1f59a90e8e27fe961533463d74 /src/multimedia/audio/qaudioinput_symbian_p.cpp
parent9fd8589c9d4574c04a989a6c5e1d335779d2b244 (diff)
downloadQt-737b75e19b7206cb9888e87930cb37b1906a6345.zip
Qt-737b75e19b7206cb9888e87930cb37b1906a6345.tar.gz
Qt-737b75e19b7206cb9888e87930cb37b1906a6345.tar.bz2
Implement QAudioInput::suspend() using CMMFDevSound::Stop()
As with playback mode, lack of support for CMMFDevSound::Pause() in DevSound's recording mode causes problems on some devices. Specifically, while QAudioInput works fine on the Nokia 5800, this bug was observed on the Nokia N8. This fix means that suspending and resuming audio input will work correctly on all devices. Task-number: QTBUG-13506 Reviewed-by: Derick Hawcroft
Diffstat (limited to 'src/multimedia/audio/qaudioinput_symbian_p.cpp')
-rw-r--r--src/multimedia/audio/qaudioinput_symbian_p.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/multimedia/audio/qaudioinput_symbian_p.cpp b/src/multimedia/audio/qaudioinput_symbian_p.cpp
index b837055..485c695 100644
--- a/src/multimedia/audio/qaudioinput_symbian_p.cpp
+++ b/src/multimedia/audio/qaudioinput_symbian_p.cpp
@@ -174,22 +174,30 @@ void QAudioInputPrivate::suspend()
|| SymbianAudio::IdleState == m_internalState) {
m_notifyTimer->stop();
m_pullTimer->stop();
- m_devSound->pause();
const qint64 samplesRecorded = getSamplesRecorded();
m_totalSamplesRecorded += samplesRecorded;
- m_devSoundBuffer = 0;
- m_devSoundBufferQ.clear();
- m_devSoundBufferPos = 0;
-
- setState(SymbianAudio::SuspendedState);
+ const bool paused = m_devSound->pause();
+ if (paused) {
+ if (m_devSoundBuffer)
+ m_devSoundBufferQ.append(m_devSoundBuffer);
+ m_devSoundBuffer = 0;
+ setState(SymbianAudio::SuspendedPausedState);
+ } else {
+ m_devSoundBuffer = 0;
+ m_devSoundBufferQ.clear();
+ m_devSoundBufferPos = 0;
+ setState(SymbianAudio::SuspendedStoppedState);
+ }
}
}
void QAudioInputPrivate::resume()
{
- if (SymbianAudio::SuspendedState == m_internalState) {
- if (!m_pullMode && !bytesReady())
+ if (QAudio::SuspendedState == m_externalState) {
+ if (SymbianAudio::SuspendedPausedState == m_internalState)
+ m_devSound->resume();
+ else
m_devSound->start();
startDataTransfer();
}
@@ -245,7 +253,7 @@ int QAudioInputPrivate::notifyInterval() const
qint64 QAudioInputPrivate::processedUSecs() const
{
int samplesPlayed = 0;
- if (m_devSound && SymbianAudio::SuspendedState != m_internalState)
+ if (m_devSound && QAudio::SuspendedState != m_externalState)
samplesPlayed = getSamplesRecorded();
// Protect against division by zero
@@ -334,7 +342,7 @@ void QAudioInputPrivate::startDataTransfer()
if (!m_pullMode)
pushData();
} else {
- if (SymbianAudio::SuspendedState == m_internalState)
+ if (QAudio::SuspendedState == m_externalState)
setState(SymbianAudio::ActiveState);
else
setState(SymbianAudio::IdleState);
@@ -442,7 +450,7 @@ void QAudioInputPrivate::devsoundBufferToBeEmptied(CMMFBuffer *baseBuffer)
m_totalBytesReady += buffer->Data().Length();
- if (SymbianAudio::SuspendedState == m_internalState) {
+ if (SymbianAudio::SuspendedPausedState == m_internalState) {
m_devSoundBufferQ.append(buffer);
} else {
// Will be returned to DevSoundWrapper by bufferProcessed().