From eea8a5a374fab1ee52834b3cb6e49c050b5b8c23 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 26 Oct 2014 17:07:05 +0100 Subject: [PATCH] tsfix: substitles might have large time gaps, fixes #2423 --- src/plumbing/tsfix.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plumbing/tsfix.c b/src/plumbing/tsfix.c index d296d9f1..7a257292 100644 --- a/src/plumbing/tsfix.c +++ b/src/plumbing/tsfix.c @@ -195,11 +195,22 @@ normalize_ts(tsfix_t *tf, tfstream_t *tfs, th_pkt_t *pkt) return; } } else { + int64_t low = 90000; /* one second */ + int64_t upper = 180000; /* two seconds */ d = dts + tfs->tfs_dts_epoch - tfs->tfs_last_dts_norm; - if(d < 0 || d > 90000) { + if (SCT_ISSUBTITLE(tfs->tfs_type)) { + /* + * special conditions for subtitles, because they may be broadcasted + * with large time gaps + */ + low = PTS_MASK / 2; /* more than 13 hours */ + upper = low - 1; + } - if(d < -PTS_MASK || d > -PTS_MASK + 180000) { + if (d < 0 || d > low) { + + if(d < -PTS_MASK || d > -PTS_MASK + upper) { tfs->tfs_bad_dts++;