aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-11-24 00:27:14 +0100
committerPeter Wu <peter@lekensteyn.nl>2016-12-06 17:51:47 +0000
commitf5e22a14877922aa7b907d2e434958c86efd6875 (patch)
tree33439d1a8cd3322faa9ce8b0f6b12a08427d47fb /ui/qt
parentd8cdb550445a1bc86626bd9d45da1ce958d1592b (diff)
codecs: Add support for G.722 and G.726
Integrate the Spandsp library for G.722 and G.726 support. Adds support for G.722 and all eight variants of G.726. Note: this also fixes a crash in Qt (buffer overrun, reading too much data) caused by confusion of the larger output buffer (resample_buff) with the smaller input buffer (decode_buff). It was not triggered before because the sample rate was always 8k, but with the addition of the new codecs, a different sample rate became possible (16k). Fix also a crash which occurs when the RTP_STREAM_DEBUG macro is enabled and the VOIP Calls dialog is opened (the begin frame, start_fd, is not yet known and therfore a NULL dereference could occur). Passes testing (plays normally without bad RTP timing errors) with SampleCaptures files: sip-rtp-g722.pcap and sip-rtp-g726.pcap. Tested with cmake (Qt), autotools (Qt and GTK+) with ASAN enabled. Bug: 5619 Change-Id: I5661908d193927bba50901079119eeff0c04991f Reviewed-on: https://code.wireshark.org/review/18939 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/rtp_audio_stream.cpp10
-rw-r--r--ui/qt/rtp_player_dialog.cpp2
2 files changed, 9 insertions, 3 deletions
diff --git a/ui/qt/rtp_audio_stream.cpp b/ui/qt/rtp_audio_stream.cpp
index 1d8971c1d1..798d73fcbe 100644
--- a/ui/qt/rtp_audio_stream.cpp
+++ b/ui/qt/rtp_audio_stream.cpp
@@ -252,7 +252,13 @@ void RtpAudioStream::decode()
}
last_sequence = rtp_packet->info->info_seq_num;
- double rtp_time = (double)(rtp_packet->info->info_timestamp-start_timestamp)/sample_rate - start_rtp_time;
+ unsigned rtp_clock_rate = sample_rate;
+ if (rtp_packet->info->info_payload_type == PT_G722) {
+ // G.722 sample rate is 16kHz, but RTP clock rate is 8kHz for historic reasons.
+ rtp_clock_rate = 8000;
+ }
+
+ double rtp_time = (double)(rtp_packet->info->info_timestamp-start_timestamp)/rtp_clock_rate - start_rtp_time;
double arrive_time;
if (timing_mode_ == RtpTimestamp) {
arrive_time = rtp_time;
@@ -351,7 +357,7 @@ void RtpAudioStream::decode()
}
speex_resampler_process_int(audio_resampler_, 0, decode_buff, &in_len, resample_buff, &out_len);
- write_buff = (char *) decode_buff;
+ write_buff = (char *) resample_buff;
write_bytes = out_len * sample_bytes_;
}
diff --git a/ui/qt/rtp_player_dialog.cpp b/ui/qt/rtp_player_dialog.cpp
index 100daa1adb..743685c307 100644
--- a/ui/qt/rtp_player_dialog.cpp
+++ b/ui/qt/rtp_player_dialog.cpp
@@ -392,7 +392,7 @@ void RtpPlayerDialog::addRtpStream(struct _rtp_stream_info *rtp_stream)
ui->streamTreeWidget->topLevelItemCount(),
rtp_stream->packet_count,
g_list_length(rtp_stream->rtp_packet_list),
- rtp_stream->start_fd->num);
+ rtp_stream->start_fd ? rtp_stream->start_fd->num : 0);
}
void RtpPlayerDialog::showEvent(QShowEvent *)