Skip to content

Commit 71cda9b

Browse files
committed
fix: enhance decoding loop management in SymphoniaDecoderStream
1 parent f6e493e commit 71cda9b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/playback/processing/streamProcessor.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,20 @@ class SymphoniaDecoderStream extends Transform {
384384
this._loopScheduled ||
385385
this._isDecoding ||
386386
!this._isDecoderValid() ||
387-
this.readableFlowing === false ||
388-
this.readableLength >= this.readableHighWaterMark
387+
this.readableFlowing === false
389388
)
390389
return
391390

391+
if (this.readableLength >= this.readableHighWaterMark) {
392+
this._loopScheduled = true
393+
this._timeoutId = setTimeout(() => {
394+
this._timeoutId = null
395+
this._loopScheduled = false
396+
if (this._isDecoderValid()) this._scheduleDecode()
397+
}, AUDIO_CONSTANTS.decodeIntervalMs)
398+
return
399+
}
400+
392401
this._loopScheduled = true
393402

394403
this._timeoutId = setTimeout(() => {

0 commit comments

Comments
 (0)