Skip to content

Conversation

@pkviet
Copy link
Member

@pkviet pkviet commented Sep 26, 2025

Description

This fixes several bugs reported in audio-support and dev channels of our Discord server.

  1. Monitoring deduplication must be applied only to tracks for which the monitored source and the 'Audio Output Capture' (AOC) source are both enabled. This adds such checks.
  2. On linux, pulse device ids can have a '.monitor' suffix, so we need to take that into account.
  3. When the Desktop Audio has its fader to minimum, we should not deduplicate anymore.

Motivation and Context

Fixes 3 bugs.
Bugs reported by @Penwy & @prgmitchell
Bug 1 fix:
If the AOC has, say, tracks 1 2 3 enabled but not 4 5 6, and the monitored source has tracks 2 & 5 enabled,
the duplication occurs only on track 2.
So the silencing should occur on track 2 but not the others (track 5 in the example).
The bug fix checks then which tracks are common to AOC and monitored source and silences only them.

Bug 2 fix:
we allow for a looser device id match on linux by strncmp in addition to strcmp.

Bug3 fix:
we add a fader_muted member of obs_source; it is set to false unless the fader cur_db is below min_db.
The deduplication logic is now bypassed whenever the Desktop Audio is either user_muted or fader_muted.

We check against source->volume for the AOC; if it is detected to be 0 , we treat it as 'muted' and bypass deduplication logic.

How Has This Been Tested?

Bug 1: Checked by breakpointing that the silencing did not occur any more for tracks which are not common to both AOC
and monitored source.
Bug 2 : not checked. Waiting for linux testers.
Bug 3: Checked by making a recording. The monitored source set to monitor_and_and_output was still heard in the recording even though the desktop audio fader was at minimum.

Types of changes

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

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@pkviet pkviet added Bug Fix Non-breaking change which fixes an issue Seeking Testers Build artifacts on CI labels Sep 26, 2025
@pkviet pkviet added this to the OBS Studio 32.0 milestone Sep 26, 2025
Monitoring deduplication must be applied only to tracks for which the
monitored source and the 'Audio Output Capture' source are both enabled.
This adds such checks.

Signed-off-by: pkv <[email protected]>
@Penwy
Copy link
Contributor

Penwy commented Sep 27, 2025

I can confirm this fixes the bug I reported.
I have not noticed any additional issues introduced by it.

Pulse audio may append .monitor to device id; this commit adds this case
to the deduplication trigger.

Signed-off-by: pkv <[email protected]>
@pkviet pkviet changed the title libobs: Check tracks for monitoring deduplication libobs: Various fixes for monitoring deduplication Sep 27, 2025
@pkviet
Copy link
Member Author

pkviet commented Sep 27, 2025

Update
Fixes two other deduplication issues reported in our support channels on our Discord server.
See top post for details (deduplication not triggering on linux, deduplication triggering even if the Desktop Audio fader is at minimum [so muted in practice]).

@Penwy
Copy link
Contributor

Penwy commented Sep 27, 2025

Confirming the two additional issues listed are fixed by this on my end.

@prgmitchell
Copy link
Member

Confirmed 1 and 3 are fixed on Windows.

Copy link
Member

@PatTheMav PatTheMav left a comment

Choose a reason for hiding this comment

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

I quite honestly lost track of the decisioning logic behind this automagic feature and don't feel like I can review this without a proper logic flowchart.

@pkviet can you whip up a chart that represents that conditional logic behind all these changes?

It feels as if we're just bolting on more and more exceptions and further checks here and get lost in the woods. It feels very much like "deduplicate, except on Mondays, if it rains, but only if it didn't rain the Thursday before, except during a leap year" to me right now.

@pkviet
Copy link
Member Author

pkviet commented Oct 6, 2025

@PatTheMav
Here's a flow chart; hope it's clearer like that.

VISIO_2025-10-06_20-09-15

@PatTheMav
Copy link
Member

@PatTheMav Here's a flow chart; hope it's clearer like that.

Thank you, that was indeed very helpful.

@pkviet
Copy link
Member Author

pkviet commented Oct 8, 2025

Update
I have removed the fader_muted bool and switched to a more elegant solution which makes the bug fix a one liner, by using source->volume.

When the 'Audio Output Capture' source (usually Desktop Audio) has its
fader at minimum, we should disable the deduplication logic.
This is done by checking against the obs_source volume member.

Signed-off-by: pkv <[email protected]>
@RytoEX RytoEX merged commit 189ed7c into obsproject:master Oct 30, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fix Non-breaking change which fixes an issue Seeking Testers Build artifacts on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants