1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

Avoid divide by 0 if symbol rate is 0.

This commit is contained in:
Jon Beniston 2021-04-17 12:55:30 +01:00
parent 76f09a17a7
commit 7e0903a722
2 changed files with 40 additions and 27 deletions

View File

@ -272,6 +272,9 @@
<property name="toolTip"> <property name="toolTip">
<string>Symbol rate</string> <string>Symbol rate</string>
</property> </property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum"> <property name="maximum">
<number>10000000</number> <number>10000000</number>
</property> </property>

View File

@ -590,6 +590,8 @@ void DATVModSource::applyChannelSettings(int channelSampleRate, int channelFrequ
} }
if ((channelSampleRate != m_channelSampleRate) || force) if ((channelSampleRate != m_channelSampleRate) || force)
{
if (m_settings.m_symbolRate > 0)
{ {
m_sampleRate = (channelSampleRate/m_settings.m_symbolRate)*m_settings.m_symbolRate; m_sampleRate = (channelSampleRate/m_settings.m_symbolRate)*m_settings.m_symbolRate;
@ -607,10 +609,12 @@ void DATVModSource::applyChannelSettings(int channelSampleRate, int channelFrequ
getDVBSDataBitrate(m_settings))); getDVBSDataBitrate(m_settings)));
} }
} }
}
m_channelSampleRate = channelSampleRate; m_channelSampleRate = channelSampleRate;
m_channelFrequencyOffset = channelFrequencyOffset; m_channelFrequencyOffset = channelFrequencyOffset;
if (m_settings.m_symbolRate > 0)
m_samplesPerSymbol = m_channelSampleRate/m_settings.m_symbolRate; m_samplesPerSymbol = m_channelSampleRate/m_settings.m_symbolRate;
m_pulseShapeI.create(m_settings.m_rollOff, 8, m_samplesPerSymbol, false); m_pulseShapeI.create(m_settings.m_rollOff, 8, m_samplesPerSymbol, false);
@ -639,6 +643,8 @@ void DATVModSource::applySettings(const DATVModSettings& settings, bool force)
|| (settings.m_modulation != m_settings.m_modulation) || (settings.m_modulation != m_settings.m_modulation)
|| (settings.m_symbolRate != m_settings.m_symbolRate) || (settings.m_symbolRate != m_settings.m_symbolRate)
|| force) || force)
{
if (settings.m_symbolRate > 0)
{ {
m_sampleRate = (m_channelSampleRate/settings.m_symbolRate)*settings.m_symbolRate; m_sampleRate = (m_channelSampleRate/settings.m_symbolRate)*settings.m_symbolRate;
@ -655,6 +661,9 @@ void DATVModSource::applySettings(const DATVModSettings& settings, bool force)
getDVBSDataBitrate(settings))); getDVBSDataBitrate(settings)));
} }
} }
else
qWarning() << "DATVModSource::applySettings: symbolRate must be greater than 0.";
}
if ((settings.m_source != m_settings.m_source) if ((settings.m_source != m_settings.m_source)
|| (settings.m_udpAddress != m_settings.m_udpAddress) || (settings.m_udpAddress != m_settings.m_udpAddress)
@ -804,6 +813,7 @@ void DATVModSource::applySettings(const DATVModSettings& settings, bool force)
m_settings = settings; m_settings = settings;
if (m_settings.m_symbolRate > 0)
m_samplesPerSymbol = m_channelSampleRate/m_settings.m_symbolRate; m_samplesPerSymbol = m_channelSampleRate/m_settings.m_symbolRate;
m_pulseShapeI.create(m_settings.m_rollOff, 8, m_samplesPerSymbol, false); m_pulseShapeI.create(m_settings.m_rollOff, 8, m_samplesPerSymbol, false);