Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.6.3, 6.7.0
Description
QAudioSource without explicitly specified QAudioFormat is not functional at least with "darwin" multimedia backend on macOS. But I suppose this might be relevant for other platforms and other backends.
Details:
According to the documentation and public API, QAudioSource has constructors with
defaulted QAudioFormat argument.
https://doc.qt.io/qt-6/qaudiosource.html#QAudioSource
public: explicit QAudioSource(const QAudioFormat &format = QAudioFormat(), QObject *parent = nullptr); explicit QAudioSource(const QAudioDevice &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = nullptr);
Usually the "default" argument means something optional. Moreover there is no any method to set a format after the construction. So I expect that when I instantiate QAudioSource and don't explicitly specify the format, it will still be functional and will use e.g. QAudioDevice::preferredFormat() under the hood.
But, at least on "darwin" backend, it just fails silently at QAudioSource::start()
see
QDarwinAudioSource::start(QIODevice *device) { QIODevice* op = device; if (!m_audioDeviceInfo.isFormatSupported(m_audioFormat) || !open()) { m_stateCode = QAudio::StoppedState; m_errorCode = QAudio::OpenError; return; // <<<< just fails silently when m_audioFormat is null } ... }