Browse Source

Set minimum FIFO size to avoid buffer overflow

chirpmodem-v8.0.0
Jon Beniston 4 years ago
parent
commit
7fe09b9a20
  1. 3
      plugins/channelrx/demodnavtex/navtexdemodbaseband.cpp
  2. 3
      plugins/channelrx/demodrtty/rttydemodbaseband.cpp

3
plugins/channelrx/demodnavtex/navtexdemodbaseband.cpp

@ -145,7 +145,8 @@ bool NavtexDemodBaseband::handleMessage(const Message& cmd) @@ -145,7 +145,8 @@ bool NavtexDemodBaseband::handleMessage(const Message& cmd)
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
qDebug() << "NavtexDemodBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate();
setBasebandSampleRate(notif.getSampleRate());
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
// We can run with very slow sample rate (E.g. 4k), but we don't want FIFO getting too small
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(std::max(notif.getSampleRate(), 48000)));
return true;
}

3
plugins/channelrx/demodrtty/rttydemodbaseband.cpp

@ -145,7 +145,8 @@ bool RttyDemodBaseband::handleMessage(const Message& cmd) @@ -145,7 +145,8 @@ bool RttyDemodBaseband::handleMessage(const Message& cmd)
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
qDebug() << "RttyDemodBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate();
setBasebandSampleRate(notif.getSampleRate());
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
// We can run with very slow sample rate (E.g. 4k), but we don't want FIFO getting too small
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(std::max(notif.getSampleRate(), 48000)));
return true;
}

Loading…
Cancel
Save