[mythtv] Ticket #9929: MPEGStreamData doesn't handle video packets without a payload

Ronald Frazier ron at ronfrazier.net
Mon Nov 28 17:45:51 UTC 2011


On Mon, Nov 28, 2011 at 10:11 AM,  <noreply at mythtv.org> wrote:
> #9929: MPEGStreamData doesn't handle video packets without a payload
> ----------------------------------------------+----------------------------
>  Reporter:  Ron Frazier <ron@…>               |          Owner:
>     Type:  Bug Report - General              |         Status:  closed
>  Priority:  minor                             |      Milestone:  unknown
> Component:  MythTV - General                  |        Version:  0.24-fixes
>  Severity:  medium                            |     Resolution:  Invalid
>  Keywords:                                    |  Ticket locked:  0
> ----------------------------------------------+----------------------------
> Changes (by danielk):
>
>  * status:  new => closed
>  * resolution:   => Invalid
>
>
> Comment:
>
>  Ron, that is not an off by one error, the first video pid gets put in
>  _pid_video_single_program.
>  The recorders use IsVideoPID() to determine that it should be written to
>  disk, just like it does uses IsAudioPID() for the audio pids. The
>  "IsWritingPID()" pids are one we just pass through and don't do any
>  processing on. The video pid we want to locate keyframes on so that we can
>  seek more efficiently.

OK, if that's not a bug, then the bug lies in the
MPEGStreamData::ProcessTSPacket function. The situation I'm trying to
deal with is when I get a packet coming in on the video PID, but it
doesn't have a payload. It only contains an adaption field containing
PCR data. Without that PCR data, the video plays fine in myth, because
myth has built a seektable. But the file is not playable in most
external players, nor in mythvideo without a seektable.

The logic in ProcessTSPacket is as follows. For each packet it receives:

1) if the packet is not scrambled and has a payload, do some stuff with it.
2) else if the packet is not scrambled and is a writing PID, do some
other stuff with it
3) if it doesn't match either of the previous conditions, then just
ignore the packet, meaning it doesn't get passed to any listeners and
doesn't get written to the output file

The problem is, the packet has no payload, and by the current code
(without my patch) it doesn't get added to the writing PID list
either. So absolutely nothing is done with the packet and it just
silently disappears.

If you insist that it is proper to not add it to the list of writing
pids, then you instead need to modify the "else if" part so that it
not only checks for writing pids, but also for
_pid_video_single_program. In other words, change:

else if (!tspacket.Scrambled() && IsWritingPID(tspacket.PID()))

to

else if (!tspacket.Scrambled() && (IsWritingPID(tspacket.PID()) ||
IsVideoPID(tspacket.PID())))

If you agree that this is an appropriate solution to the problem, I
can make the change on my system, test to verify it still solves the
problem, and submit an updated patch to the ticket.

-- 
Ron Frazier


More information about the mythtv-dev mailing list