Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
timeshift: cosmetic trace log updates
  • Loading branch information
perexg committed Dec 12, 2015
1 parent 05b5bed commit 3663e29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/timeshift.c
Expand Up @@ -268,7 +268,7 @@ static void timeshift_input
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 %zu",
" dts %10"PRId64" dur %10d len %6zu",
ts->id,
pkt->pkt_componentindex,
pkt_frametype_to_char(pkt->pkt_frametype),
Expand Down Expand Up @@ -304,14 +304,15 @@ static void timeshift_input
if (sm->sm_type == SMT_PACKET) {
tvhtrace("timeshift",
"ts %d pkt buf - stream %d type %c pts %10"PRId64
" dts %10"PRId64" dur %10d len %zu",
" dts %10"PRId64" dur %10d len %6zu time %14"PRId64,
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));
pktbuf_len(pkt->pkt_payload),
sm->sm_time);
}
streaming_target_deliver2(&ts->wr_queue.sq_st, sm);
} else
Expand Down
14 changes: 5 additions & 9 deletions src/timeshift/timeshift_reader.c
Expand Up @@ -352,26 +352,22 @@ static int _timeshift_read
if (tsf->rfd < 0)
return -1;
}
tvhtrace("timeshift", "ts %d seek to %jd (fd %i)", ts->id, (intmax_t)tsf->roff, tsf->rfd);
if (tsf->rfd >= 0)
if ((off = lseek(tsf->rfd, tsf->roff, SEEK_SET)) != tsf->roff)
tvherror("timeshift", "seek to %s failed (off %"PRId64" != %"PRId64"): %s",
tsf->path, (int64_t)tsf->roff, (int64_t)off, strerror(errno));
tvherror("timeshift", "ts %d seek to %s failed (off %"PRId64" != %"PRId64"): %s",
ts->id, tsf->path, (int64_t)tsf->roff, (int64_t)off, strerror(errno));

/* Read msg */
ooff = tsf->roff;
r = _read_msg(tsf, -1, sm);
if (r < 0) {
streaming_message_t *e = streaming_msg_create_code(SMT_STOP, SM_CODE_UNDEFINED_ERROR);
streaming_target_deliver2(ts->output, e);
tvhtrace("timeshift", "ts %d seek to %jd (fd %i)", ts->id, (intmax_t)tsf->roff, tsf->rfd);
tvhlog(LOG_ERR, "timeshift", "ts %d could not read buffer", ts->id);
return -1;
}
#if ENABLE_ANDROID
tvhtrace("timeshift", "ts %d read msg %p (%ld)", ts->id, *sm, (long int)r); // Android bug, ssize_t is long int
#else
tvhtrace("timeshift", "ts %d read msg %p (%zd)", ts->id, *sm, r);
#endif
tvhtrace("timeshift", "ts %d seek to %jd (fd %i) read msg %p (%"PRId64")", ts->id, (intmax_t)tsf->roff, tsf->rfd, *sm, (int64_t)r);

/* Incomplete */
if (r == 0) {
Expand Down Expand Up @@ -774,7 +770,7 @@ void *timeshift_reader ( void *p )
th_pkt_t *pkt = sm->sm_data;
tvhtrace("timeshift",
"ts %d pkt out - stream %d type %c pts %10"PRId64
" dts %10"PRId64 " dur %10d len %zu time %"PRId64,
" dts %10"PRId64 " dur %10d len %6zu time %"PRId64,
ts->id,
pkt->pkt_componentindex,
pkt_frametype_to_char(pkt->pkt_frametype),
Expand Down

0 comments on commit 3663e29

Please sign in to comment.