|
@@ -165,6 +165,14 @@ export class StreamingAudioPlayer {
|
|
|
}
|
|
}
|
|
|
} finally {
|
|
} finally {
|
|
|
this.isDecoding = false
|
|
this.isDecoding = false
|
|
|
|
|
+
|
|
|
|
|
+ // 🔑 关键修复:解码完成后,检查是否还有新的音频块需要解码
|
|
|
|
|
+ // 这样可以处理在解码过程中新到达的音频块
|
|
|
|
|
+ if (this.audioChunks.length > this.decodedChunksCount) {
|
|
|
|
|
+ console.log(`🔄 检测到 ${this.audioChunks.length - this.decodedChunksCount} 个未解码的块,继续解码...`)
|
|
|
|
|
+ // 使用 setTimeout 避免递归调用栈过深
|
|
|
|
|
+ setTimeout(() => this.decodeAndQueue(), 0)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|