1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 13:21:50 -05:00

Merge pull request #851 from srcejon/fix_849

Avoid divide by 0 if symbol rate is 0.
This commit is contained in:
Edouard Griffiths 2021-04-17 18:21:15 +02:00 committed by GitHub
commit fb10a3e825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 27 deletions

View File

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

View File

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