Skip to content

Commit

Permalink
Check start byte of next table in packet
Browse files Browse the repository at this point in the history
The table handling determines the presence of the start of a second table in the same
transport stream packet by checking the value of the next byte after the first table.
If the next byte is not 0xFF then it is the table ID of the next table.
This is also done if the the first table ends at the last byte of the packet in which
case there is no next byte in the packet. When the value read is not 0xFF then
this is seen as the start of the next table.

This problem triggers the following error messages:
2020-10-20 22:41:27.980516 I  PESPacket: Failed CRC check 0x430b0111 != 0x5e91ff11 for StreamID = 0x1
2020-10-20 22:41:27.980535 E  MPEGStream[3](0x7fb258158158): Discarding broken PSIP packet
which are the result of the table handling getting lost after getting a wrong table start.

The check for the value of the next byte is now only done if there is at least
one byte in the transport stream packet after the end of the first table.

Tested with satellite Astra-1 19.2E, transport 1002, service 5021,  NHK WORLD-JPN.
  • Loading branch information
kmdewaal committed Oct 21, 2020
1 parent 10a768e commit 58dfe83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ PSIPTable* MPEGStreamData::AssemblePSIP(const TSPacket* tspacket,
// There might be another section after this one in the
// current packet. We need room before the end of the
// packet, and it must not be packet stuffing.
if ((offset + psip->SectionLength() < TSPacket::kSize) &&
if ((offset + psip->SectionLength() + 1 < TSPacket::kSize) &&
(pesdata[psip->SectionLength() + 1] != 0xff))
{
// This isn't stuffing, so we need to put this
Expand Down

0 comments on commit 58dfe83

Please sign in to comment.