mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
eitd/sectionsd.cpp: remove duplicate sections check, which also in DMX::getSection
This commit is contained in:
@@ -68,6 +68,7 @@
|
||||
// Zeit die fuer die gewartet wird, bevor der Filter weitergeschaltet wird, falls es automatisch nicht klappt
|
||||
#define TIME_EIT_SKIPPING 90
|
||||
|
||||
#define ENABLE_FREESATEPG // FIXME
|
||||
#ifdef ENABLE_FREESATEPG
|
||||
// a little more time for freesat epg
|
||||
#define TIME_FSEIT_SKIPPING 240
|
||||
@@ -2965,7 +2966,6 @@ int eit_stop_update_filter(int *fd)
|
||||
static void *fseitThread(void *)
|
||||
{
|
||||
|
||||
struct SI_section_header *header;
|
||||
/* we are holding the start_stop lock during this timeout, so don't
|
||||
make it too long... */
|
||||
unsigned timeoutInMSeconds = EIT_READ_TIMEOUT;
|
||||
@@ -2983,7 +2983,7 @@ static void *fseitThread(void *)
|
||||
|
||||
dprintf("[%sThread] pid %d (%lu) start\n", "fseit", getpid(), pthread_self());
|
||||
int timeoutsDMX = 0;
|
||||
char *static_buf = new char[MAX_SECTION_LENGTH];
|
||||
uint8_t *static_buf = new uint8_t[MAX_SECTION_LENGTH];
|
||||
int rc;
|
||||
|
||||
if (static_buf == NULL)
|
||||
@@ -3099,31 +3099,11 @@ static void *fseitThread(void *)
|
||||
unlockMessaging();
|
||||
}
|
||||
|
||||
if (rc <= (int)sizeof(struct SI_section_header))
|
||||
{
|
||||
xprintf("%s rc < sizeof(SI_Section_header) (%d < %d)\n", __FUNCTION__, rc, sizeof(struct SI_section_header));
|
||||
continue;
|
||||
}
|
||||
|
||||
header = (SI_section_header*)static_buf;
|
||||
unsigned short section_length = header->section_length_hi << 8 | header->section_length_lo;
|
||||
|
||||
|
||||
|
||||
if ((header->current_next_indicator) && (!dmxFSEIT.real_pauseCounter ))
|
||||
{
|
||||
// Wir wollen nur aktuelle sections
|
||||
|
||||
// Houdini: added new constructor where the buffer is given as a parameter and must be allocated outside
|
||||
// -> no allocation and copy of data into a 2nd buffer
|
||||
// SIsectionEIT eit(SIsection(section_length + 3, buf));
|
||||
SIsectionEIT eit(section_length + 3, static_buf);
|
||||
SIsectionEIT eit(static_buf);
|
||||
// Houdini: if section is not parsed (too short) -> no need to check events
|
||||
if (eit.is_parsed() && eit.header())
|
||||
{
|
||||
// == 0 -> kein event
|
||||
|
||||
//dprintf("[eitThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), header.table_id);
|
||||
//dprintf("[eitThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId());
|
||||
zeit = time(NULL);
|
||||
// Nicht alle Events speichern
|
||||
for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); e++)
|
||||
@@ -3133,7 +3113,6 @@ static void *fseitThread(void *)
|
||||
if ( ( e->times.begin()->startzeit < zeit + secondsToCache ) &&
|
||||
( ( e->times.begin()->startzeit + (long)e->times.begin()->dauer ) > zeit - oldEventsAre ) )
|
||||
{
|
||||
//fprintf(stderr, "%02x ", header.table_id);
|
||||
addEvent(*e, zeit);
|
||||
}
|
||||
}
|
||||
@@ -3159,14 +3138,8 @@ static void *fseitThread(void *)
|
||||
} // for
|
||||
//dprintf("[eitThread] added %d events (end)\n", eit.events().size());
|
||||
} // if
|
||||
} // if
|
||||
else
|
||||
{
|
||||
delete[] static_buf;
|
||||
|
||||
//dprintf("[eitThread] skipped sections for table 0x%x\n", header.table_id);
|
||||
}
|
||||
} // for
|
||||
delete[] static_buf;
|
||||
dputs("[freesatEitThread] end");
|
||||
|
||||
pthread_exit(NULL);
|
||||
@@ -3180,7 +3153,6 @@ static void *fseitThread(void *)
|
||||
static void *eitThread(void *)
|
||||
{
|
||||
|
||||
struct SI_section_header *header;
|
||||
/* we are holding the start_stop lock during this timeout, so don't
|
||||
make it too long... */
|
||||
unsigned timeoutInMSeconds = EIT_READ_TIMEOUT;
|
||||
@@ -3338,28 +3310,16 @@ static void *eitThread(void *)
|
||||
if (rc < 0)
|
||||
continue;
|
||||
|
||||
if (rc < (int)sizeof(struct SI_section_header))
|
||||
{
|
||||
xprintf("%s rc < sizeof(SI_Section_header) (%d < %d)\n", __FUNCTION__, rc, sizeof(struct SI_section_header));
|
||||
continue;
|
||||
}
|
||||
|
||||
header = (SI_section_header*)static_buf;
|
||||
unsigned short section_length = header->section_length_hi << 8 | header->section_length_lo;
|
||||
|
||||
if(sectionsd_stop)
|
||||
break;
|
||||
|
||||
//FIXME DMX check this already
|
||||
if (header->current_next_indicator)
|
||||
{
|
||||
SIsectionEIT eit(section_length + 3, static_buf);
|
||||
SIsectionEIT eit(static_buf);
|
||||
// Houdini: if section is not parsed (too short) -> no need to check events
|
||||
if (eit.is_parsed() && eit.header())
|
||||
{
|
||||
// == 0 -> kein event
|
||||
|
||||
/* dprintf("[eitThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), header.table_id);*/
|
||||
dprintf("[eitThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId());
|
||||
zeit = time(NULL);
|
||||
// Nicht alle Events speichern
|
||||
for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); e++)
|
||||
@@ -3369,10 +3329,9 @@ static void *eitThread(void *)
|
||||
if ( ( e->times.begin()->startzeit < zeit + secondsToCache ) &&
|
||||
( ( e->times.begin()->startzeit + (long)e->times.begin()->dauer ) > zeit - oldEventsAre ) )
|
||||
{
|
||||
//fprintf(stderr, "%02x ", header.table_id);
|
||||
if(sectionsd_stop)
|
||||
break;
|
||||
//printf("Adding event 0x%llx table %x version %x running %d\n", e->uniqueKey(), header->table_id, header->version_number, e->runningStatus());
|
||||
//printf("Adding event 0x%llx table %x version %x running %d\n", e->uniqueKey(), eit.getTableId(), eit.getVersionNumber(), e->runningStatus());
|
||||
addEvent(*e, zeit);
|
||||
}
|
||||
}
|
||||
@@ -3398,11 +3357,6 @@ static void *eitThread(void *)
|
||||
} // for
|
||||
//dprintf("[eitThread] added %d events (end)\n", eit.events().size());
|
||||
} // if
|
||||
} // if
|
||||
else
|
||||
{
|
||||
dprintf("[eitThread] skipped sections for table 0x%x\n", header->table_id);
|
||||
}
|
||||
} // for
|
||||
delete[] static_buf;
|
||||
|
||||
@@ -3416,8 +3370,6 @@ static void *eitThread(void *)
|
||||
//---------------------------------------------------------------------
|
||||
static void *cnThread(void *)
|
||||
{
|
||||
|
||||
struct SI_section_header *header;
|
||||
/* we are holding the start_stop lock during this timeout, so don't
|
||||
make it too long... */
|
||||
unsigned timeoutInMSeconds = EIT_READ_TIMEOUT;
|
||||
@@ -3602,30 +3554,12 @@ static void *cnThread(void *)
|
||||
if (rc < 0)
|
||||
continue;
|
||||
|
||||
//FIXME getSection check len
|
||||
if (rc < (int)sizeof(struct SI_section_header))
|
||||
{
|
||||
xprintf("%s: rc < sizeof(SI_Section_header) (%d < %d)\n", __FUNCTION__, rc, sizeof(struct SI_section_header));
|
||||
continue;
|
||||
}
|
||||
|
||||
header = (SI_section_header *)static_buf;
|
||||
unsigned short section_length = (header->section_length_hi << 8) | header->section_length_lo;
|
||||
|
||||
if (!header->current_next_indicator)
|
||||
{
|
||||
// Wir wollen nur aktuelle sections
|
||||
//dprintf("[cnThread] skipped sections for table 0x%x\n", header->table_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
SIsectionEIT eit(section_length + 3, static_buf);
|
||||
SIsectionEIT eit(static_buf);
|
||||
// Houdini: if section is not parsed (too short) -> no need to check events
|
||||
if (!eit.is_parsed() || !eit.header())
|
||||
continue;
|
||||
|
||||
// == 0 -> kein event
|
||||
//dprintf("[cnThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), header->table_id);
|
||||
//dprintf("[cnThread] adding %d events [table 0x%x] (begin)\n", eit.events().size(), eit.getTableId());
|
||||
zeit = time(NULL);
|
||||
// Nicht alle Events speichern
|
||||
for (SIevents::iterator e = eit.events().begin(); e != eit.events().end(); e++)
|
||||
|
Reference in New Issue
Block a user