summaryrefslogtreecommitdiff
path: root/ui/tap-rtp-common.c
diff options
context:
space:
mode:
authorJiri Novak <j.novak@netsystem.cz>2016-12-13 13:28:30 +0100
committerAnders Broman <a.broman58@gmail.com>2016-12-15 05:16:29 +0000
commit9090afbfe9a4f9a422409c3f9d410bc3c14fc741 (patch)
treeba111a5eee19019502dc31a2095aaf52098d23db /ui/tap-rtp-common.c
parent1afbab69956c32b341001dd20ff667036fe1f8f5 (diff)
downloadwireshark-9090afbfe9a4f9a422409c3f9d410bc3c14fc741.tar.gz
Save RTP audio to file: RTP Stream Analysis dialog allows save audio for non G.711 codecs and mixed codecs
- spaghetti code for save was split into separate functions - code saves G.711 only, all other codecs are saved as silence with correct duration - code is ready to include other codecs - code supports 8000 Hz sampling rate only, other rates are rejected with warning - bidirectional stream (forward and reverse) creates stereo .au file - output is based on timestamps in RTP streams - save operation is slower than before because it is set of seek() - one per each codec sample - code allows align of save audio: - as it is - each stream is saved from its beginning, no aling - to start of each other - later stream is prepended with silence - align saved audio to beginning of capture file - each stream is prepended with silence - save to raw works correctly now - only payload is saved - old code was inserting G.711 silence time to time to raw data Bug: 13242 Change-Id: I74d02a1cc1c75acf9ffe930d078c00a0555cbfb6 Reviewed-on: https://code.wireshark.org/review/19245 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/tap-rtp-common.c')
-rw-r--r--ui/tap-rtp-common.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ui/tap-rtp-common.c b/ui/tap-rtp-common.c
index 75da3edf47..4f39c51891 100644
--- a/ui/tap-rtp-common.c
+++ b/ui/tap-rtp-common.c
@@ -39,6 +39,7 @@
#include <epan/addr_resolv.h>
#include <epan/proto_data.h>
#include <epan/dissectors/packet-rtp.h>
+#include <wsutil/pint.h>
#include "rtp_stream.h"
#include "tap-rtp-common.h"
@@ -591,12 +592,7 @@ rtp_packet_analyse(tap_rtp_stat_t *statinfo,
/* Handle wraparound ? */
arrivaltime = current_time - statinfo->start_time;
- if (statinfo->first_timestamp > rtpinfo->info_timestamp){
- /* Handle wraparound */
- nominaltime = (double)(rtpinfo->info_timestamp + 0xffffffff - statinfo->first_timestamp + 1);
- }else{
- nominaltime = (double)(rtpinfo->info_timestamp - statinfo->first_timestamp);
- }
+ nominaltime = (double)(guint32_wraparound_diff(rtpinfo->info_timestamp, statinfo->first_timestamp));
/* Can only analyze defined sampling rates */
if (clock_rate != 0) {
@@ -669,7 +665,7 @@ rtp_packet_analyse(tap_rtp_stat_t *statinfo,
/* Is it a packet with the mark bit set? */
if (rtpinfo->info_marker_set) {
- statinfo->delta_timestamp = rtpinfo->info_timestamp - statinfo->timestamp;
+ statinfo->delta_timestamp = guint32_wraparound_diff(rtpinfo->info_timestamp, statinfo->timestamp);
if (rtpinfo->info_timestamp > statinfo->timestamp){
statinfo->flags |= STAT_FLAG_MARKER;
}
@@ -714,6 +710,7 @@ rtp_packet_analyse(tap_rtp_stat_t *statinfo,
statinfo->timestamp = rtpinfo->info_timestamp;
statinfo->stop_seq_nr = rtpinfo->info_seq_num;
statinfo->total_nr++;
+ statinfo->last_payload_len = rtpinfo->info_payload_len - rtpinfo->info_padding_count;
return;
}