[mythtv] Partial lock, Program not found in PAT

Patrick Reynolds reynolds at cs.duke.edu
Sat May 12 05:39:33 UTC 2007

I have several DVB (ATSC) channels that tune properly in mplayer but not
in MythTV.  I think I've figured out why.  I know there have been several
threads already on both "partial lock" and "Program ## not found in PAT,"
but I think what I've found and fixed is new.  I have DViCO Fustion 5 Lite
and Technisat b2c2 (rev.2) tuners, both of which support QAM.  They both
exhibit the same inability to tune some channels that mplayer tunes fine.
Neither one appears to offer "Quick tuning," which other people used to
work around one or both of these problems.

My cable operator (Time Warner in Central New York) appears to send
alternating good and bad PATs for some, but not all, channels.  For the
channels where this happens, the bad PATs take a form like:
             Program_number: 0 (0x0000)
             Network_PID: 8188 (0x1ffc)
... where they should look like this:
             Program_number: 3 (0x0003)
             Program_map_PID: 132 (0x0084)

             Program_number: 5 (0x0005)
             Program_map_PID: 80 (0x0050)

MythTV gets fooled badly here.  It wants program 5 (on PID 0x50), but if
it gets the bad PAT first, it announces, "there is only one program in the
PAT, so we'll just use it."  It switches over to seeking program 0 instead
of 5.  Program 0 doesn't exist in any PAT, so Myth gets stuck in a loop,
reporting "Partial lock: LA_," spewing 10 errors/sec into the backend
logs, and never actually tuning the channel.

I see three potential fixes:

#1.  Quick and dirty.  Just remove the 8 lines beginning with
         if (pat->ProgramCount() == 1)
      in libs/libmythtv/dtvsignalmonitor.cpp.  We shouldn't fall back on
      the wrong program just because we got one garbled PAT.

#2.  Look for both programs (in the above case, 5 and 0) until either is
      locked.  Since 0 is bogus, maybe don't look for that.

#3.  Distinguish between Network_PID and Program_map_PID.  dvbsnoop can
      tell the difference.  AFAICT, if the program number is 0, the PID
      is a Network_PID; otherwise, it's a Program_map_PID.  IOW, MythTV
      should never try to tune a program number of 0.

I'm new to DVB and the Myth source.  I implemented #1 because it was
easiest and it works for me.  If someone else is relying on the "one PID,
so it must be right" code, maybe #3 is a better bet.


More information about the mythtv-dev mailing list