Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alsa underrun fix and pause #128

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Alsa underrun fix and pause #128

merged 2 commits into from
Apr 30, 2024

Conversation

mmitch
Copy link
Owner

@mmitch mmitch commented Apr 30, 2024

@mrehkopf also provided a fix for #127 – we'll take his version and add the "check ALSA device for pause support" commit on top.

The failing MacOS build check can be ignored: On first glance it looks like something with i18n has changed (new version of the build agent with different packages installed?), this should have nothing to do with our ALSA plugout changes.

mrehkopf and others added 2 commits April 29, 2024 23:45
Currently the plugout_alsa "pauses" playback simply by ceasing to
call `snd_pcm_writei()`; this causes a buffer underrun error on
resuming playback, and omission of one buffer's worth of samples
from playback (currently 2048 samples).

To mitigate this, check for an underrun retval (`-EPIPE`) after calling
`snd_pcm_writei()` and if applicable, recover by calling
`snd_pcm_prepare()` and	repeating the `snd_pcm_writei()` call to avoid
dropping samples.

Also implement an `alsa_pause()` function to pause and resume playback
without a buffer underrun using `snd_pcm_pause()`. The call will be
ineffective if unsupported by underlying hardware, in which case the
buffer underrun handling above will come into play.
Don't try to pause the ALSA sound device if the device does not
support the pause operation.

Also report errors on pause/resume.
@mmitch mmitch added this to the 0.0.98 milestone Apr 30, 2024
@mmitch mmitch merged commit 605c55f into master Apr 30, 2024
35 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants