fix: ABORT marks old turn as blocked, not new turn
acceptTurn() runs before ABORT handler, updating currentTurn to new value. ABORT then set blockedTurn = currentTurn (new turn), causing all audio frames for the new turn to be silently dropped. UI stuck at THINKING/ANSWERING. Fix: save oldTurn before acceptTurn; ABORT marks oldTurn as blocked. listen_start ABORT explicitly clears blockedTurn (no blocking). Version 0.3.3
This commit is contained in:
+2
-2
@@ -45,8 +45,8 @@ android {
|
||||
applicationId 'com.gorios.lanvoice'
|
||||
minSdk 26
|
||||
targetSdk 34
|
||||
versionCode 5
|
||||
versionName '0.3.1'
|
||||
versionCode 6
|
||||
versionName '0.3.3'
|
||||
ndk { abiFilters 'arm64-v8a' }
|
||||
}
|
||||
compileOptions { sourceCompatibility JavaVersion.VERSION_17; targetCompatibility JavaVersion.VERSION_17 }
|
||||
|
||||
@@ -222,6 +222,9 @@ class VoiceSession(
|
||||
diagnostic("ABORT ignored active=false blockedTurn=$blockedTurn")
|
||||
return
|
||||
}
|
||||
// An ABORT can announce the replacement turn. Remember the interrupted
|
||||
// turn before acceptTurn updates currentTurn and retires the old one.
|
||||
val oldTurn = if (hasTurn) currentTurn else null
|
||||
if (turn != null && !acceptTurn(turn)) return
|
||||
val action = event.payload.optString("state", "").ifBlank { event.type.substringAfter('.', "") }
|
||||
when (event.kind) {
|
||||
@@ -260,8 +263,8 @@ class VoiceSession(
|
||||
// listen_start aborts the previous reply while announcing the NEW turn.
|
||||
// The server's following LISTEN start and TTS belong to that new turn.
|
||||
val listenReset = event.payload.optString("reason") == "listen_start"
|
||||
blockedTurn = if (listenReset) null else currentTurn
|
||||
diagnostic("ABORT blockedTurn=$blockedTurn active=${isActive()} listenReset=$listenReset")
|
||||
blockedTurn = if (listenReset) null else oldTurn
|
||||
diagnostic("ABORT blockedTurn=$blockedTurn active=${isActive()} listenReset=$listenReset oldTurn=$oldTurn currentTurn=$currentTurn")
|
||||
playback.interrupt()
|
||||
if (isActive()) {
|
||||
update(state.copy(phase = VoicePhase.LISTENING))
|
||||
|
||||
Reference in New Issue
Block a user