webm-muxer
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -120,3 +120,2 @@ "use strict"; | ||
this.dataOffsets = /* @__PURE__ */ new WeakMap(); | ||
this.enforceMonotonicity = false; | ||
__privateAdd(this, _helper, new Uint8Array(8)); | ||
@@ -126,5 +125,2 @@ __privateAdd(this, _helperView, new DataView(__privateGet(this, _helper).buffer)); | ||
seek(newPos) { | ||
if (this.enforceMonotonicity && newPos < this.pos) { | ||
throw new Error("Internal error: Monotonicity violation."); | ||
} | ||
this.pos = newPos; | ||
@@ -291,5 +287,2 @@ } | ||
} | ||
seek(newPos) { | ||
this.pos = newPos; | ||
} | ||
finalize() { | ||
@@ -370,5 +363,2 @@ this.ensureSize(this.pos); | ||
} | ||
seek(newPos) { | ||
this.pos = newPos; | ||
} | ||
finalize() { | ||
@@ -401,9 +391,12 @@ this.flushChunks(true); | ||
}; | ||
var _sections, _onFlush; | ||
var _sections, _onFlush, _lastFlushEnd, _ensureMonotonicity; | ||
var StreamingWriteTarget = class extends WriteTarget { | ||
constructor(onFlush) { | ||
constructor(onFlush, ensureMonotonicity) { | ||
super(); | ||
__privateAdd(this, _sections, []); | ||
__privateAdd(this, _onFlush, void 0); | ||
__privateAdd(this, _lastFlushEnd, 0); | ||
__privateAdd(this, _ensureMonotonicity, void 0); | ||
__privateSet(this, _onFlush, onFlush); | ||
__privateSet(this, _ensureMonotonicity, ensureMonotonicity); | ||
} | ||
@@ -417,5 +410,2 @@ write(data) { | ||
} | ||
seek(newPos) { | ||
this.pos = newPos; | ||
} | ||
flush(done) { | ||
@@ -449,4 +439,8 @@ if (__privateGet(this, _sections).length === 0) | ||
} | ||
if (__privateGet(this, _ensureMonotonicity) && chunk.start < __privateGet(this, _lastFlushEnd)) { | ||
throw new Error("Internal error: Monotonicity violation."); | ||
} | ||
let isLastFlush = done && chunk === chunks[chunks.length - 1]; | ||
__privateGet(this, _onFlush).call(this, chunk.data, chunk.start, isLastFlush); | ||
__privateSet(this, _lastFlushEnd, chunk.start + chunk.data.byteLength); | ||
} | ||
@@ -458,2 +452,4 @@ __privateGet(this, _sections).length = 0; | ||
_onFlush = new WeakMap(); | ||
_lastFlushEnd = new WeakMap(); | ||
_ensureMonotonicity = new WeakMap(); | ||
@@ -528,8 +524,6 @@ // src/main.ts | ||
} else if (typeof options.target === "function") { | ||
__privateSet(this, _target, new StreamingWriteTarget(options.target)); | ||
__privateSet(this, _target, new StreamingWriteTarget(options.target, !!options.streaming)); | ||
} else { | ||
throw new Error(`Invalid target: ${options.target}`); | ||
} | ||
if (options.streaming) | ||
__privateGet(this, _target).enforceMonotonicity = true; | ||
__privateMethod(this, _createFileHeader, createFileHeader_fn).call(this); | ||
@@ -536,0 +530,0 @@ } |
{ | ||
"name": "webm-muxer", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "WebM multiplexer in pure TypeScript with support for WebCodecs API, video & audio.", | ||
@@ -5,0 +5,0 @@ "main": "./build/webm-muxer.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73913
1361