Uploaded image for project: 'Qt Mobility'
  1. Qt Mobility
  2. QTMOBILITY-1927

QPulseAudioOutput ignores write result from pulseaudio

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2: Important P2: Important
    • 1.2.0
    • 1.1.0, 1.1.2
    • Multimedia
    • None
    • MeeGo Harmattan, possibly other Linux environments using pulseaudio.
    • c814598251ccc83f71e32157e990f4de7cc30fae

      QPulseAudioOutput (plugins/multimedia/pulseaudio/qaudiooutput_pulse.cpp) writes data as follows:

      368 qint64 bytesWritten = write(buffer, l);
      369 Q_UNUSED(bytesWritten);

      The write function boils down to:

      389 pa_threaded_mainloop_lock(pulseEngine->mainloop());
      390 len = qMin(len, pa_stream_writable_size(m_stream));
      391 pa_stream_write(m_stream, data, len, 0, 0, PA_SEEK_RELATIVE);
      392 pa_threaded_mainloop_unlock(pulseEngine->mainloop());
      393 m_totalTimeValue += len;

      Note that write function actually writes qMin(len, pa_stream_writable_size), so not all data from the buffer is guaranteed to be written. Correct implementation should do:

      368 +
      qint64 bytesWritten = 0;
      while( bytesWritten < l )
      bytesWritten += write(buffer, l);
      }

      I am experiencing unreliable playback on Harmattan and this could be one of the reasons. I had not experienced any problems with other QAudioOutput implementations.

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

            ling.hu@nokia.com Ling Hu (closed Nokia identity) (Inactive)
            ivanl Ivan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes