There was an error while loading. Please reload this page.
1 parent 109b57e commit 7f5806fCopy full SHA for 7f5806f
1 file changed
rust/src/channel/mixer.rs
@@ -857,7 +857,17 @@ async fn feed_recorders(
857
}
858
inter
859
} else {
860
- samples.to_vec()
+ // Mono: saturated sum of self leg + peer leg, matching C++
861
+ // `soundfilewriter::write` where mono advances buf by 1 in
862
+ // both loops so the second leg is `*buf += outval`.
863
+ match peer_samples {
864
+ Some(peer) => samples.iter().enumerate().map(|(idx, &s)| {
865
+ let a = s as i32;
866
+ let b = peer.get(idx).copied().unwrap_or(0) as i32;
867
+ (a + b).clamp(i16::MIN as i32, i16::MAX as i32) as i16
868
+ }).collect(),
869
+ None => samples.to_vec(),
870
+ }
871
};
872
// Power calc on the narrowband `samples` (self's inbound), not
873
// the interleaved stereo `frame` — matches C++ `codecx::power()`.
0 commit comments