[mythtv-commits] Ticket #11399: EIT scanner causes unnecessary reschedules and prevents idle shutdown
MythTV
noreply at mythtv.org
Thu Feb 7 17:22:14 UTC 2013
#11399: EIT scanner causes unnecessary reschedules and prevents idle shutdown
-----------------------------------+----------------------------
Reporter: Roger James <roger@…> | Owner: stuarta
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: 0.26.1
Component: MythTV - EIT | Version: 0.26-fixes
Severity: medium | Resolution:
Keywords: eit idle | Ticket locked: 0
-----------------------------------+----------------------------
Comment (by Roger James <roger@…>):
The new version of the patch seems to be working. The code I posted before
was not correct. Here is the new logic in IsNewEIT
{{{
if (it != eventMap->end())
{
uint cached_tableid = extract_table_id(*it);
uint cached_version = extract_version(*it);
uint cached_endtime = extract_endtime(*it);
if ((TableID::PF_EIT == tableid) || (TableID::PF_EITo == tableid))
{
// tableid is for PF table
if ((TableID::PF_EIT == cached_tableid) || (TableID::PF_EITo
== cached_tableid))
{
// Already seen a PF table so check version
// and update if it has changed
if ((kVersionInvalid == cached_version) ||
(cached_version < version) ||
((kVersionMax == cached_version) && (version <
kVersionMax)))
{
LOG(VB_EIT, LOG_INFO, LOC + QString("PF table version
change - new (%1 %2) old (%3 %4) eventid %5 for chanid %6")
.arg(QString().sprintf("%02x",
tableid)).arg(QString().sprintf("%02x", version))
.arg(QString().sprintf("%02x",
cached_tableid)).arg(QString().sprintf("%02x", cached_version))
.arg(eventid).arg(chanid));
verChgCnt++;
bEntryUpdated = true;
if (cached_endtime != endtime)
bEventMayCauseReschedule = true;
}
else
{
// EIT data previously seen
hitCnt++;
return false;
}
}
else
{
// Old entry is in SC table
LOG(VB_EIT, LOG_INFO, LOC + QString("SC to PF tableid
change - new (%1 %2) old (%3 %4) eventid %5 for chanid %6")
.arg(QString().sprintf("%02x",
tableid)).arg(QString().sprintf("%02x", version))
.arg(QString().sprintf("%02x",
cached_tableid)).arg(QString().sprintf("%02x", cached_version))
.arg(eventid).arg(chanid));
bEntryUpdated = true;
if (cached_endtime != endtime)
bEventMayCauseReschedule = true;
}
}
else
{
// tableid is for SC table
if ((TableID::PF_EIT == cached_tableid) || (TableID::PF_EITo
== cached_tableid))
{
// Already seen a PF table
hitCnt++;
return false;
}
else if ((cached_tableid & 0x0f) == (tableid & 0x0f))
{
// Already seen in this segment of the table so check
version
// and update if it has changed
if ((kVersionInvalid == cached_version) ||
(cached_version < version) ||
((kVersionMax == cached_version) && (version <
kVersionMax)))
{
LOG(VB_EIT, LOG_INFO, LOC + QString("SC table version
change - new (%1 %2) old (%3 %4) eventid %5 for chanid %6")
.arg(QString().sprintf("%02x",
tableid)).arg(QString().sprintf("%02x", version))
.arg(QString().sprintf("%02x",
cached_tableid)).arg(QString().sprintf("%02x", cached_version))
.arg(eventid).arg(chanid));
verChgCnt++;
bEntryUpdated = true;
if (cached_endtime != endtime)
bEventMayCauseReschedule = true;
}
else
{
// EIT data previously seen
hitCnt++;
return false;
}
}
else if ((cached_tableid & 0x0f) > (tableid < 0x0f))
{
LOG(VB_EIT, LOG_INFO, LOC + QString("SC tableid change -
new (%1 %2) old (%3 %4) eventid %5 for chanid %6")
.arg(QString().sprintf("%02x",
tableid)).arg(QString().sprintf("%02x", version))
.arg(QString().sprintf("%02x",
cached_tableid)).arg(QString().sprintf("%02x", cached_version))
.arg(eventid).arg(chanid));
bEntryUpdated = true;
if (cached_endtime != endtime)
bEventMayCauseReschedule = true;
}
else
{
// Already seen this segment of SC table
hitCnt++;
return false;
}
}
}
else
bEventMayCauseReschedule = true;
if (bEntryUpdated)
LOG(VB_EIT, LOG_INFO, LOC + QString("Updated entry - table (%1 %2)
eventid %3 for chanid %4 reschedule %5")
.arg(QString().sprintf("%02x",
tableid)).arg(QString().sprintf("%02x", version))
.arg(eventid).arg(chanid).arg(bEventMayCauseReschedule));
else
LOG(VB_EIT, LOG_INFO, LOC + QString("New entry - table (%1 %2)
eventid %3 for chanid %4 reschedule %5")
.arg(QString().sprintf("%02x",
tableid)).arg(QString().sprintf("%02x", version))
.arg(eventid).arg(chanid).arg(bEventMayCauseReschedule));
eventMap->insert(eventid, construct_sig(tableid, version, endtime,
true));
entryCnt++;
return true;
}
}}}
I will attach the full patch when it has run for a bit.
The new patch always updates the listings database with new data. It will
only request a reschedule when the endtime has changed (checked in
EITCache::IsNewEIT) and the change is for a programid and seriesid of a
rule in the recording rules table (checked in DBEventEIT::UpdateDB) as
below.
{{{
if (eventMayCauseReschedule)
{
MSqlQuery localquery(MSqlQuery::InitCon());
localquery.prepare("SELECT EXISTS(SELECT * FROM record WHERE
seriesid = :SERIESID AND programid = :PROGRAMID)");
localquery.bindValue(":SERIESID", seriesId);
localquery.bindValue(":PROGRAMID", programId);
if (!localquery.exec())
MythDB::DBError("AddEIT", query);
if (query.next())
if (!query.value(0).toBool())
RescheduleRequired = true;
LOG(VB_EIT, LOG_INFO,
LOC + QString("Checking reschedule - required
%1").arg(RescheduleRequired));
}
}}}
Roger
--
Ticket URL: <http://code.mythtv.org/trac/ticket/11399#comment:4>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
More information about the mythtv-commits
mailing list