Fixed an issue where the tail of the sound might be truncated in auto mode. (#1675)

This commit is contained in:
Wang is proud
2026-01-24 15:50:46 +08:00
committed by GitHub
parent 734b5b410a
commit 6b3659c2f5
3 changed files with 14 additions and 0 deletions

View File

@@ -823,6 +823,12 @@ void Application::HandleStateChangedEvent() {
// Make sure the audio processor is running
if (!audio_service_.IsAudioProcessorRunning()) {
// For auto mode, wait for playback queue to be empty before enabling voice processing
// This prevents audio truncation when STOP arrives late due to network jitter
if (listening_mode_ == kListeningModeAutoStop) {
audio_service_.WaitForPlaybackQueueEmpty();
}
// Send the start listening command
protocol_->SendStartListening(listening_mode_);
audio_service_.EnableVoiceProcessing(true);