diff options
author | Jirka Novak <j.novak@netsystem.cz> | 2019-10-31 23:14:52 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2019-11-03 11:12:30 +0000 |
commit | 0f35832fce91d4202f788939056d47d6abf2feb3 (patch) | |
tree | 52214e3396f012b3ec5c2b7199326b7308008114 /ui/qt/rtp_analysis_dialog.cpp | |
parent | 14fde2fcf439b04c20684428e755b2375c22d540 (diff) |
rtp_analysis_dialog: save as au: fix for streams with multiple codecs
When the stream contains a mix of G.711A/U and silence, the RTP Analysis dialog
prevented it from being saved. Add an exception for silence to fix this.
Change-Id: I46bb1392244ff0ba300c371fb5ccd110fbd59a7e
Reviewed-on: https://code.wireshark.org/review/34901
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'ui/qt/rtp_analysis_dialog.cpp')
-rw-r--r-- | ui/qt/rtp_analysis_dialog.cpp | 27 |
1 files changed, 23 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; } |