Skip to content
This repository was archived by the owner on Oct 20, 2022. It is now read-only.

Commit 106bf6e

Browse files
committed
h264.js: correct IDR detection in case of 3-bytes start codes
1 parent 3ded9fd commit 106bf6e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/lib/mpegts/h264.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,12 @@ mpegts.h264.isIDR = function(data) { // data as Uint8Array
301301
naluType;
302302

303303
while (i < data.length) {
304-
if ((data[i] === 0x00) && (data[i + 1] === 0x00) && (data[i + 2] === 0x00) && (data[i + 3] === 0x01)) {
305-
naluType = data[i + 4] & 0x1F;
304+
if ((data[i] === 0x00) && (data[i + 1] === 0x00) && (data[i + 2] === 0x01)) {
305+
naluType = data[i + 3] & 0x1F;
306306
if (naluType === mpegts.h264.NALUTYPE_IDR) {
307307
return true;
308308
}
309-
i += 4;
309+
i += 3;
310310
} else {
311311
i++;
312312
}

0 commit comments

Comments
 (0)