mediabunny 1.45.2 → 1.45.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.
@@ -32131,6 +32131,7 @@ ${cue.notes ?? ""}`;
32131
32131
  this.encoder = null;
32132
32132
  this.muxer = null;
32133
32133
  this.lastMultipleOfKeyFrameInterval = -1;
32134
+ this.emittedEncoderPackets = 0;
32134
32135
  // Tracks the input dimensions of the first frame
32135
32136
  this.codedWidth = null;
32136
32137
  this.codedHeight = null;
@@ -32459,10 +32460,19 @@ ${cue.notes ?? ""}`;
32459
32460
  (x) => x.microsecondTimestamp
32460
32461
  );
32461
32462
  const entry = preciseTimingIndex !== -1 ? this.preciseTimings[preciseTimingIndex] : null;
32462
- if (entry && entry.microsecondTimestamp === colorChunk.timestamp) {
32463
+ let actualType = null;
32464
+ if (this.emittedEncoderPackets === 0 && packet.type === "delta" && meta?.decoderConfig) {
32465
+ actualType = determineVideoPacketType(
32466
+ this.encodingConfig.codec,
32467
+ meta.decoderConfig,
32468
+ packet.data
32469
+ );
32470
+ }
32471
+ if (entry && entry.microsecondTimestamp === colorChunk.timestamp || actualType !== null) {
32463
32472
  packet = packet.clone({
32464
- timestamp: entry.timestampIsValid ? entry.timestamp : void 0,
32465
- duration: entry.durationIsValid ? entry.duration : void 0
32473
+ timestamp: entry?.timestampIsValid ? entry.timestamp : void 0,
32474
+ duration: entry?.durationIsValid ? entry.duration : void 0,
32475
+ type: actualType ?? void 0
32466
32476
  });
32467
32477
  }
32468
32478
  maybeEnsureIsKeyPacket(this.source._connectedTrack, packet);
@@ -32470,6 +32480,7 @@ ${cue.notes ?? ""}`;
32470
32480
  this.lastMuxerPromise = this.muxer.addEncodedVideoPacket(this.source._connectedTrack, packet, meta).catch((error) => {
32471
32481
  this.error ??= error;
32472
32482
  });
32483
+ this.emittedEncoderPackets++;
32473
32484
  };
32474
32485
  const stack = new Error("Encoding error").stack;
32475
32486
  this.encoder = new VideoEncoder({