Skip to content

Restore audio mute on navigation - #540

Merged
RytoEX merged 1 commit into
obsproject:masterfrom
prgmitchell:muteBrowerAudio
Oct 5, 2026
Merged

RytoEX merged 1 commit into
obsproject:masterfrom
prgmitchell:muteBrowerAudio

Conversation

@prgmitchell

@prgmitchell prgmitchell commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Description

Restore audio muting in OnLoadStart when control audio via OBS is enabled to prevent audio from bypassing OBS monitoring.

Related docs:
https://cef-builds.spotifycdn.com/docs/150.0/classCefLoadHandler.html#a830e338ec7d37d6fa50576311f965f31
https://cef-builds.spotifycdn.com/docs/150.0/classCefBrowserHost.html#a153d179c9ff202c8bb8869d2e9a820a2

Motivation and Context

Bug reported in OBS v33 beta 5,
Fixes obsproject/obs-studio#13985

LLM used to help me navigate through CEF docs but code/PR written by myself.

How Has This Been Tested?

Able to reproduce the issue with user provided alerts on v33 beta 5, no longer able to repro after these changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.
  • I have used AI tooling in the creation of this PR

@WizardCM

WizardCM commented Oct 3, 2026

Copy link
Copy Markdown
Member

Hmm, this issue is strange on multiple fronts.

Firstly, we already set muted audio during the creation of the CEF browser window. This should be respected for the lifetime of the CefBrowser, and the load state of the CefFrame shouldn't affect it (a CefBrowser can contain multiple CefFrames) .

if (reroute_audio)
cefBrowser->GetHost()->SetAudioMuted(true);

However, without your change, adding the following to OnLoadEnd always returns "unmuted", even when audio is very clearly muted.

blog(OG_WARNING, "OnLoadEnd: %s", browser->GetHost()->IsAudioMuted() ? "muted" : "unmuted");

With your change, it correctly returns "muted" and the momentary audio does not occur.

To me, this very much sounds like a CEF bug when combining windowless rendering with an audio handler.

I can confirm this PR fixes the issue, though I fear it is a bit hacky.

@WizardCM

WizardCM commented Oct 3, 2026

Copy link
Copy Markdown
Member

A follow-up from some of my own testing:

  1. Changing the mute state in CefLifeSpanHandler::OnAfterCreated does not fix the bug
  2. Changing the mute state in CefFrameHandler::OnMainFrameChanged also does not fix the bug

My hope was that either one of these would be "better suited" than in the load handler. Unfortunately, this proved incorrect - they have the same behaviour as our existing implementation of calling SetAudioMuted inline directly after CreateBrowserSync.

@WizardCM WizardCM added the kind/bug Categorizes issue or PR as related to a bug. label Oct 3, 2026
Comment thread browser-client.cpp Outdated
Restore audio muting in OnLoadStart when Control audio via OBS is
enabled to prevent audio from bypassing OBS monitoring.
@prgmitchell

Copy link
Copy Markdown
Member Author

@WizardCM ok, made that change + the one I mentioned off thread.

@Fenrirthviti

Copy link
Copy Markdown
Member

I can confirm this fixes the issue as presented, though I have no insight if this is the "correct" fix or just a hack as mentioned.

As a chore task, we should see if this has been reported upstream if we think it's an upstream issue, and report it if there isn't a report already.

@prgmitchell

Copy link
Copy Markdown
Member Author

@Fenrirthviti yes agreed, Matt mentioned he would take care of this in his comment on the related issue obsproject/obs-studio#13985 (comment)

@RytoEX
RytoEX merged commit de7e68f into obsproject:master Oct 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

Browser source blips audio to default audio device when controlled by OBS

4 participants