From: Jaroslav Kysela Date: Fri, 18 Dec 2015 20:37:25 +0000 (+0100) Subject: timeshift: another log fixes and pts_delta initialization X-Git-Tag: v4.2.1~1290 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d5d0526d8e77deed1ecfe4bcc5e6fe9358164fe;p=thirdparty%2Ftvheadend.git timeshift: another log fixes and pts_delta initialization --- diff --git a/src/timeshift.c b/src/timeshift.c index e0391977a..39550bdf6 100644 --- a/src/timeshift.c +++ b/src/timeshift.c @@ -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); diff --git a/src/timeshift/timeshift_reader.c b/src/timeshift/timeshift_reader.c index aa430d3bf..c6b5ce601 100644 --- a/src/timeshift/timeshift_reader.c +++ b/src/timeshift/timeshift_reader.c @@ -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;