From: Jaroslav Kysela Date: Sun, 17 Dec 2017 18:14:17 +0000 (+0100) Subject: epggrab, eit: fixes for the last changes, it's working now X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c807dd7f1d28584cf0420349078463383faf820;p=thirdparty%2Ftvheadend.git epggrab, eit: fixes for the last changes, it's working now --- diff --git a/src/epggrab.c b/src/epggrab.c index 3d3276e0a..d6b0cbb03 100644 --- a/src/epggrab.c +++ b/src/epggrab.c @@ -158,7 +158,6 @@ static void *_epggrab_data_thread( void *aux ) epggrab_module_t *mod; epggrab_queued_data_t *eq; - /* Time for other jobs */ while (atomic_get(&epggrab_running)) { pthread_mutex_lock(&epggrab_data_mutex); do { @@ -172,10 +171,8 @@ static void *_epggrab_data_thread( void *aux ) TAILQ_REMOVE(&epggrab_data_modules, mod, qlink); } } - if (eq == NULL) { - while (atomic_get(&epggrab_running)) - pthread_cond_wait(&epggrab_data_cond, &epggrab_data_mutex); - } + if (eq == NULL) + pthread_cond_wait(&epggrab_data_cond, &epggrab_data_mutex); } while (eq == NULL && atomic_get(&epggrab_running)); pthread_mutex_unlock(&epggrab_data_mutex); if (eq) { @@ -217,11 +214,11 @@ void epggrab_queue_data(epggrab_module_t *mod, memcpy(eq->eq_data + len1, data2, len2); memoryinfo_alloc(&epggrab_data_memoryinfo, len); pthread_mutex_lock(&epggrab_data_mutex); - TAILQ_INSERT_TAIL(&mod->data_queue, eq, eq_link); if (TAILQ_EMPTY(&mod->data_queue)) { pthread_cond_signal(&epggrab_data_cond); TAILQ_INSERT_TAIL(&epggrab_data_modules, mod, qlink); } + TAILQ_INSERT_TAIL(&mod->data_queue, eq, eq_link); pthread_mutex_unlock(&epggrab_data_mutex); } @@ -492,7 +489,9 @@ void epggrab_init ( void ) epggrab_cron_multi = NULL; pthread_mutex_init(&epggrab_mutex, NULL); + pthread_mutex_init(&epggrab_data_mutex, NULL); pthread_cond_init(&epggrab_cond, NULL); + pthread_cond_init(&epggrab_data_cond, NULL); TAILQ_INIT(&epggrab_data_modules); diff --git a/src/epggrab/module/eit.c b/src/epggrab/module/eit.c index e05b0288a..51a5dd0e4 100644 --- a/src/epggrab/module/eit.c +++ b/src/epggrab/module/eit.c @@ -727,18 +727,18 @@ static int _eit_process_event mpegts_service_t *svc; channel_t *ch; eit_event_t ev; - const uint8_t *ptr = ptr0; - int r, len = len0; + const uint8_t *ptr; + int r, len; uint8_t dtag, dlen; int dllen; - if (len < 12) return -1; + if (len0 < 12) return -1; - dllen = ((ptr[10] & 0x0f) << 8) | ptr[11]; - len0 -= 12; - ptr0 += 12; + dllen = ((ptr0[10] & 0x0f) << 8) | ptr0[11]; + len = len0 - 12; + ptr = ptr0 + 12; - if (len0 < dllen) return -1; + if (len < dllen) return -1; memset(&ev, 0, sizeof(ev)); while (dllen > 2) { @@ -820,7 +820,7 @@ static int _eit_process_event if (ilm) return -1; - return 12 + (((ptr[10] & 0x0f) << 8) | ptr[11]); + return 12 + (((ptr0[10] & 0x0f) << 8) | ptr0[11]); } static void