From 957d68f39d0fb98f6e0fc285c16fd6fe54122976 Mon Sep 17 00:00:00 2001 From: Edison Jwa Date: Sun, 7 Jun 2026 19:18:32 +0900 Subject: [PATCH] fix(audio,ios): gate output_underrun on !muted ios_voice_unit.rs:1033: change the condition from `mix_stats.peak_i16 == 0` to `mix_stats.peak_i16 == 0 && !muted`. When the user mutes the channel via output_muted, the downmix helper fills the output buffer with silence (peak = 0), which previously falsely incremented the output_underrun counter. The mute toggle is intentional silence, not a real underrun. Note: this does not address the separate false positive where peak_i16 == 0 with output unmuted but no audio incoming (e.g., just joined a channel with no remote speaking). A complete fix would require tracking whether the audio handler actually produced data; deferred to a follow-up. --- crates/chanora_audio/src/ios_voice_unit.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/chanora_audio/src/ios_voice_unit.rs b/crates/chanora_audio/src/ios_voice_unit.rs index 0b73985..39a9e37 100644 --- a/crates/chanora_audio/src/ios_voice_unit.rs +++ b/crates/chanora_audio/src/ios_voice_unit.rs @@ -861,13 +861,14 @@ impl IosVoiceUnit { } else { render_recorder_active = false; } - // Track audio-vs-silence for the diagnostic. if mix_stats.peak_i16 > 0 { callbacks_with_audio = callbacks_with_audio.wrapping_add(1); } else { - audio_processing_stats_for_render.increment_output_underrun(); callbacks_with_silence = callbacks_with_silence.wrapping_add(1); + if !muted { + audio_processing_stats_for_render.increment_output_underrun(); + } } // Diagnostic sampling.