Skip to content

op/alsa: remove polling for events before pause (fixes #1461) - #1462

Merged
flyingmutant merged 3 commits into
cmus:masterfrom
ihy123:alsa
Nov 4, 2025
Merged

flyingmutant merged 3 commits into
cmus:masterfrom
ihy123:alsa

Conversation

@ihy123

@ihy123 ihy123 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

Checking the call stack after the player hangs shows that main thread is blocked by snd_pcm_wait() which is waiting for events.
main_thread
I just removed it, there is no apparent reason for it to be there.

This polling is there since the initial commit, but there is no apparent
reason for it to exist. Sometimes it would wait infinitely and block
the main thread and hang the whole player.
@ihy123
ihy123 marked this pull request as draft October 29, 2025 17:12
@ihy123

ihy123 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

Another issue randomly popped up after this change... So there was some reason for the polling

@ihy123

ihy123 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

The issue is that after pausing several times the playback just won't unpause even though snd_pcm_pause() returns successfully and changes alsa state to RUNNING. Same thing in Audacious. I am using a hardware ALSA device. No such issue on dmix audio device, or on pipewire's ALSA emulation. So this is either ALSA or driver problem.

@ihy123
ihy123 marked this pull request as ready for review October 29, 2025 19:12
@ihy123

ihy123 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

I want to squeeze in one more commit to remove the annoying debug output spam from ip/flac

@ihy123

ihy123 commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author

The issue is that after pausing several times the playback just won't unpause

This issue just disappeared

@pgaskin pgaskin left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems correct since snd_pcm_ready is apparently for waiting for room to write. Other projects don't seem to call snd_pcm_wait before snd_pcm_pause.

I didn't test this change.

@flyingmutant

Copy link
Copy Markdown
Member

This fixes #1461, right?

@flyingmutant flyingmutant linked an issue Nov 4, 2025 that may be closed by this pull request
@flyingmutant
flyingmutant merged commit b4252db into cmus:master Nov 4, 2025
@ihy123

ihy123 commented Nov 7, 2025

Copy link
Copy Markdown
Contributor Author

This fixes #1461, right?

Yep

@ihy123
ihy123 deleted the alsa branch November 19, 2025 13:14
@BrewTestBot BrewTestBot mentioned this pull request Oct 28, 2026
1 task done
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.

Fast pause/play causes deadlock

3 participants