add per stream stats

This commit is contained in:
Andreas Öman 2007-11-21 12:44:25 +00:00
parent f67adcf3d7
commit b2dbbf9daf
4 changed files with 8 additions and 0 deletions

2
pes.c
View file

@ -82,6 +82,8 @@ pes_packet_input(th_transport_t *t, th_stream_t *st, uint8_t *buf, size_t len)
th_pkt_t *pkt;
AVRational mpeg_tc = {1, 90000};
avgstat_add(&st->st_rate, len, dispatch_clock);
hdr = getu8(buf, len);
flags = getu8(buf, len);
hlen = getu8(buf, len);

View file

@ -374,5 +374,7 @@ transport_add_stream(th_transport_t *t, int pid, tv_streamtype_t type)
TAILQ_INIT(&st->st_durationq);
TAILQ_INIT(&st->st_pktq);
avgstat_init(&st->st_rate, 10);
avgstat_init(&st->st_cc_errors, 10);
return st;
}

View file

@ -122,6 +122,7 @@ ts_recv_packet(th_transport_t *t, int pid, uint8_t *tsb)
if(st->st_cc_valid && cc != st->st_cc) {
/* Incorrect CC */
avgstat_add(&t->tht_cc_errors, 1, dispatch_clock);
avgstat_add(&st->st_cc_errors, 1, dispatch_clock);
err = 1;
}
st->st_cc_valid = 1;

View file

@ -247,6 +247,9 @@ typedef struct th_stream {
uint8_t st_cc; /* Last CC */
uint8_t st_cc_valid; /* Is CC valid at all? */
avgstat_t st_cc_errors;
avgstat_t st_rate;
tv_streamtype_t st_type;
int st_demuxer_fd;
int st_index;