Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123104

QAudioSource without explicitly specified QAudioFormat is not functional

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.6.3, 6.7.0
    • Multimedia
    • None
    • macOS

    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
          }
      ...
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtmultimediateam Qt Multimedia Team
            studiosus Vladimir Belyavsky
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes