Skip to content

obs-browser: Resume WebAudio after audio crash - #2333

Closed
rdoupe wants to merge 2 commits into
obs-rust:masterfrom
rdoupe:fix/browser-audio-resume
Closed

rdoupe wants to merge 2 commits into
obs-rust:masterfrom
rdoupe:fix/browser-audio-resume

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2328

Draft until obs-rust/obs-browser#6 merges. This PR moves plugins/obs-browser to that PR's head (654d2b9); once it merges, the pointer is updated to the merged commit if it differs, then this leaves draft.

What and why

Upstream obsproject/obs-studio#10586: with "Control audio via OBS", a browser source that plays through WebAudio (alert boxes) goes silent for good after Chromium's audio service process dies (a crash, a device change, or on Windows the audio hang monitor ending it). The page's AudioContext fires error and is suspended, and nothing resumes it until the page reloads or the setting is toggled.

The fix is in obs-rust/obs-browser: every frame gets a script, before the page's own, that resumes such a context unless the page suspended it itself. Pages still see the native AudioContext; OfflineAudioContext is untouched; pages that replace or freeze globals do not break it. The first resume waits 3 s, because CEF keeps the dead capture stream until the page has been silent for 2 s.

This PR moves the submodule pointer forward (descends from master's pointer; ci/submodule_direction.py origin/master passes) and adds the docs/features.md line. The pointer also picks up obs-rust/obs-browser#5 (os_event_init checks), already on the fork's master.

RED → GREEN

  • RED commit test: WebAudio after the audio service dies (0bcdb29): pointer to the obs-browser test commit. tests/audio_recovery.py (real libobs, real obs-browser module and CEF 8078, local WebAudio tone page, reroute_audio) SIGKILLs only the run's audio service process and requires packets in the 5th second after the kill. On master all 4 scenarios fail with 0 packets: plain, repeated (3 kills, page that replaces and freezes globals), page-suspend, two-sources.
  • GREEN obs-browser: Resume WebAudio after audio crash (a098e66): 4 of 4 pass, audio back 3.1 to 3.2 s after each kill, the page-suspended context stays suspended. Runs on Linux, isolated (loopback-only netns, private Xvfb and dbus, fresh HOME, no audio server).
  • Not run in CI: it needs CEF and an X display and kills a Chromium process (PR CI builds with -DENABLE_BROWSER=OFF). Command in plugins/obs-browser/tests/README.md.
  • Real app: not run in the OBS UI; the test drives the real module through libobs.

Checklist

  • Base is master
  • I claimed the issue, or no one else has an open PR for it
  • RED, then GREEN commits
  • User-visible change: its line in docs/features.md is added (Fixed upstream bugs, Audio). Add the obs-browser PR link as dependency [obs-rust/obs-browser#6] once it exists.
  • Local gate: --lane lint, --lane cross and --test-diff origin/master pass on GREEN (test scope: none, pointer and docs only); hybrid tree builds
  • Warning or flag changes: N/A
  • Intentional differences from C: N/A

Move plugins/obs-browser to the test from obs-rust/obs-browser: a
browser source plays a local WebAudio tone with "Control audio via
OBS", the run's Chromium audio service process is SIGKILLed, and audio
packets must flow again in the fifth second after the kill. Scenarios:
one kill, three kills on a page that replaces and freezes globals, a
context the page suspended itself, and two sources.

On master all four fail with 0 packets after the kill.

Refs obs-rust#2328
Move plugins/obs-browser to the obs-rust/obs-browser fix: every frame
gets a script, before the page's own, that resumes an AudioContext
suspended by an audio service error unless the page suspended it
itself. Pages still see the native AudioContext; OfflineAudioContext
is untouched; pages that replace or freeze globals do not break it.

tests/audio_recovery.py in obs-browser: 4 of 4 scenarios pass (one
kill, three kills on a hostile page, a page-suspended context that
stays suspended, two sources); audio is back 3.1 to 3.2 s after each
kill, against 0 packets on master.

Fixes obs-rust#2328
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In progress in obs-rust Multiview Oct 25, 2026
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 25, 2026
…s) (obs-rust#2378)

Moves plugins/obs-browser from 7bab463c9 to 4583599fe, with:

- obs-rust/obs-browser#3: the CEF sandbox where it can work on Linux
  (obs-rust#1092)
- obs-rust/obs-browser#5: os_event_init results checked in module load
  and ExecuteOnBrowser
- obs-rust/obs-browser#6: WebAudio resumes after the audio service dies
  (obs-rust#2328)
- obs-rust/obs-browser#7: browser audio that arrives too late to mix is
  dropped (obs-rust#2335)
- obs-rust/obs-browser#8: the fallback warning when the sandbox can't
  work (obs-rust#2218)

One bump instead of three (obs-rust#2333, obs-rust#2351 and ours), as agreed on obs-rust#2351.
docs/features.md gets the two audio lines from obs-rust#2333 and obs-rust#2351 as they
are, a line for the sandbox, and the browser on the fallback warning
line, which obs-rust#2238 merged on 2026-10-25.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Done in obs-rust Multiview Oct 25, 2026
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.

bug: obs-browser: browser source goes silent for good after the Chromium audio service restarts (upstream #10586)

1 participant