debug: added extra debug for deep analysis of packet handling

This commit is contained in:
Adam Sutton 2014-03-04 09:03:30 +00:00
parent 298a9fb299
commit f8855dfa49
3 changed files with 52 additions and 19 deletions

View file

@ -1387,15 +1387,21 @@ parser_deliver(service_t *t, elementary_stream_t *st, th_pkt_t *pkt, int error)
pkt->pkt_pts < t->s_current_pts - 180000))
t->s_current_pts = pkt->pkt_pts;
#if 0
printf("PARSE: %-12s %d %10"PRId64" %10"PRId64" %10d %10d\n",
streaming_component_type2txt(st->es_type),
pkt->pkt_frametype,
pkt->pkt_dts,
pkt->pkt_pts,
pkt->pkt_duration,
pktbuf_len(pkt->pkt_payload));
tvhtrace("parser",
"pkt stream %2d %-12s type %c dts %10"PRId64" pts %10"PRId64
" dur %10d len %10"PRIsize_t,
st->es_index,
streaming_component_type2txt(st->es_type),
pkt_frametype_to_char(pkt->pkt_frametype),
#if 1
ts_rescale(pkt->pkt_pts, 1000000),
ts_rescale(pkt->pkt_dts, 1000000),
#else
pkt->pkt_dts,
pkt->pkt_pts,
#endif
pkt->pkt_duration,
pktbuf_len(pkt->pkt_payload));
pkt->pkt_aspect_num = st->es_aspect_num;
pkt->pkt_aspect_den = st->es_aspect_den;

View file

@ -117,6 +117,7 @@ static void timeshift_input
{
int exit = 0;
timeshift_t *ts = opaque;
th_pkt_t *pkt = sm->sm_data;
pthread_mutex_lock(&ts->state_mutex);
@ -136,6 +137,19 @@ 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 %"PRIsize_t,
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) {
@ -154,7 +168,6 @@ static void timeshift_input
/* Record (one-off) PTS delta */
if (sm->sm_type == SMT_PACKET && ts->pts_delta == PTS_UNSET) {
th_pkt_t *pkt = sm->sm_data;
if (pkt->pkt_pts != PTS_UNSET)
ts->pts_delta = getmonoclock() - ts_rescale(pkt->pkt_pts, 1000000);
}
@ -163,6 +176,18 @@ static void timeshift_input
if ((ts->state > TS_LIVE) || (!ts->ondemand && (ts->state == TS_LIVE))) {
sm->sm_time = getmonoclock();
streaming_target_deliver2(&ts->wr_queue.sq_st, sm);
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 %"PRIsize_t,
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));
}
} else
streaming_msg_free(sm);

View file

@ -731,17 +731,19 @@ void *timeshift_reader ( void *p )
(((cur_speed < 0) && (sm->sm_time >= deliver)) ||
((cur_speed > 0) && (sm->sm_time <= deliver))))) {
#if ENABLE_TRACE
if (skip)
{
time_t pts = 0;
int64_t delta = now - sm->sm_time;
if (sm->sm_type == SMT_PACKET)
pts = ((th_pkt_t*)sm->sm_data)->pkt_pts;
tvhtrace("timeshift", "ts %d deliver %"PRId64" pts=%"PRItime_t " shift=%"PRIu64,
ts->id, sm->sm_time, pts, delta);
if (sm->sm_type == SMT_PACKET) {
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 %"PRIsize_t" time %"PRItime_t,
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), sm->sm_time);
}
#endif
streaming_target_deliver2(ts->output, sm);
last_time = sm->sm_time;
sm = NULL;