]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
collect bandwidth statistics on direct subscriptions
authorJohn Törnblom <john.tornblom@gmail.com>
Wed, 9 Jan 2013 15:14:04 +0000 (16:14 +0100)
committerJohn Törnblom <john.tornblom@gmail.com>
Wed, 9 Jan 2013 15:14:04 +0000 (16:14 +0100)
src/subscriptions.c

index 1dc1c844fd294ab7ca38298564fe9a5d390a5032..5dd5837900a8f69cc100306f074a0fa255069079 100644 (file)
@@ -308,6 +308,17 @@ static void
 subscription_input_direct(void *opauqe, streaming_message_t *sm)
 {
   th_subscription_t *s = opauqe;
+
+ if(sm->sm_type == SMT_PACKET) {
+    th_pkt_t *pkt = sm->sm_data;
+    if(pkt->pkt_err)
+      s->ths_total_err++;
+    s->ths_bytes += pkt->pkt_payload->pb_size;
+  } else if(sm->sm_type == SMT_MPEGTS) {
+    pktbuf_t *pb = sm->sm_data;
+    s->ths_bytes += pb->pb_size;
+  }
+
   streaming_target_deliver(s->ths_output, sm);
 }