mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-29 21:44:14 -04:00
Fixed segfault while changing center frequency or sample rate
This commit is contained in:
@@ -37,18 +37,29 @@ void Channelizer::feed(const SampleVector::const_iterator& begin, const SampleVe
|
||||
return;
|
||||
}
|
||||
|
||||
for(SampleVector::const_iterator sample = begin; sample != end; ++sample) {
|
||||
m_mutex.lock();
|
||||
|
||||
for(SampleVector::const_iterator sample = begin; sample != end; ++sample)
|
||||
{
|
||||
Sample s(*sample);
|
||||
FilterStages::iterator stage = m_filterStages.begin();
|
||||
while(stage != m_filterStages.end()) {
|
||||
|
||||
for (; stage != m_filterStages.end(); ++stage)
|
||||
{
|
||||
if(!(*stage)->work(&s))
|
||||
{
|
||||
break;
|
||||
++stage;
|
||||
}
|
||||
}
|
||||
|
||||
if(stage == m_filterStages.end())
|
||||
{
|
||||
m_sampleBuffer.push_back(s);
|
||||
}
|
||||
}
|
||||
|
||||
m_mutex.unlock();
|
||||
|
||||
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), positiveOnly);
|
||||
m_sampleBuffer.clear();
|
||||
}
|
||||
@@ -125,12 +136,16 @@ void Channelizer::applyConfiguration()
|
||||
return;
|
||||
}
|
||||
|
||||
m_mutex.lock();
|
||||
|
||||
freeFilterChain();
|
||||
|
||||
m_currentCenterFrequency = createFilterChain(
|
||||
m_inputSampleRate / -2, m_inputSampleRate / 2,
|
||||
m_requestedCenterFrequency - m_requestedOutputSampleRate / 2, m_requestedCenterFrequency + m_requestedOutputSampleRate / 2);
|
||||
|
||||
m_mutex.unlock();
|
||||
|
||||
m_currentOutputSampleRate = m_inputSampleRate / (1 << m_filterStages.size());
|
||||
|
||||
qDebug() << "Channelizer::applyConfiguration in=" << m_inputSampleRate
|
||||
|
||||
Reference in New Issue
Block a user