From ca621a9c6bacffde100a54826f1395b1a40b18a1 Mon Sep 17 00:00:00 2001 From: gixxpunk Date: Sun, 5 Jun 2011 10:40:33 +0000 Subject: [PATCH] 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: https://github.com/neutrino-images/ni-neutrino/commit/f8192e17c64910552262982c3d37086ff1a9f503 Author: gixxpunk 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 --- src/sectionsd/sectionsd.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/sectionsd/sectionsd.cpp b/src/sectionsd/sectionsd.cpp index a0d86f72e..d6e8e7859 100644 --- a/src/sectionsd/sectionsd.cpp +++ b/src/sectionsd/sectionsd.cpp @@ -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(); t_channel_id e_chid = e->get_channel_id(); 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 */ e->eventID = 0xFFFF; /* lowest order sort criteria is eventID */ /* 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? */ if (x_key == e_key) continue; - if ((*x)->times.begin()->startzeit > start_time) + if ((*x)->times.begin()->startzeit >= end_time) continue; - /* iterating backwards: if the starttime of the stored events - * is earlier than the new one, we'll never find an identical one - * => bail out */ - if ((*x)->times.begin()->startzeit < start_time) + /* iterating backwards: if the endtime of the stored events + * is earlier than the starttime of the new one, we'll never + * find an identical one => bail out */ + if ((*x)->times.begin()->startzeit + (long)(*x)->times.begin()->dauer <= start_time) break; - /* here we have (*x)->times.begin()->startzeit == start_time */ - 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; - } + /* here we have an overlapping event */ dprintf("%s: delete 0x%016llx.%02x time = 0x%016llx.%02x\n", __func__, x_key, (*x)->table_id, e_key, e->table_id); to_delete.push_back(x_key); @@ -1272,6 +1264,7 @@ static void removeOldEvents(const long seconds) return; } +#if 0 /* Remove duplicate events (same Service, same start and endtime) * with different eventID. Use the one from the lower table_id. * This routine could be extended to remove overlapping events also, @@ -1342,6 +1335,7 @@ static void removeDupEvents(void) return; } +#endif #ifdef UPDATE_NETWORKS static void removeWasteEvents() @@ -8391,11 +8385,13 @@ static void *cnThread(void *) unlockEvents(); // usleep(100); // lockEvents(); +#if 0 removeDupEvents(); readLockEvents(); printf("[sectionsd] Removed %d dup events.\n", anzEventsAlt - mySIeventsOrderUniqueKey.size()); anzEventsAlt = mySIeventsOrderUniqueKey.size(); unlockEvents(); +#endif dprintf("before removewasteepg\n"); #ifdef UPDATE_NETWORKS removeWasteEvents(); // Events for channels not in services.xml