sectionsd: improved addEvent-handling. This makes removeDupEvents() obsolete and even beats double events on ServusTV and other broadcasters which do not honor the specs. (Patch by Gauch316 -> http://www.dbox2world.net/board293-coolstream-hd1/board314-coolstream-development/p131104-seife-removedupevents/#post131104)

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1511 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: f8192e17c6
Author: gixxpunk <thomas.harfmann@gmail.com>
Date: 2011-06-05 (Sun, 05 Jun 2011)

Origin message was:
------------------
- sectionsd: improved addEvent-handling. This makes removeDupEvents() obsolete and even beats double events on ServusTV and other broadcasters which do not honor the specs. (Patch by Gauch316 -> http://www.dbox2world.net/board293-coolstream-hd1/board314-coolstream-development/p131104-seife-removedupevents/#post131104)

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1511 e54a6e83-5905-42d5-8d5c-058d10e6a962


------------------
This commit was generated by Migit
This commit is contained in:
gixxpunk
2011-06-05 10:40:33 +00:00
parent 3026833161
commit ca621a9c6b

View File

@@ -917,6 +917,7 @@ static void addEvent(const SIevent &evt, const unsigned table_id, const time_t z
event_id_t e_key = e->uniqueKey(); event_id_t e_key = e->uniqueKey();
t_channel_id e_chid = e->get_channel_id(); t_channel_id e_chid = e->get_channel_id();
time_t start_time = e->times.begin()->startzeit; time_t start_time = e->times.begin()->startzeit;
time_t end_time = e->times.begin()->startzeit + (long)e->times.begin()->dauer;
/* create an event that's surely behind the one to check in the sort order */ /* create an event that's surely behind the one to check in the sort order */
e->eventID = 0xFFFF; /* lowest order sort criteria is eventID */ e->eventID = 0xFFFF; /* lowest order sort criteria is eventID */
/* returns an iterator that's behind 'e' */ /* returns an iterator that's behind 'e' */
@@ -937,23 +938,14 @@ static void addEvent(const SIevent &evt, const unsigned table_id, const time_t z
/* do we need this check? */ /* do we need this check? */
if (x_key == e_key) if (x_key == e_key)
continue; continue;
if ((*x)->times.begin()->startzeit > start_time) if ((*x)->times.begin()->startzeit >= end_time)
continue; continue;
/* iterating backwards: if the starttime of the stored events /* iterating backwards: if the endtime of the stored events
* is earlier than the new one, we'll never find an identical one * is earlier than the starttime of the new one, we'll never
* => bail out */ * find an identical one => bail out */
if ((*x)->times.begin()->startzeit < start_time) if ((*x)->times.begin()->startzeit + (long)(*x)->times.begin()->dauer <= start_time)
break; break;
/* here we have (*x)->times.begin()->startzeit == start_time */ /* here we have an overlapping event */
if ((*x)->table_id < e->table_id)
{
/* if we already have an event with the same start time but a lower
* table ID, there is no need to add this one - it would be removed
* by removeDupEvents() anyway => just return here. */
//dprintf("%s: not added: time==,id!=, table_id %02x<%02x, 0x%016llx 0x%016llx %s\n", __func__, (*x)->table_id, e->table_id, x_key, e_key, (*x)->getName().c_str());
unlockEvents();
return;
}
dprintf("%s: delete 0x%016llx.%02x time = 0x%016llx.%02x\n", __func__, dprintf("%s: delete 0x%016llx.%02x time = 0x%016llx.%02x\n", __func__,
x_key, (*x)->table_id, e_key, e->table_id); x_key, (*x)->table_id, e_key, e->table_id);
to_delete.push_back(x_key); to_delete.push_back(x_key);
@@ -1272,6 +1264,7 @@ static void removeOldEvents(const long seconds)
return; return;
} }
#if 0
/* Remove duplicate events (same Service, same start and endtime) /* Remove duplicate events (same Service, same start and endtime)
* with different eventID. Use the one from the lower table_id. * with different eventID. Use the one from the lower table_id.
* This routine could be extended to remove overlapping events also, * This routine could be extended to remove overlapping events also,
@@ -1342,6 +1335,7 @@ static void removeDupEvents(void)
return; return;
} }
#endif
#ifdef UPDATE_NETWORKS #ifdef UPDATE_NETWORKS
static void removeWasteEvents() static void removeWasteEvents()
@@ -8391,11 +8385,13 @@ static void *cnThread(void *)
unlockEvents(); unlockEvents();
// usleep(100); // usleep(100);
// lockEvents(); // lockEvents();
#if 0
removeDupEvents(); removeDupEvents();
readLockEvents(); readLockEvents();
printf("[sectionsd] Removed %d dup events.\n", anzEventsAlt - mySIeventsOrderUniqueKey.size()); printf("[sectionsd] Removed %d dup events.\n", anzEventsAlt - mySIeventsOrderUniqueKey.size());
anzEventsAlt = mySIeventsOrderUniqueKey.size(); anzEventsAlt = mySIeventsOrderUniqueKey.size();
unlockEvents(); unlockEvents();
#endif
dprintf("before removewasteepg\n"); dprintf("before removewasteepg\n");
#ifdef UPDATE_NETWORKS #ifdef UPDATE_NETWORKS
removeWasteEvents(); // Events for channels not in services.xml removeWasteEvents(); // Events for channels not in services.xml