Qt: fix crash on undecodable RTP stream

When the sample rate is zero, a floating point exception (FPE) occurs in
QAudioDeviceInfo::nearestFormat. Detect the error condition instead and
show an error.

Change-Id: Ie2eaa57847938fe15607fa26d0f4e08e7ddd23d1
Fixes: v2.3.0rc0-1664-gd59653f8d5 ("Qt: Make the RTP player output device selectable.")
Reviewed-on: https://code.wireshark.org/review/19569
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Peter Wu 2017-01-06 23:17:19 +01:00 committed by Michael Mann
parent 082ba063ef
commit 6e29d874f8
2 changed files with 9 additions and 1 deletions

View File

@ -549,6 +549,11 @@ void RtpAudioStream::startPlaying()
{
if (audio_output_) return;
if (audio_out_rate_ == 0) {
emit playbackError(tr("RTP stream is empty or codec is unsupported."));
return;
}
QAudioDeviceInfo cur_out_device = QAudioDeviceInfo::defaultOutputDevice();
QString cur_out_name = parent()->property("currentOutputDeviceName").toString();
foreach (QAudioDeviceInfo out_device, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {

View File

@ -99,7 +99,10 @@ private slots:
void resetXAxis();
void setPlayPosition(double secs);
void setPlaybackError(const QString playback_error) { playback_error_ = playback_error; }
void setPlaybackError(const QString playback_error) {
playback_error_ = playback_error;
updateHintLabel();
}
void on_playButton_clicked();
void on_stopButton_clicked();
void on_actionReset_triggered();