We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b9dd3bf commit a0bf846Copy full SHA for a0bf846
1 file changed
packages/decode-wma/decode-wma.js
@@ -427,6 +427,7 @@ class WMADecoder {
427
428
// Phase 2: incremental — extract fixed-size packets from new data
429
let ps = this._meta.packetSize
430
+ if (!ps) { this._left = buf; return EMPTY } // variable-size: accumulate, decode on flush
431
let pkts = []
432
let pos = 0
433
while (pos + ps <= buf.length) {
@@ -484,7 +485,12 @@ class WMADecoder {
484
485
return { channelData, sampleRate: this.sr }
486
}
487
- flush() { this._left = null; return EMPTY }
488
+ flush() {
489
+ let r = EMPTY
490
+ if (this._left && this._meta && !this._meta.packetSize) r = this._decodePkts([this._left], this._meta)
491
+ this._left = null
492
+ return r
493
+ }
494
495
free() {
496
if (this.done) return
0 commit comments