mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-02 21:33:52 +02:00
Merge branch 'main' of https://github.com/Vanilagy/mediabunny
This commit is contained in:
@@ -328,11 +328,13 @@ export class FlacDemuxer extends Demuxer {
|
|||||||
|
|
||||||
const nextByte = readU8(slice);
|
const nextByte = readU8(slice);
|
||||||
if (nextByte === 0xff) {
|
if (nextByte === 0xff) {
|
||||||
|
const positionBeforeReading = slice.filePos;
|
||||||
|
|
||||||
const byteAfterNextByte = readU8(slice);
|
const byteAfterNextByte = readU8(slice);
|
||||||
|
|
||||||
const expected = this.blockingBit === 1 ? 0b1111_1001 : 0b1111_1000;
|
const expected = this.blockingBit === 1 ? 0b1111_1001 : 0b1111_1000;
|
||||||
if (byteAfterNextByte !== expected) {
|
if (byteAfterNextByte !== expected) {
|
||||||
slice.skip(-1);
|
slice.filePos = positionBeforeReading;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +347,7 @@ export class FlacDemuxer extends Demuxer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!nextFrameHeader) {
|
if (!nextFrameHeader) {
|
||||||
slice.skip(-1);
|
slice.filePos = positionBeforeReading;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,14 +357,14 @@ export class FlacDemuxer extends Demuxer {
|
|||||||
if (this.blockingBit === 0) {
|
if (this.blockingBit === 0) {
|
||||||
// Case A: If the stream is fixed block size, this is the frame number, which increments by 1
|
// Case A: If the stream is fixed block size, this is the frame number, which increments by 1
|
||||||
if (nextFrameHeader.num - frameHeader.num !== 1) {
|
if (nextFrameHeader.num - frameHeader.num !== 1) {
|
||||||
slice.skip(-1);
|
slice.filePos = positionBeforeReading;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Case B: If the stream is variable block size, this is the sample number, which increments by
|
// Case B: If the stream is variable block size, this is the sample number, which increments by
|
||||||
// amount of samples in a frame.
|
// amount of samples in a frame.
|
||||||
if (nextFrameHeader.num - frameHeader.num !== frameHeader.blockSize) {
|
if (nextFrameHeader.num - frameHeader.num !== frameHeader.blockSize) {
|
||||||
slice.skip(-1);
|
slice.filePos = positionBeforeReading;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user