libsoundio icon indicating copy to clipboard operation
libsoundio copied to clipboard

soundio_outstream_pause doesn't always work as expected

Open killkrt opened this issue 8 years ago • 7 comments

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

killkrt avatar Mar 28 '16 08:03 killkrt

I wonder if this may be a PulseAudio bug. The libsoundio code is simply calling pa_stream_cork when you call soundio_outstream_pause.

andrewrk avatar Apr 22 '16 17:04 andrewrk

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?

killkrt avatar Apr 25 '16 19:04 killkrt

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.

andrewrk avatar Apr 25 '16 19:04 andrewrk

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.

andrewrk avatar Jun 29 '16 03:06 andrewrk

Good, I will make some tests as soon as possible and report back you the feedback.

killkrt avatar Jun 29 '16 08:06 killkrt

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)

killkrt avatar Jun 29 '16 21:06 killkrt

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.

andrewrk avatar Jun 29 '16 21:06 andrewrk