Skip to content

Commit

Permalink
fix: inspect all program map tables for stream types (#386)
Browse files Browse the repository at this point in the history
We currently have issues with ts files that add stream types after the first program map table as we only look at the first one. So if audio were to be added in a subsequent program map table we wouldn't know to account for it.
  • Loading branch information
brandonocasey committed Jun 22, 2021
1 parent 440de99 commit bac4da9
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/tools/ts-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,22 @@ var parsePsi_ = function(bytes, pmt) {

switch (type) {
case 'pat':
if (!pmt.pid) {
pmt.pid = probe.ts.parsePat(packet);
}
pmt.pid = probe.ts.parsePat(packet);
break;
case 'pmt':
if (!pmt.table) {
pmt.table = probe.ts.parsePmt(packet);
}
var table = probe.ts.parsePmt(packet);

pmt.table = pmt.table || {};

Object.keys(table).forEach(function(key) {
pmt.table[key] = table[key];
});

break;
default:
break;
}

// Found the pat and pmt, we can stop walking the segment
if (pmt.pid && pmt.table) {
return;
}

startIndex += MP2T_PACKET_LENGTH;
endIndex += MP2T_PACKET_LENGTH;
continue;
Expand Down

0 comments on commit bac4da9

Please sign in to comment.