1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Fix FIFO size adjustment, so sample rates >3MS/s work. When RTL0 protocol is used, match channel sample rate to device sample rate.

This commit is contained in:
Jon Beniston 2023-11-13 15:31:55 +00:00
parent 8337e2c7b2
commit dcd298b808
2 changed files with 15 additions and 3 deletions

View File

@ -535,6 +535,18 @@ void RemoteTCPSinkSink::processCommand()
int sampleRate = RemoteTCPProtocol::extractUInt32(&cmd[1]);
qDebug() << "RemoteTCPSinkSink::processCommand: set sample rate " << sampleRate;
ChannelWebAPIUtils::setDevSampleRate(m_deviceIndex, sampleRate);
if (m_settings.m_protocol == RemoteTCPSinkSettings::RTL0)
{
// Match channel sample rate with device sample rate for RTL0 protocol
ChannelWebAPIUtils::setSoftDecim(m_deviceIndex, 0);
settings.m_channelSampleRate = sampleRate;
if (m_messageQueueToGUI) {
m_messageQueueToGUI->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"channelSampleRate"}, false, true));
}
if (m_messageQueueToChannel) {
m_messageQueueToChannel->push(RemoteTCPSink::MsgConfigureRemoteTCPSink::create(settings, {"channelSampleRate"}, false, true));
}
}
break;
}
case RemoteTCPProtocol::setTunerGainMode:

View File

@ -46,6 +46,7 @@ RemoteTCPInputTCPHandler::RemoteTCPInputTCPHandler(SampleSinkFifo *sampleFifo, D
m_converterBufferNbSamples(0),
m_settings()
{
m_sampleFifo->setSize(5000000); // Start with large FIFO, to avoid having to resize
m_tcpBuf = new char[m_sampleFifo->size()*2*4];
m_timer.setInterval(125);
connect(&m_reconnectTimer, SIGNAL(timeout()), this, SLOT(reconnect()));
@ -455,8 +456,7 @@ void RemoteTCPInputTCPHandler::applySettings(const RemoteTCPInputSettings& setti
if ((settings.m_channelSampleRate != m_settings.m_channelSampleRate) || force)
{
// Resize FIFO to give us 1 second
// Can't do this while running
if (!m_running && settingsKeys.contains("channelSampleRate") && settings.m_channelSampleRate > (qint32)m_sampleFifo->size())
if ((settingsKeys.contains("channelSampleRate") || force) && (settings.m_channelSampleRate > (qint32)m_sampleFifo->size()))
{
qDebug() << "RemoteTCPInputTCPHandler::applySettings: Resizing sample FIFO from " << m_sampleFifo->size() << "to" << settings.m_channelSampleRate;
m_sampleFifo->setSize(settings.m_channelSampleRate);
@ -692,7 +692,7 @@ void RemoteTCPInputTCPHandler::processData()
qDebug() << "Buffer primed bytesAvailable:" << m_dataSocket->bytesAvailable();
m_fillBuffer = false;
m_prevDateTime = QDateTime::currentDateTime();
factor = 6.0f / 8.0f;
factor = 1.0f / 4.0f; // If this is too high, samples can just be dropped downstream
}
}
else