Fix incorrect reading of PAT

This commit is contained in:
Vanilagy
2026-03-19 16:06:55 +01:00
parent 9e9240dfc3
commit 92c7831cf4
+2 -3
View File
@@ -236,12 +236,13 @@ export class MpegTsDemuxer extends Demuxer {
while (8 * (sectionLength + BYTES_BEFORE_SECTION_LENGTH) - bitstream.pos > BITS_IN_CRC_32) {
const programNumber = bitstream.readBits(16);
bitstream.skipBits(3); // Reserved
const id = bitstream.readBits(13);
if (programNumber !== 0) {
if (programMapPid !== null) {
throw new Error('Only files with a single program are supported.');
} else {
programMapPid = bitstream.readBits(13);
programMapPid = id;
}
}
}
@@ -1031,8 +1032,6 @@ export abstract class MpegTsTrackBacking implements InputTrackBacking {
return null;
}
// result.packet.randomAccessIndicator = 1; // Assume the first packet is always a key packet
const packet = this.createEncodedPacket(result.packet, result.duration, options);
this.packetBuffers.set(packet, buffer);
this.packetSectionStarts.set(packet, result.packet.sectionStartPos);