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/qaudiodeviceinfo_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/qaudiodeviceinfo_symbian_p.h')
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo_symbian_p.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/multimedia/audio/qaudiodeviceinfo_symbian_p.h b/src/multimedia/audio/qaudiodeviceinfo_symbian_p.h index 89e539f..79b23cc 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_symbian_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_symbian_p.h @@ -53,11 +53,16 @@ #ifndef QAUDIODEVICEINFO_SYMBIAN_P_H #define QAUDIODEVICEINFO_SYMBIAN_P_H +#include <QtCore/QMap> #include <QtMultimedia/qaudioengine.h> #include <sounddevice.h> QT_BEGIN_NAMESPACE +namespace SymbianAudio { +class DevSoundWrapper; +} + class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { @@ -82,24 +87,33 @@ public: static QByteArray defaultOutputDevice(); static QList<QByteArray> availableDevices(QAudio::Mode); +private slots: + void devsoundInitializeComplete(int err); + private: void getSupportedFormats() const; private: - QScopedPointer<CMMFDevSound> m_devsound; + mutable bool m_initializing; + int m_intializationResult; QString m_deviceName; QAudio::Mode m_mode; + struct Capabilities + { + QList<int> m_frequencies; + QList<int> m_channels; + QList<int> m_sampleSizes; + QList<QAudioFormat::Endian> m_byteOrders; + QList<QAudioFormat::SampleType> m_sampleTypes; + }; + // Mutable to allow lazy initialization when called from const-qualified // public functions (isFormatSupported, nearestFormat) mutable bool m_updated; - mutable QStringList m_codecs; - mutable QList<int> m_frequencies; - mutable QList<int> m_channels; - mutable QList<int> m_sampleSizes; - mutable QList<QAudioFormat::Endian> m_byteOrders; - mutable QList<QAudioFormat::SampleType> m_sampleTypes; + mutable QMap<QString, Capabilities> m_capabilities; + mutable Capabilities m_unionCapabilities; }; QT_END_NAMESPACE |