mediabunny 1.7.2 → 1.7.3

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.
@@ -10774,13 +10774,9 @@ ${cue.notes ?? ""}`;
10774
10774
  this.lastMultipleOfKeyFrameInterval = multipleOfKeyFrameInterval;
10775
10775
  if (this.customEncoder) {
10776
10776
  this.customEncoderQueueSize++;
10777
- const promise = this.customEncoderCallSerializer.call(() => this.customEncoder.encode(videoSample, finalEncodeOptions)).then(() => {
10778
- this.customEncoderQueueSize--;
10779
- if (shouldClose) {
10780
- videoSample.close();
10781
- }
10782
- }).catch((error) => {
10783
- this.encoderError ??= error;
10777
+ const clonedSample = videoSample.clone();
10778
+ const promise = this.customEncoderCallSerializer.call(() => this.customEncoder.encode(clonedSample, finalEncodeOptions)).then(() => this.customEncoderQueueSize--).catch((error) => this.encoderError ??= error).finally(() => {
10779
+ clonedSample.close();
10784
10780
  });
10785
10781
  if (this.customEncoderQueueSize >= 4) {
10786
10782
  await promise;
@@ -10863,6 +10859,7 @@ ${cue.notes ?? ""}`;
10863
10859
  void this.muxer.addEncodedVideoPacket(this.source._connectedTrack, packet, meta);
10864
10860
  },
10865
10861
  error: (error) => {
10862
+ error.stack = new Error().stack;
10866
10863
  this.encoderError ??= error;
10867
10864
  }
10868
10865
  });
@@ -10897,7 +10894,6 @@ ${cue.notes ?? ""}`;
10897
10894
  }
10898
10895
  checkForEncoderError() {
10899
10896
  if (this.encoderError) {
10900
- this.encoderError.stack = new Error().stack;
10901
10897
  throw this.encoderError;
10902
10898
  }
10903
10899
  }
@@ -11203,13 +11199,9 @@ ${cue.notes ?? ""}`;
11203
11199
  assert(this.encoderInitialized);
11204
11200
  if (this.customEncoder) {
11205
11201
  this.customEncoderQueueSize++;
11206
- const promise = this.customEncoderCallSerializer.call(() => this.customEncoder.encode(audioSample)).then(() => {
11207
- this.customEncoderQueueSize--;
11208
- if (shouldClose) {
11209
- audioSample.close();
11210
- }
11211
- }).catch((error) => {
11212
- this.encoderError ??= error;
11202
+ const clonedSample = audioSample.clone();
11203
+ const promise = this.customEncoderCallSerializer.call(() => this.customEncoder.encode(clonedSample)).then(() => this.customEncoderQueueSize--).catch((error) => this.encoderError ??= error).finally(() => {
11204
+ clonedSample.close();
11213
11205
  });
11214
11206
  if (this.customEncoderQueueSize >= 4) {
11215
11207
  await promise;
@@ -11345,6 +11337,7 @@ ${cue.notes ?? ""}`;
11345
11337
  void this.muxer.addEncodedAudioPacket(this.source._connectedTrack, packet, meta);
11346
11338
  },
11347
11339
  error: (error) => {
11340
+ error.stack = new Error().stack;
11348
11341
  this.encoderError ??= error;
11349
11342
  }
11350
11343
  });
@@ -11476,7 +11469,6 @@ ${cue.notes ?? ""}`;
11476
11469
  }
11477
11470
  checkForEncoderError() {
11478
11471
  if (this.encoderError) {
11479
- this.encoderError.stack = new Error().stack;
11480
11472
  throw this.encoderError;
11481
11473
  }
11482
11474
  }