1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Audio UDP/RTP: prevent null decimation factor

This commit is contained in:
f4exb 2019-02-14 10:14:22 +01:00
parent c0a86b3077
commit 5cd7f4a2e6

View File

@ -244,7 +244,7 @@ void AudioDialogX::updateOutputDisplay()
ui->outputUDPUseRTP->setChecked(m_outputDeviceInfo.udpUseRTP); ui->outputUDPUseRTP->setChecked(m_outputDeviceInfo.udpUseRTP);
ui->outputUDPChannelMode->setCurrentIndex((int) m_outputDeviceInfo.udpChannelMode); ui->outputUDPChannelMode->setCurrentIndex((int) m_outputDeviceInfo.udpChannelMode);
ui->outputUDPChannelCodec->setCurrentIndex((int) m_outputDeviceInfo.udpChannelCodec); ui->outputUDPChannelCodec->setCurrentIndex((int) m_outputDeviceInfo.udpChannelCodec);
ui->decimationFactor->setCurrentIndex(m_outputDeviceInfo.decimationFactor - 1); ui->decimationFactor->setCurrentIndex(m_outputDeviceInfo.decimationFactor == 0 ? 0 : m_outputDeviceInfo.decimationFactor - 1);
updateOutputSDPString(); updateOutputSDPString();
} }
@ -283,5 +283,6 @@ void AudioDialogX::updateOutputSDPString()
int nChannels = m_outputDeviceInfo.udpChannelMode == AudioOutput::UDPChannelStereo ? 2 : 1; int nChannels = m_outputDeviceInfo.udpChannelMode == AudioOutput::UDPChannelStereo ? 2 : 1;
ui->outputSDPText->setText(tr("%1/%2/%3").arg(format).arg(m_outputDeviceInfo.sampleRate/m_outputDeviceInfo.decimationFactor).arg(nChannels)); uint32_t decimationFactor = m_outputDeviceInfo.decimationFactor == 0 ? 1 : m_outputDeviceInfo.decimationFactor;
ui->outputSDPText->setText(tr("%1/%2/%3").arg(format).arg(m_outputDeviceInfo.sampleRate/decimationFactor).arg(nChannels));
} }