mediabunny 1.13.1 → 1.13.2

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.
@@ -16947,8 +16947,7 @@ ${cue.notes ?? ""}`;
16947
16947
  this.lastLoadedPos += 10 + id3Tag.size;
16948
16948
  }
16949
16949
  }
16950
- const startPos = this.lastLoadedPos;
16951
- const result = await readNextFrameHeader(this.reader, startPos, this.reader.fileSize);
16950
+ const result = await readNextFrameHeader(this.reader, this.lastLoadedPos, this.reader.fileSize);
16952
16951
  if (!result) {
16953
16952
  this.lastSampleLoaded = true;
16954
16953
  return;
@@ -16956,13 +16955,14 @@ ${cue.notes ?? ""}`;
16956
16955
  const header = result.header;
16957
16956
  this.lastLoadedPos = result.startPos + header.totalSize - 1;
16958
16957
  const xingOffset = getXingOffset(header.mpegVersionId, header.channel);
16959
- let slice = this.reader.requestSlice(startPos + xingOffset, 4);
16958
+ let slice = this.reader.requestSlice(result.startPos + xingOffset, 4);
16960
16959
  if (slice instanceof Promise) slice = await slice;
16961
- assert(slice);
16962
- const word = readU32Be(slice);
16963
- const isXing = word === XING || word === INFO;
16964
- if (isXing) {
16965
- return;
16960
+ if (slice) {
16961
+ const word = readU32Be(slice);
16962
+ const isXing = word === XING || word === INFO;
16963
+ if (isXing) {
16964
+ return;
16965
+ }
16966
16966
  }
16967
16967
  if (!this.firstFrameHeader) {
16968
16968
  this.firstFrameHeader = header;
@@ -16971,7 +16971,7 @@ ${cue.notes ?? ""}`;
16971
16971
  const sample = {
16972
16972
  timestamp: this.nextTimestampInSamples / header.sampleRate,
16973
16973
  duration: sampleDuration,
16974
- dataStart: startPos,
16974
+ dataStart: result.startPos,
16975
16975
  dataSize: header.totalSize
16976
16976
  };
16977
16977
  this.loadedSamples.push(sample);