mediabunny 1.34.3 → 1.34.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,6 +38,10 @@ Mediabunny is a JavaScript library for reading, writing, and converting media fi
38
38
  <a href="https://screen.studio/" target="_blank" rel="sponsored">
39
39
  <img src="./docs/public/sponsors/screen-studio.webp" width="60" height="60" alt="Screen Studio">
40
40
  </a>
41
+ &nbsp;&nbsp;&nbsp;&nbsp;
42
+ <a href="https://www.tella.com/" target="_blank" rel="sponsored">
43
+ <img src="./docs/public/sponsors/tella.svg" width="60" height="60" alt="Tella">
44
+ </a>
41
45
  </div>
42
46
 
43
47
  ### Silver sponsors
@@ -19627,6 +19627,8 @@ var Mediabunny = (() => {
19627
19627
  throw new Error("ADTS does not support subtitles.");
19628
19628
  }
19629
19629
  async finalize() {
19630
+ const release = await this.mutex.acquire();
19631
+ release();
19630
19632
  }
19631
19633
  };
19632
19634
 
@@ -21660,6 +21662,7 @@ var Mediabunny = (() => {
21660
21662
  this.lastWriteEnd = 0;
21661
21663
  this.lastFlushEnd = 0;
21662
21664
  this.writer = null;
21665
+ this.writeError = null;
21663
21666
  /**
21664
21667
  * The data is divided up into fixed-size chunks, whose contents are first filled in RAM and then flushed out.
21665
21668
  * A chunk is flushed if all of its contents have been written.
@@ -21694,6 +21697,9 @@ var Mediabunny = (() => {
21694
21697
  return this.pos;
21695
21698
  }
21696
21699
  async flush() {
21700
+ if (this.writeError !== null) {
21701
+ throw this.writeError;
21702
+ }
21697
21703
  if (this.pos > this.lastWriteEnd) {
21698
21704
  const paddingBytesNeeded = this.pos - this.lastWriteEnd;
21699
21705
  this.pos = this.lastWriteEnd;
@@ -21740,6 +21746,8 @@ var Mediabunny = (() => {
21740
21746
  type: "write",
21741
21747
  data: chunk.data,
21742
21748
  position: chunk.start
21749
+ }).catch((error) => {
21750
+ this.writeError ??= error;
21743
21751
  });
21744
21752
  this.lastFlushEnd = chunk.start + chunk.data.byteLength;
21745
21753
  }
@@ -21817,17 +21825,23 @@ var Mediabunny = (() => {
21817
21825
  type: "write",
21818
21826
  data: chunk.data.subarray(section.start, section.end),
21819
21827
  position
21828
+ }).catch((error) => {
21829
+ this.writeError ??= error;
21820
21830
  });
21821
21831
  this.lastFlushEnd = chunk.start + section.end;
21822
21832
  }
21823
21833
  this.chunks.splice(i--, 1);
21824
21834
  }
21825
21835
  }
21826
- finalize() {
21836
+ async finalize() {
21827
21837
  if (this.chunked) {
21828
21838
  this.tryToFlushChunks(true);
21829
21839
  }
21840
+ if (this.writeError !== null) {
21841
+ throw this.writeError;
21842
+ }
21830
21843
  assert(this.writer);
21844
+ await this.writer.ready;
21831
21845
  return this.writer.close();
21832
21846
  }
21833
21847
  async close() {