From 56b072c45ec20368f1b543ed726aa6e5bf5ef212 Mon Sep 17 00:00:00 2001 From: "j.foucher" Date: Thu, 5 Mar 2026 18:27:14 +0100 Subject: [PATCH] Fix UserSpeechMs growing indefinitely in Server VAD mode TurnStartTime was only set in StartListening(), which is called once. In Server VAD + interruption mode the mic stays open, so TurnStartTime was never updated between turns. Now reset TurnStartTime when the agent stops speaking (normal end + interruption), marking the start of the next potential user turn. Co-Authored-By: Claude Opus 4.6 --- .../Private/PS_AI_ConvAgent_ElevenLabsComponent.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_ElevenLabsComponent.cpp b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_ElevenLabsComponent.cpp index 7fd7245..ed75d81 100644 --- a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_ElevenLabsComponent.cpp +++ b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_ElevenLabsComponent.cpp @@ -279,6 +279,7 @@ void UPS_AI_ConvAgent_ElevenLabsComponent::TickComponent(float DeltaTime, ELevel bHardTimeoutFired = bHardTimeout && !bAgentResponseReceived; bAgentSpeaking = false; bPreBuffering = false; // Cancel pending pre-buffer to prevent stale OnAudioPlaybackStarted. + TurnStartTime = FPlatformTime::Seconds(); // Mark start of next potential user turn. bAgentResponseReceived = false; SilentTickCount = 0; bShouldBroadcastStopped = true; @@ -1516,6 +1517,7 @@ void UPS_AI_ConvAgent_ElevenLabsComponent::StopAgentAudio() SilentTickCount = 0; bWasSpeaking = true; Now = FPlatformTime::Seconds(); + TurnStartTime = Now; // Mark start of next potential user turn. } }