[mythtv] [mythtv-commits] Ticket #1356: DTVRecorder::FindKeyframes in 0.19 causes video gltiches in firewire recordings

Jim Westfall jwestfall at surrealistic.net
Mon Mar 6 00:13:12 UTC 2006


Steven Adeff <adeffs.mythtv at gmail.com> wrote [03.05.06]:
> On 3/4/06, Daniel Kristjansson <danielk at cuymedia.net> wrote:
> > On Sat, 2006-03-04 at 14:15 -0800, Jim Westfall wrote:
> > > can anyone explain this part of ::FindKeyframes?
> > >
> > >     // if packet contains start of PES packet, start
> > >     // looking for first byte of MPEG start code (3 bytes 0 0 1)
> > >     // otherwise, pick up search where we left off.
> > >     const bool payloadStart = tspacket->PayloadStart();
> > >     _header_pos = (payloadStart) ? 0 : _header_pos;
> > >
> > > If the packet doesnt contain the start of a PES packet, which is what
> > > we are looking for, why do we process the packet?
> > >
> > > I would think we could short circuit on (!payloadStart && !_header_pos).
> >
> > Yeah, I used to think so too and had that short circuit in the
> > code for a while, but sometimes the headers we are looking for
> > are not in the first TS packet containing the PES packet. This
> > happens especially with DVB-S, because they often insert a lot
> > of non-video data into the video packets, but can happen with any
> > stream encoded at the broadcast end.
> >
> > When I get around to fixing #799 we should be able to short
> > circuit the scan at a safe point in the pes packet. I've also
> > avoided  optimizing the FindKeyFrames function because I knew
> > we needed to fix #799 first.
> >
> > -- Daniel
> 
> Daniel, I don't see how #799 is related to the firewire issue? Also,
> is this a ticket anyone is working on currently?
> 
> --
> Thanks,
> Steve

It has to do with fully parsing the mpegts stream instead of the current 
method to find PES headers in FindKeyFrames, which is to look byte by 
byte.

If your inputs provide proper mpegts streams you could try the short 
circuit as described above and see if it helps your glitches.  It should 
cut the cpu usage of the function by probably ~90%.

jim


More information about the mythtv-dev mailing list