aboutsummaryrefslogtreecommitdiffstats
path: root/tap-rtp-common.c
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2011-07-31 13:25:13 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2011-07-31 13:25:13 +0000
commit8266844a38edd39e30db93037b56ad42c3482a8a (patch)
tree5dfe99e84fa161fe1ddbbad0739aa3993ccd528c /tap-rtp-common.c
parentefd42b3e13f4d7d4015f7c7a4ab3b42848e83e40 (diff)
Use pinfo->iphdrlen rather than a fixed vaue of 20 to make
the calculation correct for IPv6 too. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@38286 f5534014-38df-0310-8fa8-9805f1628bb7
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;