]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
tsfix: fix DVBSUB again - a wrong time reference was used to check
authorJaroslav Kysela <perex@perex.cz>
Sat, 17 Oct 2015 19:28:30 +0000 (21:28 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sat, 17 Oct 2015 19:28:30 +0000 (21:28 +0200)
src/plumbing/tsfix.c

index 8dd7eaaefdbb70bfff7b41573b251f4eeb669d90..f4d5d1dca59c811fe5148f611fe579ff4b68decb 100644 (file)
@@ -456,20 +456,22 @@ tsfix_input_packet(tsfix_t *tf, streaming_message_t *sm)
         tfs->tfs_local_ref = tf->tf_tsref;
       }
     } else if (tfs->tfs_type == SCT_DVBSUB) {
-      diff = tsfix_ts_diff(tf->tf_tsref, pkt->pkt_dts);
-      if (diff > 2 * 90000) {
-        LIST_FOREACH(tfs2, &tf->tf_streams, tfs_link) {
-          if(tfs2->tfs_audio && tfs2->tfs_local_ref != PTS_UNSET) {
+      /* find first valid audio stream and check the dts timediffs */
+      LIST_FOREACH(tfs2, &tf->tf_streams, tfs_link)
+        if(tfs2->tfs_audio && tfs2->tfs_last_dts_in != PTS_UNSET) {
+          diff = tsfix_ts_diff(tfs2->tfs_last_dts_in, pkt->pkt_dts);
+          if (diff > 2 * 90000) {
             tvhwarn("parser", "The timediff for DVBSUB is big (%"PRId64"), using audio dts", diff);
             tfs->tfs_parent = tfs2;
-            break;
+            tfs->tfs_local_ref = tfs2->tfs_local_ref;
+          } else {
+            tfs->tfs_local_ref = tf->tf_tsref;
           }
+          break;
         }
-        if (tfs2 == NULL) {
-          pkt_ref_dec(pkt);
-          return;
-        }
-        tfs->tfs_local_ref = tfs2->tfs_local_ref;
+      if (tfs2 == NULL) {
+        pkt_ref_dec(pkt);
+        return;
       }
     } else if (tfs->tfs_type == SCT_TELETEXT) {
       diff = tsfix_ts_diff(tf->tf_tsref, pkt->pkt_dts);