]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
tsfix: Fix the decision boundary for ts_diff, handle reference for text subtitles...
authorJaroslav Kysela <perex@perex.cz>
Fri, 24 Oct 2014 06:53:24 +0000 (08:53 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 24 Oct 2014 06:53:24 +0000 (08:53 +0200)
src/plumbing/tsfix.c

index 5aa10c965c0b809cd1331e1a11d0edf758f73923..d296d9f13e86832c09a10a8f70abc48583ac44ef 100644 (file)
@@ -77,7 +77,7 @@ tsfix_ts_diff(int64_t ts1, int64_t ts2)
   ts2 &= PTS_MASK;
 
   r = abs(ts1 - ts2);
-  if (r > (PTS_MASK / 4)) {
+  if (r > (PTS_MASK / 2)) {
     /* try to wrap the lowest value */
     if (ts1 < ts2)
       ts1 += PTS_MASK + 1;
@@ -354,8 +354,13 @@ tsfix_input_packet(tsfix_t *tf, streaming_message_t *sm)
         tf->tf_tsref != PTS_UNSET) {
       int64_t diff = tsfix_ts_diff(tf->tf_tsref, pkt->pkt_dts);
       if (diff > 2 * 90000) {
+        tfstream_t *tfs2;
         tvhwarn("parser", "The timediff for TELETEXT is big (%"PRId64"), using current dts", diff);
         tfs->tfs_local_ref = pkt->pkt_dts;
+        /* Text subtitles extracted from teletext have same timebase */
+        LIST_FOREACH(tfs2, &tf->tf_streams, tfs_link)
+          if(tfs2->tfs_type == SCT_TEXTSUB)
+            tfs2->tfs_local_ref = pkt->pkt_dts;
       } else {
         tfs->tfs_local_ref = tf->tf_tsref;
       }