From 048856342f289cf1ee80329deda3448d7a5f5630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20T=C3=B6rnblom?= Date: Wed, 9 Jan 2013 16:14:04 +0100 Subject: [PATCH] collect bandwidth statistics on direct subscriptions --- src/subscriptions.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/subscriptions.c b/src/subscriptions.c index 1dc1c844..5dd58379 100644 --- a/src/subscriptions.c +++ b/src/subscriptions.c @@ -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); }