libsoundio
libsoundio copied to clipboard
soundio_outstream_pause doesn't always work as expected
I'm running the sio_sine
test and I've noticed that sometimes happen that when I select to pause the audio (pressing p
) the audio is not paused even if the call to soundio_outstream_pause
seems to return no error
.
I've noticed that this happens more frequently if I'm running an audio player in the background (e.g.: Clementine or Amarok).
Backend: PulseAudio Output device: Integrated audio device Realtek ALC1150 (motherboard: Gigabyte Z170X Gaming 5) Software latency: 2.0 OS: Arch Linux 4.4.5-1 (64bit) Desktop environment: Deepin
I wonder if this may be a PulseAudio bug. The libsoundio code is simply calling pa_stream_cork
when you call soundio_outstream_pause
.
I gave a quick check to your code and it seems correct... Maybe you're right, it could be a PulseAudio issue.
Did you have the chance to test it on one machine with PulseAudio installed?
I've done quite a bit of testing with PulseAudio, and I believe I have run into the issue a few times recently. I have not been able to put together a reliable test case to submit to the PulseAudio bug tracker.
One option you may consider is destroying / creating the stream instead of trying to pause and unpause. This will have more consistent behavior across different backends.
Let's see if this issue shows up with PulseAudio 9.0. If so it's probably worth investigating further and at least submitting some code to the PulseAudio mailing list to see what they say.
Good, I will make some tests as soon as possible and report back you the feedback.
I've made a test with PulseAudio 9.0 and it seems that the issue is still there. I've noticed that without a media player running it is hard to reproduce, while Lollypop is running it happens quite often.
My configuration is the same as in the first post, kernel version apart (Linux Kernel: 4.6.3-1-ARCH #1 SMP PREEMPT Fri Jun 24 21:19:13 CEST 2016 x86_64 GNU/Linux)
Thank you for repeating the test. I'm going to try to get a minimal example of this problem without any libsoundio code and submit a bug report to PulseAudio.