]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
timeshift: another log fixes and pts_delta initialization
authorJaroslav Kysela <perex@perex.cz>
Fri, 18 Dec 2015 20:37:25 +0000 (21:37 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 20 Dec 2015 09:51:59 +0000 (10:51 +0100)
src/timeshift.c
src/timeshift/timeshift_reader.c

index e0391977a6dc2ef39bff90a33ccf6183c036835e..39550bdf69ee4f599cd4f7348b214392f7e2b934 100644 (file)
@@ -265,19 +265,6 @@ static void timeshift_input
       ts->state  = TS_LIVE;
     }
 
-    if (sm->sm_type == SMT_PACKET) {
-      tvhtrace("timeshift",
-               "ts %d pkt in  - stream %d type %c pts %10"PRId64
-               " dts %10"PRId64" dur %10d len %6zu",
-               ts->id,
-               pkt->pkt_componentindex,
-               pkt_frametype_to_char(pkt->pkt_frametype),
-               ts_rescale(pkt->pkt_pts, 1000000),
-               ts_rescale(pkt->pkt_dts, 1000000),
-               pkt->pkt_duration,
-               pktbuf_len(pkt->pkt_payload));
-    }
-
     /* Pass-thru */
     if (ts->state <= TS_LIVE) {
       if (sm->sm_type == SMT_START) {
@@ -295,7 +282,7 @@ static void timeshift_input
       exit = 1;
 
     /* Record (one-off) PTS delta */
-    if (sm->sm_type == SMT_PACKET && ts->pts_delta == PTS_UNSET)
+    if (sm->sm_type == SMT_PACKET && ts->pts_delta == 0)
       timeshift_set_pts_delta(ts, pkt->pkt_pts);
 
     /* Buffer to disk */
@@ -315,8 +302,21 @@ static void timeshift_input
                  sm->sm_time - ts->pts_delta);
       }
       streaming_target_deliver2(&ts->wr_queue.sq_st, sm);
-    } else
+    } else {
+      if (sm->sm_type == SMT_PACKET) {
+        tvhtrace("timeshift",
+                 "ts %d pkt in  - stream %d type %c pts %10"PRId64
+                 " dts %10"PRId64" dur %10d len %6zu",
+                 ts->id,
+                 pkt->pkt_componentindex,
+                 pkt_frametype_to_char(pkt->pkt_frametype),
+                 ts_rescale(pkt->pkt_pts, 1000000),
+                 ts_rescale(pkt->pkt_dts, 1000000),
+                 pkt->pkt_duration,
+                 pktbuf_len(pkt->pkt_payload));
+      }
       streaming_msg_free(sm);
+    }
 
     /* Exit/Stop */
     if (exit) {
@@ -396,7 +396,7 @@ streaming_target_t *timeshift_create
   ts->vididx     = -1;
   ts->id         = timeshift_index;
   ts->ondemand   = timeshift_conf.ondemand;
-  ts->pts_delta  = PTS_UNSET;
+  ts->pts_delta  = 0;
   for (i = 0; i < ARRAY_SIZE(ts->pts_val); i++)
     ts->pts_val[i] = PTS_UNSET;
   pthread_mutex_init(&ts->rdwr_mutex, NULL);
index aa430d3bfca9f0ae64a01c4cd0dd6fe26ca4bf27..c6b5ce6013339fe2b8ec673347a53a0b207df559 100644 (file)
@@ -594,7 +594,7 @@ void *timeshift_reader ( void *p )
               break;
 
             case SMT_SKIP_ABS_TIME:
-              if (ts->pts_delta == PTS_UNSET) {
+              if (ts->pts_delta == 0) {
                 tvhlog(LOG_ERR, "timeshift", "ts %d abs skip not possible no PTS delta", ts->id);
                 skip = NULL;
                 break;
@@ -760,7 +760,7 @@ void *timeshift_reader ( void *p )
         skip->time = pkt->pkt_pts;
         skip->type = SMT_SKIP_ABS_TIME;
         tvhlog(LOG_DEBUG, "timeshift", "ts %d skip to pts %"PRId64" ok, time %"PRId64,
-               ts->id, skip->time, sm->sm_time - ts->pts_delta);
+               ts->id, ts_rescale(skip->time, 1000000), sm->sm_time - ts->pts_delta);
       } else {
         /* Report error */
         skip->type = SMT_SKIP_ERROR;