frontend, libobs: Fix volume control state desync#13378
Open
Warchamp7 wants to merge 4 commits intoobsproject:masterfrom
Open
frontend, libobs: Fix volume control state desync#13378Warchamp7 wants to merge 4 commits intoobsproject:masterfrom
Warchamp7 wants to merge 4 commits intoobsproject:masterfrom
Conversation
a971f00 to
5c97df9
Compare
PatTheMav
reviewed
Apr 30, 2026
5178a68 to
eacca15
Compare
Update VolumeControl.hpp
e420190 to
cafc4da
Compare
cafc4da to
764fb8f
Compare
PatTheMav
reviewed
May 6, 2026
| } | ||
|
|
||
| static void on_audio_playback(void *param, obs_source_t *source, const struct audio_data *audio_data, bool muted) | ||
| static void on_audio_playback(void *param, obs_source_t *source, const struct audio_data *audio_data, bool) |
Member
There was a problem hiding this comment.
I'm surprised this works, because that's usually a C++ feature, so maybe a GNU extension?
Member
There was a problem hiding this comment.
We do have C extensions enabled for Linux because libobs doesn't compile without them there.
obs-studio/cmake/common/osconfig.cmake
Lines 5 to 17 in 74efa22
Member
There was a problem hiding this comment.
Yep we need that for stuff like POSIX threads to work IIRC, was just wondering if that's the reason why that works on Linux, because it won't on macOS and I'm not sure whether MSVC accepts it either.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR accomplishes two goals:
Motivation and Context
This fixes Audio Mixer UI buttons desync when controlled via WebSocket #13246. libobs sends the signals for the relevant state changes before the state is actually applied to the object. This means if you respond to a signal for
muteby callingobs_source_muted()you are going to get a stale value at best or a race condition at worst. Instead the VolumeControl now updates a local value using the new value from the signal, so that the up to date value can be used for updating the mixer state.Currently in the new audio mixer, the ability to hear a monitored source when it was muted was handled via frontend logic. This logic would consider the UI input and only actually mute a source if monitoring was disabled. This led to some inconsistencies when things like the Advanced Audio Properties window or websockets tried to update these settings, as they would not flow through that logic.
This approach was taken as I naively assumed that a muted source would never even make it to the part of the audio pipeline where monitoring would be considered. However after further investigation thanks to @PatTheMav, we gleaned that monitoring itself is done via audio callback and had specific handling for the muted state already.
How Has This Been Tested?
Changed the mute and monitoring state of multiple audio sources via the mixer, the Advanced Audio Properties window, and via obs-websockets.
Types of changes
Checklist: