diff --git a/src/access.c b/src/access.c index 080d6d84..2710ec0f 100644 --- a/src/access.c +++ b/src/access.c @@ -174,7 +174,7 @@ access_verify(const char *username, const char *password, if(ae->ae_username[0] != '*') { /* acl entry requires username to match */ - if(username == NULL) + if(username == NULL || password == NULL) continue; /* Didn't get one */ if(strcmp(ae->ae_username, username) || diff --git a/src/cwc.c b/src/cwc.c index 9e6c24ef..6b38f212 100644 --- a/src/cwc.c +++ b/src/cwc.c @@ -47,7 +47,7 @@ #define TVHEADEND_PROTOCOL_ID 0x6502 #define CWC_KEEPALIVE_INTERVAL 30 -#define CWS_NETMSGSIZE 272 +#define CWS_NETMSGSIZE 362 #define CWS_FIRSTCMDNO 0xe0 /** diff --git a/src/dvr/mkmux.c b/src/dvr/mkmux.c index 54a350ce..1303d69f 100644 --- a/src/dvr/mkmux.c +++ b/src/dvr/mkmux.c @@ -810,10 +810,13 @@ mk_write_frame_i(mk_mux_t *mkm, mk_track *t, th_pkt_t *pkt) int skippable = pkt->pkt_frametype == PKT_B_FRAME; int vkeyframe = SCT_ISVIDEO(t->type) && keyframe; - uint8_t *data; - size_t len; + uint8_t *data = pktbuf_ptr(pkt->pkt_payload); + size_t len = pktbuf_len(pkt->pkt_payload); const int clusersizemax = 2000000; + if(!data || len <= 0) + return; + if(pts == PTS_UNSET) // This is our best guess, it might be wrong but... oh well pts = t->nextpts; @@ -863,10 +866,6 @@ mk_write_frame_i(mk_mux_t *mkm, mk_track *t, th_pkt_t *pkt) addcue(mkm, pts, t->tracknum); } - - data = pktbuf_ptr(pkt->pkt_payload); - len = pktbuf_len(pkt->pkt_payload); - if(t->type == SCT_AAC || t->type == SCT_MP4A) { // Skip ADTS header if(len < 7) diff --git a/src/epg.c b/src/epg.c index c43248a6..168133c2 100644 --- a/src/epg.c +++ b/src/epg.c @@ -274,6 +274,9 @@ epg_event_destroy(event_t *e) { free(e->e_title); free(e->e_desc); + free(e->e_ext_desc); + free(e->e_ext_item); + free(e->e_ext_text); free(e->e_episode.ee_onscreen); LIST_REMOVE(e, e_global_link); free(e); diff --git a/src/htsp.c b/src/htsp.c index 15dd05f4..6c6fcbcb 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -1527,7 +1527,7 @@ const static char frametypearray[PKT_NTYPES] = { static void htsp_stream_deliver(htsp_subscription_t *hs, th_pkt_t *pkt) { - htsmsg_t *m = htsmsg_create_map(), *n; + htsmsg_t *m, *n; htsp_msg_t *hm; htsp_connection_t *htsp = hs->hs_htsp; int64_t ts; @@ -1543,6 +1543,8 @@ htsp_stream_deliver(htsp_subscription_t *hs, th_pkt_t *pkt) pkt_ref_dec(pkt); return; } + + m = htsmsg_create_map(); htsmsg_add_str(m, "method", "muxpkt"); htsmsg_add_u32(m, "subscriptionId", hs->hs_sid); diff --git a/src/webui/webui.c b/src/webui/webui.c index ed69ebdf..9aefb0a5 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -155,10 +155,12 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, th_subscription_t //Check socket status getsockopt(hc->hc_fd, SOL_SOCKET, SO_ERROR, (char *)&err, &errlen); - - //Abort upon socket error, or after 20 seconds of silence - if(err || timeouts >= 20){ - run = 0; + if(err) { + tvhlog(LOG_DEBUG, "webui", "Client hung up, exit streaming"); + run = 0; + }else if(timeouts >= 20) { + tvhlog(LOG_WARNING, "webui", "Timeout waiting for packets"); + run = 0; } } pthread_mutex_unlock(&sq->sq_mutex); @@ -167,13 +169,13 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, th_subscription_t timeouts = 0; //Reset timeout counter TAILQ_REMOVE(&sq->sq_queue, sm, sm_link); + pthread_mutex_unlock(&sq->sq_mutex); switch(sm->sm_type) { case SMT_PACKET: { if(!mkm) break; - pkt_ref_inc(sm->sm_data); run = !mk_mux_write_pkt(mkm, sm->sm_data); sm->sm_data = NULL; @@ -219,7 +221,6 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, th_subscription_t break; } streaming_msg_free(sm); - pthread_mutex_unlock(&sq->sq_mutex); } if(mkm) @@ -376,11 +377,12 @@ http_stream_service(http_connection_t *hc, service_t *service) pthread_mutex_unlock(&global_lock); - http_stream_run(hc, &sq, s); - - pthread_mutex_lock(&global_lock); - subscription_unsubscribe(s); - pthread_mutex_unlock(&global_lock); + if(s) { + http_stream_run(hc, &sq, s); + pthread_mutex_lock(&global_lock); + subscription_unsubscribe(s); + pthread_mutex_unlock(&global_lock); + } globalheaders_destroy(gh); tsfix_destroy(tsfix); @@ -411,11 +413,12 @@ http_stream_channel(http_connection_t *hc, channel_t *ch) 0); pthread_mutex_unlock(&global_lock); - http_stream_run(hc, &sq, s); - - pthread_mutex_lock(&global_lock); - subscription_unsubscribe(s); - pthread_mutex_unlock(&global_lock); + if(s) { + http_stream_run(hc, &sq, s); + pthread_mutex_lock(&global_lock); + subscription_unsubscribe(s); + pthread_mutex_unlock(&global_lock); + } globalheaders_destroy(gh); tsfix_destroy(tsfix);