[mythtv] DVB Service Description Table (SDT) handling.

roger roger at beardandsandals.co.uk
Fri Dec 16 17:33:34 UTC 2016


Hi,

In a fit of madness I decided to have a look at the SDT handling in 
DVBStreamData.cpp.


A large portion of the code appears to be unused. But one of this bits 
that is used is this function.

bool DVBStreamData::HasCachedAllSDT(uint tsid, bool current) const
{
     QMutexLocker locker(&_cache_lock);

     if (!current)
         LOG(VB_GENERAL, LOG_WARNING, LOC +
             "Currently we ignore \'current\' param");

     sdt_cache_t::const_iterator it = _cached_sdts.find(tsid << 8);
     if (it == _cached_sdts.end())
         return false;

     uint last_section = (*it)->LastSection();
     if (!last_section)
         return true;

     for (uint i = 1; i <= last_section; i++)
         if (_cached_sdts.find((tsid << 8) | i) == _cached_sdts.end())
             return false;

     return true;
}

Given that SDT sections are cached by this function.

void DVBStreamData::CacheSDT(ServiceDescriptionTable *sdt)
{
     uint key = (sdt->TSID() << 8) | sdt->Section();

     QMutexLocker locker(&_cache_lock);

     sdt_cache_t::iterator it = _cached_sdts.find(key);
     if (it != _cached_sdts.end())
         DeleteCachedTable(*it);

     _cached_sdts[key] = sdt;
}

Is the bit in the first function that seeks on tsid << 8 really trying 
to find out if section zero is present?

As it is at the moment it looks like the function returns true if 
section zero is present and last section is also zero, or if section 
zero is present and last section is not zero and that section is also 
present. This does not really work as there are many reasons on 
unreliable transport mechanisms such as broadcast television that 
intervening segments may be missing.

Any comment anyone.

Roger


More information about the mythtv-dev mailing list