fix: ensure callback is called exactly once in StreamPositioner and WebMOpusMuxer

This commit is contained in:
NoLogicAlan committed 2026-10-17 03:20:57 +03:00
1 parent 6e1722b723
commit 5129ee5ecc
2 files changed
+12 -12

No files matched your search

+5 -7
View File
@@ -162,17 +162,15 @@ export class StreamPositioner extends Transform {
/** @param {Buffer} chunk @param {string} _enc @param {Function} cb @protected */
_transform(chunk, _enc, cb) {
let error = null;
try {
if (this._done) {
this.push(chunk);
return cb();
}
if (this._kind === "ogg") this._feedOgg(chunk);
if (this._done) this.push(chunk);
else if (this._kind === "ogg") this._feedOgg(chunk);
else this._feedWebm(chunk);
cb();
} catch (err) {
cb(err);
error = err;
}
cb(error);
}
/** @param {Function} cb @protected */