aboutsummaryrefslogtreecommitdiffstats
path: root/tap-rtp-common.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2011-07-31 13:25:13 +0000
committerAnders Broman <anders.broman@ericsson.com>2011-07-31 13:25:13 +0000
commit95f2d7215563b73bdb34c8810711407a14136ae2 (patch)
tree5dfe99e84fa161fe1ddbbad0739aa3993ccd528c /tap-rtp-common.c
parent00bf90f82fc804e7551e84d054547db05e6e7328 (diff)
Use pinfo->iphdrlen rather than a fixed vaue of 20 to make
the calculation correct for IPv6 too. svn path=/trunk/; revision=38286
Diffstat (limited to 'tap-rtp-common.c')
-rw-r--r--tap-rtp-common.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tap-rtp-common.c b/tap-rtp-common.c
index 0619e5aaa5..8efbc06ef9 100644
--- a/tap-rtp-common.c
+++ b/tap-rtp-common.c
@@ -636,8 +636,8 @@ int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
statinfo->sumtTS += 1.0 * current_time * nominaltime;
}
- /* Calculate the BW in Kbps adding the IP+UDP header to the RTP -> 20bytes(IP)+8bytes(UDP) = 28bytes */
- statinfo->bw_history[statinfo->bw_index].bytes = rtpinfo->info_data_len + 28;
+ /* Calculate the BW in Kbps adding the IP+UDP header to the RTP -> IP header+8bytes(UDP) */
+ statinfo->bw_history[statinfo->bw_index].bytes = rtpinfo->info_data_len + pinfo->iphdrlen + 8;
statinfo->bw_history[statinfo->bw_index].time = current_time;
/* Check if there are more than 1sec in the history buffer to calculate BW in bps. If so, remove those for the calculation */
@@ -646,7 +646,8 @@ int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
statinfo->bw_start_index++;
if (statinfo->bw_start_index == BUFF_BW) statinfo->bw_start_index=0;
};
- statinfo->total_bytes += rtpinfo->info_data_len + 28;
+ /* IP hdr + UDP + RTP */
+ statinfo->total_bytes += rtpinfo->info_data_len + pinfo->iphdrlen + 8;
statinfo->bandwidth = (double)(statinfo->total_bytes*8)/1000;
statinfo->bw_index++;
if (statinfo->bw_index == BUFF_BW) statinfo->bw_index = 0;