diff options
Diffstat (limited to 'src/mumble/VoiceRecorderDialog.cpp')
-rw-r--r-- | src/mumble/VoiceRecorderDialog.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mumble/VoiceRecorderDialog.cpp b/src/mumble/VoiceRecorderDialog.cpp index 0f8c1d8c8..bca3d5ee5 100644 --- a/src/mumble/VoiceRecorderDialog.cpp +++ b/src/mumble/VoiceRecorderDialog.cpp @@ -6,6 +6,7 @@ #include "VoiceRecorderDialog.h" #include "AudioOutput.h" +#include "Log.h" #include "ServerHandler.h" #include "VoiceRecorder.h" #include "Global.h" @@ -159,8 +160,6 @@ void VoiceRecorderDialog::on_qpbStart_clicked() { if (!ao) return; - Global::get().sh->announceRecordingState(true); - // Create the recorder VoiceRecorder::Config config; config.sampleRate = ao->getMixerFreq(); @@ -168,6 +167,19 @@ void VoiceRecorderDialog::on_qpbStart_clicked() { config.mixDownMode = qrbDownmix->isChecked(); config.recordingFormat = static_cast< VoiceRecorderFormat::Format >(ifm); + if (config.sampleRate == 0) { + // If we don't catch this here, Mumble will crash because VoiceRecorder expects the sample rate to be non-zero + Global::get().l->log(Log::Warning, + tr("Unable to start recording - the audio output is miconfigured (0Hz sample rate)")); + + // Close this dialog + reject(); + + return; + } + + Global::get().sh->announceRecordingState(true); + Global::get().sh->recorder.reset(new VoiceRecorder(this, config)); VoiceRecorderPtr recorder(Global::get().sh->recorder); |