revert change 1429

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


Origin commit data
------------------
Branch: ni/coolstream
Commit: f9ea5bf74f
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2011-05-16 (Mon, 16 May 2011)



------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2011-05-16 11:09:59 +00:00
parent 7d42c4fc6d
commit f1bc5e2083

View File

@@ -777,19 +777,19 @@ static void addEvent(const SIevent &evt, const unsigned table_id, const time_t z
readLockEvents(); readLockEvents();
MySIeventsOrderUniqueKey::iterator si = mySIeventsOrderUniqueKey.find(evt.uniqueKey()); MySIeventsOrderUniqueKey::iterator si = mySIeventsOrderUniqueKey.find(evt.uniqueKey());
bool already_exists = (si != mySIeventsOrderUniqueKey.end()); bool already_exists = (si != mySIeventsOrderUniqueKey.end());
if (already_exists && ( (evt.table_id == si->second->table_id && evt.version != si->second->version ) || si->second->version == 0xFF ) ) if (already_exists && (evt.table_id < si->second->table_id))
{
//replace event if new version
dprintf("replacing event version old 0x%02x new 0x%02x'\n", si->second->version, evt.version );
already_exists = false;
}
else if (already_exists && (evt.table_id < si->second->table_id))
{ {
/* if the new event has a lower (== more recent) table ID, replace the old one */ /* if the new event has a lower (== more recent) table ID, replace the old one */
already_exists = false; already_exists = false;
dprintf("replacing event %016llx:%02x with %04x:%02x '%.40s'\n", si->second->uniqueKey(), dprintf("replacing event %016llx:%02x with %04x:%02x '%.40s'\n", si->second->uniqueKey(),
si->second->table_id, evt.eventID, evt.table_id, evt.getName().c_str()); si->second->table_id, evt.eventID, evt.table_id, evt.getName().c_str());
} }
else if (already_exists && (evt.table_id == si->second->table_id && evt.version != si->second->version ) )
{
//replace event if new version
dprintf("replacing event version old 0x%02x new 0x%02x'\n", si->second->version, evt.version );
already_exists = false;
}
/* Check size of some descriptors of the new event before comparing /* Check size of some descriptors of the new event before comparing
them with the old ones, because the same event can be complete them with the old ones, because the same event can be complete
@@ -913,35 +913,29 @@ if (slow_addevent)
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;
/* create an event that's surely behind the one to check in the sort order */ bool found = false;
SIevent *fptr = new SIevent(evt); /* experiments have shown that iterating backwards here is much faster */
fptr->eventID = 0xFFFF; /* lowest order sort criteria is eventID */
SIeventPtr f(fptr);
/* returns an iterator that's behind 'f' */
MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator x = MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator x =
mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.upper_bound(f); mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.end();
/* the first decrement of the iterator gives us an event that's a potential
* match *or* from a different channel, then no event for this channel is stored */
while (x != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin()) while (x != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin())
{ {
x--; x--;
if ((*x)->get_channel_id() != e_chid) if ((*x)->get_channel_id() != e_chid)
{
/* sorted by service id first */
if (found)
break; break;
}
else else
{ {
event_id_t x_key = (*x)->uniqueKey(); event_id_t x_key = (*x)->uniqueKey();
found = true;
/* 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 != start_time)
continue; 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)
break;
/* here we have (*x)->times.begin()->startzeit == start_time */
if ((*x)->table_id < e->table_id) if ((*x)->table_id < e->table_id)
{ {
/* if we already have an event with the same start time but a lower /* if we already have an event with the same start time but a lower