[mythtv-commits] Ticket #10054: DVB Channel Scan creates large number of conflicting channels

MythTV noreply at mythtv.org
Thu Sep 22 15:11:46 UTC 2011


#10054: DVB Channel Scan creates large number of conflicting channels
-------------------------------------------------+-------------------------
 Reporter:  Argus <pthorn-mythd@…>               |          Owner:  danielk
     Type:  Patch - Bug Fix                      |         Status:  new
 Priority:  minor                                |      Milestone:  unknown
Component:  MythTV - Channel Scanner             |        Version:
 Severity:  medium                               |  0.24-fixes
 Keywords:                                       |     Resolution:
                                                 |  Ticket locked:  0
-------------------------------------------------+-------------------------

Comment (by Argus <pthorn-mythd@…>):

 See also attached patch.

 This comment gets technical, but it may be important to understand why the
 patch should work and what was going on because this is not going to be
 easy to recreate or test.

 What's happening here underneath is that the channel scanner is failing to
 process segmented SDT packets correctly. The bug is somewhat subtle.

 If the scanner receives a segmented table, the first segment will trigger
 the bug. The code (specifically in UpdateChannelInfo()) tried to determine
 if it had processed the SDT table before. In doing so, it created a
 default QMap entry to check if it was empty or not:

 {{{
 if (!currentInfo->sdts[tsid].empty()))
   continue;
 }}}

 The side effect: ''currentInfo->sdts'' is no longer empty as element
 ''[tsid]'' must be created by the ''sdts'' QMap object to call the method
 ''empty()'' on it.

 Later in the processing, the code checks thus:

 {{{
         if (sd->HasCachedAnyNIT() || sd->HasCachedAnySDTs())
         {
             transport_tune_complete &= !currentInfo->nits.empty();
             transport_tune_complete &= !currentInfo->sdts.empty();
         }
 }}}

 If the scanner has already processed an NIT table, then this code will
 generally indicate that the transport has completed tuning, even if the
 SDT is not complete (see above). This later leads to a partial processing
 of an incomplete channel list. Because the SDT entries aren't there as
 this is only the first segment of the SDT table, the channel listing only
 consists of PAT and PMT entries which are interpreted as the wayward MPEG
 channels.

 When the last SDT segment arrives, it kicks off the above code (again),
 this time correctly, and a complete channel listing, including the cached
 SDT tables, is processed. This is ''appended'' to the earlier scan
 information from segment 1. This creates the conflicts, as the channel
 numbers between the partial segments internally conflict.

 Of note, this situation is avoided when an NIT table arrives ''after'' a
 completed set of SDT tables, resulting in the seemingly random (and
 confusing) successful scans as noted in the bug report above.

 There are various ways to fix this bug, but I believe the easiest is in
 the attached patch. i.e. changing out the test for one that doesn't modify
 ''currentInfo->sdts'':

 {{{
    if (currentInfo->sdts.contains(tsid))
             continue;
 }}}

 The patch doesn't create the troublesome default QMap entry when checking
 if the SDT tables already exist and the remainder of the processing
 completes unhindered.

 This has corrected the issue for me for all cases noted in the bug (and
 significantly reduced frustration levels!)

 Hope this helps.

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/10054#comment:1>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list