Comcast / gots

MPEG Transport Stream handling in Go
Other
308 stars 88 forks source link

psi: ReadPMT skips over packets without a program map table #85

Closed tmm1 closed 6 years ago

tmm1 commented 6 years ago

Following up on #75

Some streams (ironically those I see coming from my comcast cable feed) can contain multiple tables on the PMT pid. These include cable-specific SCTE tables (0xc0), in addition to the usual PMT table (0x2).

Normally both tables are combined into one TS packet, but sometimes a single TS packet only contains the SCTE table. Then the following TS packet contains the PMT table.

This patch fixes ReadPMT to ignore packets that do not contain the PMT table, and to reset its state and keep reading until it actually finds a real PMT.