Skip to content

fix(mod_conference): prevent garbage data in mixer output causing audio distortion#3026

Open
zhouhailin wants to merge 1 commit into
signalwire:masterfrom
zhouhailin:task/fix-conference-mixer-garbage-20260521-153000
Open

fix(mod_conference): prevent garbage data in mixer output causing audio distortion#3026
zhouhailin wants to merge 1 commit into
signalwire:masterfrom
zhouhailin:task/fix-conference-mixer-garbage-20260521-153000

Conversation

@zhouhailin

Copy link
Copy Markdown
Contributor

Bug

  • Symptom: Conference mixer randomly injects corrupted samples into mixed audio stream, causing brief playback glitches
  • Root cause: Off-by-one bounds checks and missing bounds checks in audio subtraction loops allow stale frame buffer data to be mixed in Verification

Fix

  • Fix
  • Code off logic-by-one in review self-subtraction bounds check (: allx <= read/2 -> x < read/2)
  • Add missing bounds check in relationship subtraction loop against imember->read
  • Fix off-by-one in file data bounds check
  • Zero remainder of frame buffers after partial reads (defense-in-depth)

correctly bounded by subtraction paths now actual bytes read

  • Consistent with addition path at L607 which already uses x < omember->read / 2

Closes #3024

…io distortion

Fix three bugs in the conference audio mixer that cause corrupted samples
to be injected into the mixed audio stream (issue signalwire#3024):

1. Off-by-one in self-subtraction bounds check (x <= read/2 -> x < read/2)
   that reads one sample past valid data in the member's frame buffer.

2. Missing bounds check in relationship subtraction loop that accesses
   imember->frame[x] without verifying x is within imember->read range,
   causing stale data from previous mixer cycles to be mixed in.

3. Off-by-one in file data bounds check (x <= file_sample_len -> x <)
   that reads one sample past valid file audio data.

Additionally, zero the remainder of member frame buffers after partial
reads as defense-in-depth against any residual stale data.

Closes signalwire#3024
@figaro2015

Copy link
Copy Markdown
Contributor

Important to note that in our case, it's not the garbage that gets inserted by the conference mixer, but the silence packets. Because there is no data from the input thread.

@figaro2015

Copy link
Copy Markdown
Contributor

Tried the proposed fix from the pull request and, as expected, it didn't fix the issue. Since the root cause of the problem is erroneously detecting no input audio from the conference members, and consequently inserting 'silence' packets into the output.

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.

Core of the conference mixer wrongly inserts silence packets which cause audio distortion

2 participants