From 93e58ee8afdc87dedfddfc8ee51ccbf01cb2c137 Mon Sep 17 00:00:00 2001 From: yillkid Date: Fri, 4 Sep 2026 19:00:25 +0800 Subject: [PATCH] fix: pace initial Opus frames for low-memory clients PRE_BUFFER_COUNT=5 pushed the first five 60ms frames without rate control, delivering ~360ms of audio in ~10ms. On ESP32-C3 (ESP-HI 2.2.6) playback was cut off after about one syllable. Let the 60ms rate controller own every frame instead. Refs #3349 --- main/xiaozhi-server/core/handle/sendAudioHandle.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/xiaozhi-server/core/handle/sendAudioHandle.py b/main/xiaozhi-server/core/handle/sendAudioHandle.py index 421554d63..f620f91bf 100644 --- a/main/xiaozhi-server/core/handle/sendAudioHandle.py +++ b/main/xiaozhi-server/core/handle/sendAudioHandle.py @@ -14,8 +14,9 @@ from core.utils.audioRateController import AudioRateController TAG = __name__ # 音频帧时长(毫秒) AUDIO_FRAME_DURATION = 60 -# 预缓冲包数量,直接发送以减少延迟 -PRE_BUFFER_COUNT = 5 +# 预缓冲包数量。部分 ESP32-C3 客户端接收缓冲不足,突发预缓冲会导致播放中断, +# 因此默认不做突发发送,全部交给 60ms 速率控制器。 +PRE_BUFFER_COUNT = 0 async def sendAudioMessage(conn: "ConnectionHandler", sentenceType, audios, text, sentence_id=None):