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:
parent
8337e2c7b2
commit
dcd298b808
@ -535,6 +535,18 @@ void RemoteTCPSinkSink::processCommand()
|
|||||||
int sampleRate = RemoteTCPProtocol::extractUInt32(&cmd[1]);
|
int sampleRate = RemoteTCPProtocol::extractUInt32(&cmd[1]);
|
||||||
qDebug() << "RemoteTCPSinkSink::processCommand: set sample rate " << sampleRate;
|
qDebug() << "RemoteTCPSinkSink::processCommand: set sample rate " << sampleRate;
|
||||||
ChannelWebAPIUtils::setDevSampleRate(m_deviceIndex, 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;
|
break;
|
||||||
}
|
}
|
||||||
case RemoteTCPProtocol::setTunerGainMode:
|
case RemoteTCPProtocol::setTunerGainMode:
|
||||||
|
@ -46,6 +46,7 @@ RemoteTCPInputTCPHandler::RemoteTCPInputTCPHandler(SampleSinkFifo *sampleFifo, D
|
|||||||
m_converterBufferNbSamples(0),
|
m_converterBufferNbSamples(0),
|
||||||
m_settings()
|
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_tcpBuf = new char[m_sampleFifo->size()*2*4];
|
||||||
m_timer.setInterval(125);
|
m_timer.setInterval(125);
|
||||||
connect(&m_reconnectTimer, SIGNAL(timeout()), this, SLOT(reconnect()));
|
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)
|
if ((settings.m_channelSampleRate != m_settings.m_channelSampleRate) || force)
|
||||||
{
|
{
|
||||||
// Resize FIFO to give us 1 second
|
// Resize FIFO to give us 1 second
|
||||||
// Can't do this while running
|
if ((settingsKeys.contains("channelSampleRate") || force) && (settings.m_channelSampleRate > (qint32)m_sampleFifo->size()))
|
||||||
if (!m_running && settingsKeys.contains("channelSampleRate") && settings.m_channelSampleRate > (qint32)m_sampleFifo->size())
|
|
||||||
{
|
{
|
||||||
qDebug() << "RemoteTCPInputTCPHandler::applySettings: Resizing sample FIFO from " << m_sampleFifo->size() << "to" << settings.m_channelSampleRate;
|
qDebug() << "RemoteTCPInputTCPHandler::applySettings: Resizing sample FIFO from " << m_sampleFifo->size() << "to" << settings.m_channelSampleRate;
|
||||||
m_sampleFifo->setSize(settings.m_channelSampleRate);
|
m_sampleFifo->setSize(settings.m_channelSampleRate);
|
||||||
@ -692,7 +692,7 @@ void RemoteTCPInputTCPHandler::processData()
|
|||||||
qDebug() << "Buffer primed bytesAvailable:" << m_dataSocket->bytesAvailable();
|
qDebug() << "Buffer primed bytesAvailable:" << m_dataSocket->bytesAvailable();
|
||||||
m_fillBuffer = false;
|
m_fillBuffer = false;
|
||||||
m_prevDateTime = QDateTime::currentDateTime();
|
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
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user