Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
timeshift: another log fixes and pts_delta initialization
  • Loading branch information
perexg committed Dec 20, 2015
1 parent c5e2444 commit 9d5d052
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
32 changes: 16 additions & 16 deletions src/timeshift.c
Expand Up @@ -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) {
Expand All @@ -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 */
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/timeshift/timeshift_reader.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9d5d052

Please sign in to comment.