]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
add per stream stats
authorAndreas Öman <andreas@lonelycoder.com>
Wed, 21 Nov 2007 12:44:25 +0000 (12:44 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Wed, 21 Nov 2007 12:44:25 +0000 (12:44 +0000)
pes.c
transports.c
tsdemux.c
tvhead.h

diff --git a/pes.c b/pes.c
index dff7cc36410ce2f1048f2c11b8fa6be3442d7c8d..659183855a7ade72aa9548bec233de95f8a2249a 100644 (file)
--- a/pes.c
+++ b/pes.c
@@ -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);
index 35d60a79440b65353c6c13dc2a7c7799b13d27c3..18041de42fc694630fc1c51482086d20720fc05a 100644 (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;
 }
index 384ebd9e884e767b67cdcef0c4054c24954de6eb..07b263aae72117f11c0b3628da715069815be797 100644 (file)
--- a/tsdemux.c
+++ b/tsdemux.c
@@ -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;
index 48059c5744efd74c27e07a0d004fca704655a134..4b0bdc609f5daa31ea75785f7745b007d677af19 100644 (file)
--- a/tvhead.h
+++ b/tvhead.h
@@ -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;