From 92dcf839432119cc3ad30e1903366ee92fd06986 Mon Sep 17 00:00:00 2001 Message-Id: <92dcf839432119cc3ad30e1903366ee92fd06986.1715395271.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 11 Apr 2009 10:33:13 +0100 Subject: [PATCH] rtpmon now reports once a second, rather than based on numbers of packets received. Organization: Straylight/Edgeware From: Richard Kettlewell --- clients/rtpmon.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clients/rtpmon.c b/clients/rtpmon.c index 66e2f01..cf83328 100644 --- a/clients/rtpmon.c +++ b/clients/rtpmon.c @@ -104,13 +104,14 @@ static double rate(unsigned earlier, unsigned later) { * @param n How many frames of audio data we received */ static void frames(const struct timeval *when, size_t n) { + const time_t prev = ring[(ringtail - 1) % RINGSIZE].when.tv_sec; + ring[ringtail].when = *when; ring[ringtail].serial = serial; serial += n; ringtail = (ringtail + 1) % RINGSIZE; - // Report rates every couple of hundred packets - if(!(ringtail & 1023)) { - + // Report once a second + if(prev != when->tv_sec) { if(printf("%8.2f %8.2f %8.2f\n", rate((ringtail - RINGSIZE / 8) % RINGSIZE, (ringtail - 1) % RINGSIZE), -- [mdw]