Ticket #8744: add_mutex_to_ChannelScannerSM.patch

File add_mutex_to_ChannelScannerSM.patch, 3.6 KB (added by Rune Petersen <rune@…>, 14 years ago)
  • libs/libmythtv/channelscan/channelscan_sm.h

     
    236236    QMap<uint, bool>            currentEncryptionStatusChecked;
    237237    QMap<uint64_t, QString>     defAuthorities;
    238238
     239    /// Protects the transport lists
     240    mutable QMutex    transportLock;
     241
    239242    /// Found Channel Info
    240243    ChannelList       channelList;
    241244    uint              channelsFound;
  • libs/libmythtv/channelscan/channelscan_sm.cpp

     
    355355
    356356void ChannelScanSM::HandlePMT(uint, const ProgramMapTable *pmt)
    357357{
     358    QMutexLocker locker(&transportLock);
     359
    358360    VERBOSE(VB_CHANSCAN, LOC +
    359361            QString("Got a Program Map Table for %1")
    360362            .arg((*current).FriendlyName) + "\n" + pmt->toString());
     
    365367
    366368void ChannelScanSM::HandleVCT(uint, const VirtualChannelTable *vct)
    367369{
     370    QMutexLocker locker(&transportLock);
     371
    368372    VERBOSE(VB_CHANSCAN, LOC + QString("Got a Virtual Channel Table for %1")
    369373            .arg((*current).FriendlyName) + "\n" + vct->toString());
    370374
     
    381385
    382386void ChannelScanSM::HandleMGT(const MasterGuideTable *mgt)
    383387{
     388    QMutexLocker locker(&transportLock);
     389
    384390    VERBOSE(VB_CHANSCAN, LOC + QString("Got the Master Guide for %1")
    385391            .arg((*current).FriendlyName) + "\n" + mgt->toString());
    386392
     
    412418        GetDTVSignalMonitor()->GetDVBStreamData()->SetVersionSDT(sdt->TSID(), -1, 0);
    413419    }
    414420
     421    QMutexLocker locker(&transportLock);
     422
    415423    uint id = sdt->OriginalNetworkID() << 16 | sdt->TSID();
    416424    ts_scanned.insert(id);
    417425
     
    428436
    429437void ChannelScanSM::HandleNIT(const NetworkInformationTable *nit)
    430438{
     439    QMutexLocker locker(&transportLock);
     440
    431441    VERBOSE(VB_CHANSCAN, LOC +
    432442            QString("Got a Network Information Table for %1")
    433443            .arg((*current).FriendlyName) + "\n" + nit->toString());
     
    460470            DefaultAuthorityDescriptor authority(def_auth);
    461471            ServiceListDescriptor services(serv_list);
    462472
     473            QMutexLocker locker(&transportLock);
     474
    463475            for (uint j = 0; j < services.ServiceCount(); j++)
    464476            {
    465477               // If the default authority is given in the SDT this
     
    496508            MPEGDescriptor::Find(parsed, DescriptorID::default_authority);
    497509        if (def_auth)
    498510        {
     511            QMutexLocker locker(&transportLock);
     512
    499513            DefaultAuthorityDescriptor authority(def_auth);
    500514            VERBOSE(VB_CHANSCAN, LOC + QString("found default authority(SDTo) "
    501515                                                "for service %1 %2 %3")
     
    15111525
    15121526    if (0 == nextIt.offset() && nextIt != scanTransports.begin())
    15131527    {
    1514         // Add channel to scanned list and potentially check decryption
    1515         if (do_post_insertion && !UpdateChannelInfo(false))
    1516             return;
     1528        {
     1529            QMutexLocker locker(&transportLock);
     1530            // Add channel to scanned list and potentially check decryption
     1531            if (do_post_insertion && !UpdateChannelInfo(false))
     1532                return;
     1533        }
    15171534
    15181535        // Stop signal monitor for previous transport
    15191536        signalMonitor->Stop();
     
    15271544
    15281545    current = nextIt; // Increment current
    15291546
     1547    QMutexLocker locker(&transportLock);
     1548
    15301549    if (current != scanTransports.end())
    15311550    {
    15321551        ScanTransport(current);