aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/qt/rtp_analysis_dialog.cpp27
-rw-r--r--ui/tap-rtp-common.c5
-rw-r--r--ui/tap-rtp-common.h7
3 files changed, 35 insertions, 4 deletions
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp
index f82fbe834a..9e1c1ffaed 100644
--- a/ui/qt/rtp_analysis_dialog.cpp
+++ b/ui/qt/rtp_analysis_dialog.cpp
@@ -1414,6 +1414,8 @@ void RtpAnalysisDialog::saveAudio(RtpAnalysisDialog::StreamDirection direction,
ui->progressFrame->showProgress(true, true, &stop_flag);
if (save_format == save_audio_au_) { /* au format */
+ bool showPayloadWarning = TRUE;
+
if ((fwd_statinfo_.rtp_stats.clock_rate != 8000) ||
((rev_statinfo_.rtp_stats.clock_rate != 0) && (rev_statinfo_.rtp_stats.clock_rate != 8000))
) {
@@ -1421,10 +1423,27 @@ void RtpAnalysisDialog::saveAudio(RtpAnalysisDialog::StreamDirection direction,
goto copy_file_err;
}
- if (((fwd_statinfo_.first_payload_type != PT_PCMU) && (fwd_statinfo_.first_payload_type != PT_PCMA)) ||
- ((rev_statinfo_.rtp_stats.clock_rate != 0) &&
- ((rev_statinfo_.first_payload_type != PT_PCMU) && (rev_statinfo_.first_payload_type != PT_PCMA)))) {
- QMessageBox::warning(this, tr("Warning"), tr("Can save audio with PCM u-law or A-law encoding only"));
+ /* Check for supported codecs */
+ if (rtpstream_is_payload_used(&fwd_statinfo_, PT_PCMU)) { showPayloadWarning=FALSE; }
+ if (rtpstream_is_payload_used(&fwd_statinfo_, PT_PCMA)) { showPayloadWarning=FALSE; }
+ /* ED-137 silence */
+ if (rtpstream_is_payload_used(&fwd_statinfo_, PT_UNDF_123)) { showPayloadWarning=FALSE; }
+ if (rev_statinfo_.rtp_stats.clock_rate != 0)
+ { /* Reverse stream is defined */
+ bool showRevPayloadWarning = TRUE;
+
+ /* Check for supported codecs */
+ if (rtpstream_is_payload_used(&rev_statinfo_, PT_PCMU)) { showRevPayloadWarning=FALSE; }
+ if (rtpstream_is_payload_used(&rev_statinfo_, PT_PCMA)) { showRevPayloadWarning=FALSE; }
+ /* ED-137 silence */
+ if (rtpstream_is_payload_used(&rev_statinfo_, PT_UNDF_123)) { showRevPayloadWarning=FALSE; }
+ if (showRevPayloadWarning) { showPayloadWarning=TRUE; }
+ }
+
+ /* If unsupported coded is used, warn user */
+ if (showPayloadWarning)
+ {
+ QMessageBox::warning(this, tr("Error"), tr("Can save audio with PCM u-law or A-law encoding only"));
goto copy_file_err;
}
diff --git a/ui/tap-rtp-common.c b/ui/tap-rtp-common.c
index d8d04f1583..175592d7f6 100644
--- a/ui/tap-rtp-common.c
+++ b/ui/tap-rtp-common.c
@@ -285,6 +285,11 @@ static void update_payload_names(rtpstream_info_t *stream_info, const struct _rt
g_string_free(payload_type_names, FALSE);
}
+gboolean rtpstream_is_payload_used(const rtpstream_info_t *stream_info, const guint8 payload_type)
+{
+ return stream_info->payload_type_names[payload_type] != NULL;
+}
+
#define RTPFILE_VERSION "1.0"
/*
diff --git a/ui/tap-rtp-common.h b/ui/tap-rtp-common.h
index a51264224f..4ac6d03e3d 100644
--- a/ui/tap-rtp-common.h
+++ b/ui/tap-rtp-common.h
@@ -94,6 +94,13 @@ gint rtpstream_info_cmp(gconstpointer aa, gconstpointer bb);
*/
gboolean rtpstream_info_is_reverse(const rtpstream_info_t *stream_a, rtpstream_info_t *stream_b);
+/**
+ * Checks if payload_type is used in rtpstream.
+ *
+ * @returns TRUE if is used
+ */
+gboolean rtpstream_is_payload_used(const rtpstream_info_t *stream_info, const guint8 payload_type);
+
/****************************************************************************/
/* INTERFACE */