Skip to content

Commit

Permalink
Fixes #8744. Fixes crash in DVB-x channel scanning.
Browse files Browse the repository at this point in the history
  • Loading branch information
RunePetersen authored and daniel-kristjansson committed Mar 1, 2012
1 parent 6f24f3b commit 146ee76
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 24 additions & 1 deletion mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp
Expand Up @@ -236,6 +236,8 @@ void ChannelScanSM::SetAnalog(bool is_analog)

void ChannelScanSM::HandleAllGood(void)
{
QMutexLocker locker(&lock);

QString cur_chan = (*current).FriendlyName;
QStringList list = cur_chan.split(" ", QString::SkipEmptyParts);
QString freqid = (list.size() >= 2) ? list[1] : cur_chan;
Expand Down Expand Up @@ -341,6 +343,8 @@ bool ChannelScanSM::ScanExistingTransports(uint sourceid, bool follow_nit)

void ChannelScanSM::HandlePAT(const ProgramAssociationTable *pat)
{
QMutexLocker locker(&lock);

LOG(VB_CHANSCAN, LOG_INFO, LOC +
QString("Got a Program Association Table for %1")
.arg((*current).FriendlyName) + "\n" + pat->toString());
Expand All @@ -356,6 +360,8 @@ void ChannelScanSM::HandlePAT(const ProgramAssociationTable *pat)

void ChannelScanSM::HandlePMT(uint, const ProgramMapTable *pmt)
{
QMutexLocker locker(&lock);

LOG(VB_CHANSCAN, LOG_INFO, LOC + QString("Got a Program Map Table for %1")
.arg((*current).FriendlyName) + "\n" + pmt->toString());

Expand All @@ -365,6 +371,8 @@ void ChannelScanSM::HandlePMT(uint, const ProgramMapTable *pmt)

void ChannelScanSM::HandleVCT(uint, const VirtualChannelTable *vct)
{
QMutexLocker locker(&lock);

LOG(VB_CHANSCAN, LOG_INFO, LOC +
QString("Got a Virtual Channel Table for %1")
.arg((*current).FriendlyName) + "\n" + vct->toString());
Expand All @@ -382,6 +390,8 @@ void ChannelScanSM::HandleVCT(uint, const VirtualChannelTable *vct)

void ChannelScanSM::HandleMGT(const MasterGuideTable *mgt)
{
QMutexLocker locker(&lock);

LOG(VB_CHANSCAN, LOG_INFO, LOC + QString("Got the Master Guide for %1")
.arg((*current).FriendlyName) + "\n" + mgt->toString());

Expand All @@ -390,6 +400,8 @@ void ChannelScanSM::HandleMGT(const MasterGuideTable *mgt)

void ChannelScanSM::HandleSDT(uint tsid, const ServiceDescriptionTable *sdt)
{
QMutexLocker locker(&lock);

LOG(VB_CHANSCAN, LOG_INFO, LOC +
QString("Got a Service Description Table for %1")
.arg((*current).FriendlyName) + "\n" + sdt->toString());
Expand Down Expand Up @@ -433,6 +445,8 @@ void ChannelScanSM::HandleSDT(uint tsid, const ServiceDescriptionTable *sdt)

void ChannelScanSM::HandleNIT(const NetworkInformationTable *nit)
{
QMutexLocker locker(&lock);

LOG(VB_CHANSCAN, LOG_INFO, LOC +
QString("Got a Network Information Table for %1")
.arg((*current).FriendlyName) + "\n" + nit->toString());
Expand All @@ -442,6 +456,8 @@ void ChannelScanSM::HandleNIT(const NetworkInformationTable *nit)

void ChannelScanSM::HandleBAT(const BouquetAssociationTable *bat)
{
QMutexLocker locker(&lock);

LOG(VB_CHANSCAN, LOG_INFO, LOC + "Got a Bouquet Association Table\n" +
bat->toString());

Expand Down Expand Up @@ -483,6 +499,8 @@ void ChannelScanSM::HandleBAT(const BouquetAssociationTable *bat)

void ChannelScanSM::HandleSDTo(uint tsid, const ServiceDescriptionTable *sdt)
{
QMutexLocker locker(&lock);

LOG(VB_CHANSCAN, LOG_INFO, LOC +
"Got a Service Description Table (other)\n" + sdt->toString());

Expand Down Expand Up @@ -513,6 +531,8 @@ void ChannelScanSM::HandleSDTo(uint tsid, const ServiceDescriptionTable *sdt)

void ChannelScanSM::HandleEncryptionStatus(uint pnum, bool encrypted)
{
QMutexLocker locker(&lock);

currentEncryptionStatus[pnum] = encrypted ? kEncEncrypted : kEncDecrypted;

if (kEncDecrypted == currentEncryptionStatus[pnum])
Expand Down Expand Up @@ -1534,6 +1554,8 @@ bool ChannelScanSM::HasTimedOut(void)
*/
void ChannelScanSM::HandleActiveScan(void)
{
QMutexLocker locker(&lock);

bool do_post_insertion = waitingForTables;

if (!HasTimedOut())
Expand Down Expand Up @@ -1576,7 +1598,8 @@ void ChannelScanSM::HandleActiveScan(void)
QString name = QString("TransportID %1").arg(it.key() & 0xffff);
TransportScanItem item(sourceID, name, *it, signalTimeout);
LOG(VB_CHANSCAN, LOG_INFO, LOC + "Adding " + name + " - " +
item.tuning.toString());
item.
tuning.toString());
scanTransports.push_back(item);
ts_scanned.insert(it.key());
}
Expand Down
3 changes: 3 additions & 0 deletions mythtv/libs/libmythtv/channelscan/channelscan_sm.h
Expand Up @@ -217,6 +217,9 @@ class ChannelScanSM : public MPEGStreamListener,
// Optional info
DTVTunerType scanDTVTunerType;

/// The big lock
mutable QMutex lock;

// State
bool scanning;
volatile bool threadExit;
Expand Down

0 comments on commit 146ee76

Please sign in to comment.