fix(audio): avoid duplicate WebRTC playback

This commit is contained in:
illusia committed 2026-09-03 01:02:18 +08:00
1 parent 8abd2d6228
commit 46b190a913
2 files changed
+11 -1

No files matched your search

+4
View File
@@ -1096,6 +1096,10 @@ export function useVoiceWebSocket() {
}
function handleAudioFrame(data: Uint8Array): void {
// WebRTC carries the realtime downlink after negotiation. Ignore any
// in-flight fallback WebSocket packets so a transport switch cannot
// produce duplicate or delayed playback.
if (webrtcActive.value) return;
if (data.length < 4) return;
const clientId = (data[1] << 8) | data[2];
if (clientId === state.tsClientId) return;