﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
9451	IPTVRecorder doesn't produce proper TS packets for big DVB tables.	Ino Dekker <ino.dekker@…>	danielk	"If a channel is recorded from IPTV that contains a PAT and/or PMT table that is bigger than the payload size of one TS packet (184), only the first part is written to buffer (payload start indicator bit set).

Currently, in the functions IPTVRecorder::HandleSingleProgramPAT() and IPTVRecorder::HandleSingleProgramPMT() write the table to buffer as one (too) big packet:

For PAT:
{{{
//...
int next = (pat->tsheader()->ContinuityCounter()+1)&0xf;
pat->tsheader()->SetContinuityCounter(next);
BufferedWrite(*(reinterpret_cast<const TSPacket*>(pat->tsheader())));
//...
}}}
For PMT:
{{{
//...
int next = (pmt->tsheader()->ContinuityCounter()+1)&0xf;
pmt->tsheader()->SetContinuityCounter(next);
BufferedWrite(*(reinterpret_cast<const TSPacket*>(pmt->tsheader())));
//...
}}}

I modified the code to create a vector of the individual TS packets as implemented in the DVBRecorder class.
The code will now look like:

For PAT:
{{{
//...
int next = (pat->tsheader()->ContinuityCounter()+1)&0xf;
pat->tsheader()->SetContinuityCounter(next);
pat->GetAsTSPackets(_scratch, next);
for (int i = 0; i < _scratch.size(); i++)
    BufferedWrite(_scratch[i]);
//...
}}}
For PMT:
{{{
...
int next = (pmt->tsheader()->ContinuityCounter()+1)&0xf;
pmt->tsheader()->SetContinuityCounter(next);
pmt->GetAsTSPackets(_scratch, next);
for (int i = 0; i < _scratch.size(); i++)
    BufferedWrite(_scratch[i]);
...
}}}

The following line should be added to IPTVRecorder.h in the private class member section:
{{{
vector<TSPacket> _scratch;
}}}

I've successfully tested this fix on 0.23.0+fixes (Ubuntu 10.04). Since the code hasn't changed in the trunk, I'm confident it will work there too."	Patch - Bug Fix	closed	minor	0.25	MythTV - Recording	Master Head	medium	fixed	iptv dvb ts recorder		0
