From: Jaroslav Kysela Date: Fri, 12 May 2017 14:56:58 +0000 (+0200) Subject: tsdemux - PCR fix for ffmpeg input X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=edb391944c2dfd93c061674c3576ba6531e62f80;p=thirdparty%2Ftvheadend.git tsdemux - PCR fix for ffmpeg input The PCR clocking in the mpegts stream comming from the ffmpeg is really ugly. There are up to 2 seconds gaps between updates. --- diff --git a/src/input/mpegts/tsdemux.c b/src/input/mpegts/tsdemux.c index b6bdf399b..b0dd02e8a 100644 --- a/src/input/mpegts/tsdemux.c +++ b/src/input/mpegts/tsdemux.c @@ -97,8 +97,8 @@ ts_recv_packet0 pcr |= (uint64_t)tsb2[9] << 1; pcr |= ((uint64_t)tsb2[10] >> 7) & 0x01; /* handle the broken info using candidate variable */ - if (t->s_current_pcr == PTS_UNSET || pts_diff(t->s_current_pcr, pcr) <= 90000 || - (t->s_candidate_pcr != PTS_UNSET && pts_diff(t->s_candidate_pcr, pcr) <= 90000)) { + if (t->s_current_pcr == PTS_UNSET || pts_diff(t->s_current_pcr, pcr) <= 2*90000 || + (t->s_candidate_pcr != PTS_UNSET && pts_diff(t->s_candidate_pcr, pcr) <= 2*90000)) { if (pcr != t->s_current_pcr) { if (t->s_current_pcr == PTS_UNSET) tvhtrace(LS_TS, "%s: PCR initial: %"PRId64, service_nicename((service_t*)t), pcr); diff --git a/src/parsers/parsers.c b/src/parsers/parsers.c index 72976dc75..7b4de558c 100644 --- a/src/parsers/parsers.c +++ b/src/parsers/parsers.c @@ -1835,8 +1835,6 @@ parser_deliver(service_t *t, elementary_stream_t *st, th_pkt_t *pkt) diff = st->es_type == SCT_DVBSUB ? 6*90000 : 3*90000; if (pts_diff(pkt->pkt_pcr, pkt->pkt_pts) > diff) { - printf("%s: PTS and PCR diff is very big (%"PRId64")\n", - service_component_nicename(st), pts_diff(pkt->pkt_pcr, pkt->pkt_pts)); if (tvhlog_limit(&st->es_pcr_log, 2)) tvhwarn(LS_PARSER, "%s: PTS and PCR diff is very big (%"PRId64")", service_component_nicename(st), pts_diff(pkt->pkt_pcr, pkt->pkt_pts)); diff --git a/src/service.c b/src/service.c index a11876a16..5063a8078 100644 --- a/src/service.c +++ b/src/service.c @@ -1070,7 +1070,7 @@ service_create0 static void service_stream_make_nicename(service_t *t, elementary_stream_t *st) { - char buf[200]; + char buf[256]; if(st->es_pid != -1) snprintf(buf, sizeof(buf), "%s: %s @ #%d", service_nicename(t),