Finally managed to nail the channel-changing bug on MythTV that had been bugging me, and more or less making mythtv unusable for me.
You can reproduce the bug by switching channels when on (on my setup) a ATSC (OTA HDTV) source. On switching channels between two channels that have the same pid/stream type (not toooo sure of this), the old pes won’t get cleared out properly.
The proper fix would be to ensure that the pid/pes stuff gets handled properly in av_remove_stream in utils.c. Anyways, here’s my crappy fix (well, more of a hack)
In the file libmythtv/avformatdecoder.cpp, change the file to look like the following. The real bug is that this doesn’t fixup the pmt_pid tables in the ts context thingymajig. This works great now, well for me anyway.
void AvFormatDecoder::Reset(void)
{
SeekReset();
// Clear out the existing mpeg streams
// so we can get a clean set from the
// new seek position.
// for (int i = ic->nb_streams – 1; i >= 0; i–)
// {
// AVStream *st = ic->streams[i];
// if (st->codec.codec_type == CODEC_TYPE_AUDIO)
// {
// if (st->codec.codec)
// avcodec_close(&st->codec);
// av_remove_stream(ic, st->id);
// }
// }
m_positionMap.clear();
framesPlayed = 0;
framesRead = 0;
seen_gop = false;
seq_count = 0;
}
