fix: audio frame sequence starts at 1 (server expects up_seq+1)

Server up_seq starts at 0, expects first frame seq=1. Client sent seq=0,
triggering sequence gap error and ws close 1008 after ~22 frames (450ms).

Also: version 0.3.2
This commit is contained in:
zenord
2026-10-11 19:17:37 +08:00
parent 71cb17036b
commit e90b073e68
@@ -36,7 +36,7 @@ class VoiceSession(
private var hasTurn = false private var hasTurn = false
private val retiredTurns = mutableSetOf<Long>() private val retiredTurns = mutableSetOf<Long>()
private var blockedTurn: Long? = null private var blockedTurn: Long? = null
private var sequence = 0L private var sequence = 1L
private val capture = AudioCapture() private val capture = AudioCapture()
private val playback: AudioPlayback = AudioPlayback( private val playback: AudioPlayback = AudioPlayback(
onDrained = { turn, epoch -> onDrained = { turn, epoch ->
@@ -161,7 +161,7 @@ class VoiceSession(
hasTurn = false hasTurn = false
retiredTurns.clear() retiredTurns.clear()
blockedTurn = null blockedTurn = null
sequence = 0 sequence = 1
update(state.copy(connection = connection, voiceActive = false, phase = VoicePhase.IDLE)) update(state.copy(connection = connection, voiceActive = false, phase = VoicePhase.IDLE))
} else update(state.copy( } else update(state.copy(
connection = connection, connection = connection,
@@ -298,7 +298,7 @@ class VoiceSession(
playback.interrupt() playback.interrupt()
currentTurn = id currentTurn = id
hasTurn = true hasTurn = true
sequence = 0 sequence = 1
if (blockedTurn != id) blockedTurn = null if (blockedTurn != id) blockedTurn = null
} }
if (logDecision) diagnostic("acceptTurn $before accepted=true nextTurn=$currentTurn nextBlocked=$blockedTurn retiredNow=${retiredTurns.size}") if (logDecision) diagnostic("acceptTurn $before accepted=true nextTurn=$currentTurn nextBlocked=$blockedTurn retiredNow=${retiredTurns.size}")