diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-05-10 07:40:05 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-05-10 07:43:32 (GMT) |
commit | a4bd18a3640fcad545fbd5a85374eb0056687dee (patch) | |
tree | 9376302c6027ebfdaabc069a4a488bc6a616e4fc /src/multimedia/audio/qaudiooutput_symbian_p.h | |
parent | 23f3c92081a8afd6ff4be352fee407817950e72f (diff) | |
download | Qt-a4bd18a3640fcad545fbd5a85374eb0056687dee.zip Qt-a4bd18a3640fcad545fbd5a85374eb0056687dee.tar.gz Qt-a4bd18a3640fcad545fbd5a85374eb0056687dee.tar.bz2 |
Return correct formats supported lists from Symbian audio backend
* QAudioDeviceInfoInternal functions now call CMMFDevSound::InitializeL()
The root cause of QTBUG-10205 was that CMMFDevSound::IntitializeL()
was not called before CMMFDevSound::Capabilities(), resulting in
incorrect values being returned by QAudioDeviceInfo 'supported format'
functions. Resolving this was not straightforward because, while
QAudioDeviceInfo is an entirely synchronous API,
CMMFDevSound::InitializeL() is an asynchronous function. The changes
therefore include a while(QApplication::instance()->processEvents(...))
loop, which is not a particularly elegant solution.
* Encapsulated all interaction with CMMFDevSound API in DevSoundWrapper
class
Because the original bug fix required QAudioDeviceInfoInternal to call
CMMFDevSound::InitializeL(), MDevSoundObserver callback functions had
to be implemented in QAudioDeviceInfoInternal. Rather than pollute
QAudioDeviceInfoInternal, a new class, DevSoundWrapper, was created
which encapsulates all interaction with CMMFDevSound, and therefore
implements MDevSoundObserver. QAudioInputPrivate and
QAudioOutputPrivate now call CMMFDevSound via DevSoundWrapper, with
only the required MDevSoundObserver callbacks forwarded on via signals.
After fixing this bug, running the auto test suites exposed a number
of regressions which had been introduced by the necessary refactoring
described above; this commit therefore also includes fixes for the
following:
* No stateChanged() signal emitted during DevSound initialization
Previously, QAudioInput / QAudioOutput would emit a state change from
StoppedState to IdleState or ActiveState, as soon as start() was called.
In the case where the requested format is subsequently found to be
unsupported, in addition to the error() value being set to OpenError,
a second state change would be emitted, back to StoppedState. This is
not the behaviour exhibited by the other platforms' backends,
and therefore caused an auto test failure. Now, the backend only
transitions to IdleState / ActiveState on successful initialization.
* Stop emitting notify() signal when notifyInterval is set to zero
* Call CMMFDevSound::RecordInitL() from QAudioInput::resume() if no
buffer is currently held
This is necessary in order to restart the data flow.
* Call CMMFDevSound::BufferFilled() from QAudioOutput::resume() in push
mode
The auto test does not resume pushing data to QAudioOutput until
'bytesFree() >= periodSize()' becomes true. Because, for the Symbian
backend, periodSize() == bufferSize(), this condition is only met when a
new buffer is provided by DevSound via BufferToBeFilled().
Task-number: QTBUG-10205
Diffstat (limited to 'src/multimedia/audio/qaudiooutput_symbian_p.h')
-rw-r--r-- | src/multimedia/audio/qaudiooutput_symbian_p.h | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/multimedia/audio/qaudiooutput_symbian_p.h b/src/multimedia/audio/qaudiooutput_symbian_p.h index 00ccb24..c0acb07 100644 --- a/src/multimedia/audio/qaudiooutput_symbian_p.h +++ b/src/multimedia/audio/qaudiooutput_symbian_p.h @@ -80,7 +80,6 @@ private: class QAudioOutputPrivate : public QAbstractAudioOutput - , public MDevSoundObserver { friend class SymbianAudioOutputPrivate; Q_OBJECT @@ -107,24 +106,16 @@ public: QAudio::State state() const; QAudioFormat format() const; - // MDevSoundObserver - void InitializeComplete(TInt aError); - void ToneFinished(TInt aError); - void BufferToBeFilled(CMMFBuffer *aBuffer); - void PlayError(TInt aError); - void BufferToBeEmptied(CMMFBuffer *aBuffer); - void RecordError(TInt aError); - void ConvertError(TInt aError); - void DeviceMessage(TUid aMessageType, const TDesC8 &aMsg); - private slots: void dataReady(); void underflowTimerExpired(); + void devsoundInitializeComplete(int err); + void devsoundBufferToBeFilled(CMMFBuffer *); + void devsoundPlayError(int err); private: void open(); void startPlayback(); - void startDevSoundL(); void writePaddingData(); qint64 pushData(const char *data, qint64 len); void pullData(); @@ -138,7 +129,6 @@ private: void setState(SymbianAudio::State state); bool isDataReady() const; - QAudio::State initializingState() const; private: const QByteArray m_device; @@ -156,9 +146,7 @@ private: bool m_pullMode; QIODevice *m_source; - QScopedPointer<CMMFDevSound> m_devSound; - TUint32 m_nativeFourCC; - TMMFCapabilities m_nativeFormat; + SymbianAudio::DevSoundWrapper* m_devSound; // Buffer provided by DevSound, to be filled with data. CMMFDataBuffer *m_devSoundBuffer; |