V25: fix wobble khi play - re-buffer FILL sau flush (het loop underrun-flush)

This commit is contained in:
2026-08-26 21:37:06 +07:00
parent f38e500326
commit fa01ef02f7
4 changed files with 9 additions and 7 deletions
+4 -2
View File
@@ -167,8 +167,10 @@ class SfFxRealtimeProcessor extends AudioWorkletProcessor {
}
}
// Không phát: resume khi đủ block (lần đầu chờ FILL; sau đó chỉ cần 1
// block — hold che khoảng chờ).
if (this.outQueue.length >= (this.hasStarted ? 1 : this.FILL)) {
// block — hold che khoảng chờ). V25: sau flush (resumeFadeIn=true) chờ
// re-buffer đủ FILL mới resume — chặn loop underrun→flush→resume-1-block
// →underrun (wobble): 1 block phát hết ~5ms → cạn → flush lại.
if (this.outQueue.length >= (this.hasStarted && !this.resumeFadeIn ? 1 : this.FILL)) {
// V24: interruption (underrun sau stall) — backlog trong queue là audio
// LẠC HẬU (chơi lại → lag cộng dồn ~1s). KHÔNG chơi backlog: clear
// queue + báo main thread flush (engine xóa input/output ring, main