Skip to content

linux-alsa: Keep a stop that comes before the capture thread starts (Refs #1464) - #1559

Merged
zackees merged 2 commits into
masterfrom
fix/alsa-early-stop
Oct 20, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/alsa-early-stop

Conversation

@zackees

@zackees zackees commented Oct 20, 2026

Copy link
Copy Markdown
Member

Refs #1464 (split from it: one small PR per fix)

What and why

The capture thread set data->listen = true itself when it began to run, so a stop (_alsa_close(): listen = false, then join) that came first was overwritten: the thread captured on forever and the join (destroy, source removal, shutdown) hung. _alsa_open() now sets listen before pthread_create (and clears it if creation fails), and the thread loop checks it before the first read.

RED → GREEN

  • RED commit: 12fe448ab adds test/cmocka/test_alsa_early_stop.c. The race is made deterministic: pthread_create/pthread_join are wrapped (--wrap) and the capture thread is held at its start until the stopping thread has set listen = false and is joining it. Capture runs on ALSA's null PCM. On master destroy never returns ("destroy did not return within 2 s: the capture thread ignored the stop"); with the fix it returns at once.
  • GREEN: the fix cherry-picked unchanged from fix: 20 bug fixes in libobs callbacks, muxer, audio and build #1464; the new test passes. Checked locally by compiling the new test against the plugin source at both commits (obs-rust-linux-validate image, minimal libobs stand-in); PR CI (Tier 2) is the gate.
  • Real app: not run (no UI or log change beyond the fix itself).

Checklist

@zackees
zackees enabled auto-merge October 20, 2026 20:22
@zackees
zackees added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 20, 2026
@zackees
zackees force-pushed the fix/alsa-early-stop branch from 56d4ae0 to 698174f Compare October 20, 2026 21:12
@zackees
zackees enabled auto-merge October 20, 2026 21:12
@zackees
zackees added this pull request to the merge queue Oct 20, 2026
Merged via the queue into master with commit a093c4e Oct 20, 2026
23 checks passed
@zackees
zackees deleted the fix/alsa-early-stop branch October 26, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant