Details
-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
None
-
5.6.2
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