]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
teletext: avoid to update last_wr_time from TELETEXT packets, fixes #4166
authorJaroslav Kysela <perex@perex.cz>
Thu, 16 Feb 2017 17:07:19 +0000 (18:07 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 16 Feb 2017 17:07:19 +0000 (18:07 +0100)
src/timeshift.c
src/timeshift/private.h

index a36b2c6effc42dfa9bcb81596f1de1589165031f..72c9dc208fd479974fbb9ce5177449c0a4c513d8 100644 (file)
@@ -304,6 +304,19 @@ const idclass_t timeshift_conf_class = {
  * Process a packet
  */
 
+static void
+timeshift_smt_start ( timeshift_t *ts, streaming_start_t *ss )
+{
+  int i;
+
+  /* Update early teletext index */
+  for (i = 0; i < ss->ss_num_components; i++)
+    if (ss->ss_components[i].ssc_type == SCT_TELETEXT) {
+      ts->teletextidx0 = ss->ss_components[i].ssc_index;
+      break;
+    }
+}
+
 static int
 timeshift_packet( timeshift_t *ts, streaming_message_t *sm )
 {
@@ -311,9 +324,12 @@ timeshift_packet( timeshift_t *ts, streaming_message_t *sm )
   int64_t time;
 
   if (pkt->pkt_pts != PTS_UNSET) {
-    time = ts_rescale(pkt->pkt_pts, 1000000);
-    if (ts->last_wr_time < time)
-      ts->last_wr_time = time;
+    /* avoid to update last_wr_time for TELETEXT packets */
+    if (ts->teletextidx0 != pkt->pkt_componentindex) {
+      time = ts_rescale(pkt->pkt_pts, 1000000);
+      if (ts->last_wr_time < time)
+        ts->last_wr_time = time;
+    }
   }
   sm->sm_time = ts->last_wr_time;
   timeshift_packet_log("wr ", ts, sm);
@@ -361,6 +377,9 @@ static void timeshift_input
     else if (type == SMT_MPEGTS)
       ts->packet_mode = 0;
 
+    else if (type == SMT_START)
+      timeshift_smt_start(ts, (streaming_start_t *)sm->sm_data);
+
     /* Send to the writer thread */
     if (ts->packet_mode) {
       sm->sm_time = ts->last_wr_time;
index 416e30c8c835234ec25f33da8a4e96af83edac88..e5fda45143333d059c5db970e38021c03d6dbdc9 100644 (file)
@@ -131,6 +131,7 @@ typedef struct timeshift {
   int                         file_segments; ///< Count of segments in files
 
   int                         vididx;     ///< Index of (current) video stream
+  int                         teletextidx0; ///< Index of (current) teletext stream (EARLY)
   int                         teletextidx; ///< Index of (current) teletext stream
 
   streaming_start_t          *smt_start;  ///< Streaming start info