Skip to content

Conversation

@lminiero
Copy link
Member

Tentative patch to try and more properly limit the mix the AudioBridge prepares, in presence of loud(er) contributions. This is an attempt to try and do something similar as #3593 (but without the external libwebrtc dependency), also taking into account the cap proposed in #3601 (in order never to clip). See #3593 (comment) for details.

I tested this briefly and it seems to be doing its job, but it will need to be properly tested in all the different potential AudioBridge configurations, most importantly with stereo and/or grouping too. Recording seems fine, forwarders will need to be evaluated.

@m08pvv
Copy link
Contributor

m08pvv commented Nov 17, 2025

In this approach there is no smooth transition between audio segments. Each segment has it's own gain which knows nothing about other gains, so transition between segments would be very rough. In AGC previous segments affect scale factors and transition is clean and smooth.

@m08pvv
Copy link
Contributor

m08pvv commented Nov 17, 2025

Moreover, there is only one gain value for the whole segment, so if we have a single spike inside normal segment - entire segment will be scaled.

@lminiero
Copy link
Member Author

Yes, it is a more simplified approach, but it's also hundreds of less lines of code and no dependency 😅 Anything that gets merged I have to mantain, which means I need to know what the code does, which is harder to do with too many changes I have little control on. Did you have a chance to test this patch with multiple voices, or was this an analysis just by looking at the code?

@m08pvv
Copy link
Contributor

m08pvv commented Nov 17, 2025

I didn't test this PR, just looked at the code, but I have some experience with simple approaches to audio processing (long story short, they work only in a very limited cases, but not in real life).
I can check (with my ears) this PR when have some free time.

@m08pvv
Copy link
Contributor

m08pvv commented Dec 3, 2025

So, tried commit ab93ea0 with same audio that I used in my tests (4 tabs with same audio input and 1 tab in another browser that listens)
image
We can clearly see (and hear) a lot of artifacts (clicking, crackling, etc.)

@lminiero
Copy link
Member Author

lminiero commented Dec 3, 2025

@m08pvv ack, thanks for testing, for its simpler approach it was worth a try 😅
I'm a bit busy on other activities at the moment, but I'll get back to your PR hopefully next week 🙏

}

/* Helper to limit/clamp mixed audio */
static inline void janus_audiobridge_limit_mix(opus_int32 *sumBuffer, opus_int16 *outBuffer, int samples) {
Copy link

Choose a reason for hiding this comment

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

These are overkill and not reliable. 1 random false noise could make whole mixing result worse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants