White space changes.
[obnox/wireshark/wip.git] / tap-rtp-common.c
index 0ef5008f02a3e26063aa3de02abf275c6c55f0e0..206fd61db04733005520ddf6501f481ff743411b 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright 2008, Ericsson AB
  * By Balint Reczey <balint.reczey@ericsson.com>
  *
- * most functions are copied from gtk/rtp_stream.c and gtk/rtp_analisys.c
+ * most functions are copied from ui/gtk/rtp_stream.c and ui/gtk/rtp_analisys.c
  * Copyright 2003, Alcatel Business Systems
  * By Lars Ruoff <lars.ruoff@gmx.net>
  *
 #include "globals.h"
 
 #include <epan/tap.h>
-#include "register.h"
 #include <string.h>
 #include <epan/rtp_pt.h>
 #include <epan/addr_resolv.h>
 #include <epan/dissectors/packet-rtp.h>
-#include "gtk/rtp_stream.h"
+#include "ui/gtk/rtp_stream.h"
 #include "tap-rtp-common.h"
 
-
+/* XXX: are changes needed to properly handle situations where
+        info_all_data_present == FALSE ?
+        E.G., when captured frames are truncated.
+ */
 
 /****************************************************************************/
 /* GCompareFunc style comparison function for _rtp_stream_info */
@@ -295,9 +297,7 @@ int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
                        rtp_write_sample(&sample, tapinfo->save_file);
                }
        }
-       /* TODO: This doesn't belong here. We really shouldn't refer to cf_mark_frame()
-        * which only make sense if we're using the GTK UI backend. This effectively forces
-        * tshark/rawshark to implement a cf_mark_frame() stub */
+#ifdef __GTK_H__
        else if (tapinfo->mode == TAP_MARK) {
                if (rtp_stream_info_cmp(&tmp_strinfo, tapinfo->filter_stream_fwd)==0
                        || rtp_stream_info_cmp(&tmp_strinfo, tapinfo->filter_stream_rev)==0)
@@ -305,7 +305,7 @@ int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
                        cf_mark_frame(&cfile, pinfo->fd);
                }
        }
-
+#endif
        return 0;
 }
 
@@ -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;