fix Live Call: drop all audio chunks during ducking

The old ducking logic only skipped chunks below a threshold (RMS < 0.10),
but the S25 Ultra speakers leak enough audio into the mic to exceed that.
Gemini's server-side VAD picks it up as user speech, triggers interrupts,
and the model starts hallucinating a conversation with itself.

Now: when ducking is active (model speaking), NO mic chunks are sent.
The server-side VAD handles the real speech detection after ducking ends.
This commit is contained in:
Bruno Deanoz 2026-06-24 13:06:31 +02:00
parent 45eb5dfaea
commit 3b32b208b6

View file

@ -101,7 +101,7 @@ class AudioPipeline(private val context: Context) {
val rms = computeRms(buffer, read) val rms = computeRms(buffer, read)
onAmplitude?.invoke(rms) onAmplitude?.invoke(rms)
if (ducking && rms < DUCKING_GAIN) continue if (ducking) continue
byteBuffer.clear() byteBuffer.clear()
for (i in 0 until read) byteBuffer.putShort(buffer[i]) for (i in 0 until read) byteBuffer.putShort(buffer[i])