fix(audio,ios): gate output_underrun on !muted in refactored render callback

The PR #27 refactor moved the iOS render callback to a direct-fill
path with its own peak_i16 == 0 check, dropping the !muted gate
that PR #28 added to the pre-refactor callback. Without this
gate, every muted callback fires a false-positive
increment_output_underrun() because the downmix helper writes
silence (peak_i16 = 0) by design when muted.

Re-apply PR #28's gate to the refactored iOS path so this PR does
not silently reintroduce the bug PR #28 was opened to fix.

Verified:
- cargo test -p chanora_audio --lib: 133 passed, 0 failed
- cargo build -p chanora_audio --target aarch64-apple-ios: clean
This commit is contained in:
Edison Jwa
2026-06-07 23:27:46 +09:00
parent 5257b1e3ac
commit 76fe8faa94
@@ -1060,6 +1060,9 @@ impl IosVoiceUnit {
callbacks_with_audio = callbacks_with_audio.wrapping_add(1); callbacks_with_audio = callbacks_with_audio.wrapping_add(1);
} else { } else {
callbacks_with_silence = callbacks_with_silence.wrapping_add(1); callbacks_with_silence = callbacks_with_silence.wrapping_add(1);
// Muted output writes intentional silence (peak_i16 == 0 by
// design), not a starved render path. Gate on !muted to avoid
// counting deliberate silence as an output underrun.
if !muted { if !muted {
audio_processing_stats_for_render.increment_output_underrun(); audio_processing_stats_for_render.increment_output_underrun();
} }