[唤醒应答与快速端点]:完成唤醒后我在播报和本地VAD端点优化,包含缓冲清理、配置项和测试覆盖

This commit is contained in:
mkbk
2026-06-17 20:51:14 +08:00
parent 860c2909fc
commit 44f708a3dc
12 changed files with 224 additions and 7 deletions
+15
View File
@@ -103,6 +103,11 @@ class MemoryAudioTransport:
self.played_segments.append(segment)
return PlaybackResult(True, segment.duration_ms)
def flush_input(self) -> int:
count = len(self._frames)
self._frames.clear()
return count
def stop(self) -> None:
self.started = False
@@ -290,6 +295,16 @@ class SoundDeviceAudioTransport:
break
return None
def flush_input(self) -> int:
count = 0
while not self._queue.empty():
try:
self._queue.get_nowait()
count += 1
except queue.Empty:
break
return count
def health(self) -> TransportHealth:
if self._sd is None:
return TransportHealth(False, False, "sounddevice unavailable")