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

QAudioInput stops capturing data after underrun

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3: Somewhat important
    • None
    • 5.6.2
    • Multimedia

    Description

      Attached audioinput.cpp is a minimal example to demonstrate the issue. It only seems to happen with a USB audio device (Philips SpeechMike) which is using `snd_usb_audio` kernel module. Most of the time it randomly stops saving data, but once in a while will work all the way through (maybe once out of 50 runs).

      Attached are outputs from 3 different runs: run1.txt run2.txt run3.txt

      The same example works totally fine with the internal audio device `sysdefault:card=PCH` each time. See run4.txt

      By sprinkling a few `qDebug()` statements in `qalsaaudioinput.cpp` I narrowed the issue down to `QAlsaAudioInput::xrun_recovery()` function.

      On line 143 `checkBytesReady()` returns 0 and causes reset on line 163 after which point no data is captured anymore.

      The program was compiled with the following command: 

      clang++ -std=c++14 -fPIC -I/usr/include/qt5/ -I/usr/include/qt5/QtCore/ -I/usr/include/qt5/QtWidgets/ 
      -I/usr/include/qt5/QtMultimedia -lQt5Core -lQt5Widgets -lQt5Multimedia audioinput.cpp
      

      NOTE: Not long ago I've programmed this exact device using straight up ALSA API and it worked just fine. I did however used a high level `snd_pcm_recover()` function to deal with underruns.

       

      Additional data:

      USB audio device: Philips SpeechMike LFH3510

      OS: Gentoo Linux

      kernel: 4.9.16

      alsa-lib: 1.1.2

      Attachments

        1. audioinput_push.cpp
          1 kB
        2. audioinput.cpp
          1 kB
        3. run1.txt
          2 kB
        4. run2.txt
          2 kB
        5. run3.txt
          2 kB
        6. run4.txt
          7 kB
        7. run5.txt
          4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            valentyn.doroshchuk Valentyn Doroshchuk
            dimitry_ishenko Dimitry Ishenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes