I'm going back to the program to see if there is anything suspect.
So I got back to the program and put a bit more logging. I have new results, but they are even more confusing.
Here is the part that writes to the buffer :
snd_pcm_wait(pcm, 1000 /* milliseconds */); snd_pcm_sframes_t avail = snd_pcm_avail_update(pcm); if (avail < 0) { std::cout << "snd_pcm_avail_update failed\n"; snd_pcm_recover (pcm, avail, 1); }
snd_pcm_sframes_t nb_written = snd_pcm_writei(pcm, &buffer[0], frames_per_buffer); if (nb_written < 0) { std::cout << "snd_pcm_writei failed\n"; snd_pcm_recover(pcm, nb_written, 1 /* silent */); xrun_count++; }
Not sure if this is the proper way, didn't write it myself, but looks more or less legit.
When I launch the program, nothing is output to the console.
But! If I echo 1 > xrun_injection, then I have "snd_pcm_avail_update failed" systematically.
However at the same time, no events are traces in /sys/kernel/debug/tracing/trace
Then the program itself is always dropping audio. In /proc/kmsg I see messages about lost interrupts and callback suppression.
Does it ring a bell?
I'm using kernel 4.17.2 http://kernel.org/pub/linux/kernel/v4.x/linux-4.17.2.tar.xz
With glibc 2.27 http://ftp.gnu.org/gnu/glibc/glibc-2.27.tar.bz2
With Alsa 1.1.6 http://www.mirrorservice.org/sites/ftp.alsa-project.org/pub/lib/alsa-lib-1.1...
Thanks,
Raphael