mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
Merge pull request #803 from srcejon/file_input_samplerate_0_fix
sdriq sample rate can be zero
This commit is contained in:
commit
c575c02791
@ -631,19 +631,6 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_deviceSettingsList->size(); i++)
|
||||
{
|
||||
SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings = m_deviceSettingsList->at(i);
|
||||
|
||||
// Start file sinks (See issue #782 - currently must occur after starting acqusition)
|
||||
if (devSettings->m_startStopFileSink)
|
||||
{
|
||||
qDebug() << "SatelliteTrackerWorker::aos: starting file sinks";
|
||||
int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt();
|
||||
ChannelWebAPIUtils::startStopFileSinks(deviceSetIndex, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Send AOS message to channels
|
||||
SatWorkerState *satWorkerState = m_workerState.value(name);
|
||||
ChannelWebAPIUtils::satelliteAOS(name, satWorkerState->m_satState.m_passes[0]->m_northToSouth);
|
||||
@ -682,6 +669,23 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name)
|
||||
doppler(satWorkerState);
|
||||
});
|
||||
}
|
||||
|
||||
// Start file sinks (need a little delay to ensure sample rate message has been handled in filerecord)
|
||||
QTimer::singleShot(1000, [this, m_deviceSettingsList]()
|
||||
{
|
||||
for (int i = 0; i < m_deviceSettingsList->size(); i++)
|
||||
{
|
||||
SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings = m_deviceSettingsList->at(i);
|
||||
|
||||
if (devSettings->m_startStopFileSink)
|
||||
{
|
||||
qDebug() << "SatelliteTrackerWorker::aos: starting file sinks";
|
||||
int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt();
|
||||
ChannelWebAPIUtils::startStopFileSinks(deviceSetIndex, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -110,16 +110,21 @@ void FileInput::openFileStream()
|
||||
m_sampleSize = header.sampleSize;
|
||||
QString crcHex = QString("%1").arg(header.crc32 , 0, 16);
|
||||
|
||||
if (crcOK)
|
||||
if (crcOK && (m_sampleRate > 0) && (m_sampleSize > 0))
|
||||
{
|
||||
qDebug("FileInput::openFileStream: CRC32 OK for header: %s", qPrintable(crcHex));
|
||||
m_recordLengthMuSec = ((fileSize - sizeof(FileRecord::Header)) * 1000000UL) / ((m_sampleSize == 24 ? 8 : 4) * m_sampleRate);
|
||||
}
|
||||
else
|
||||
else if (!crcOK)
|
||||
{
|
||||
qCritical("FileInput::openFileStream: bad CRC32 for header: %s", qPrintable(crcHex));
|
||||
m_recordLengthMuSec = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
qCritical("FileInput::openFileStream: invalid header");
|
||||
m_recordLengthMuSec = 0;
|
||||
}
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
|
@ -156,6 +156,7 @@ bool FileRecord::handleMessage(const Message& message)
|
||||
{
|
||||
if (DSPSignalNotification::match(message))
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
DSPSignalNotification& notif = (DSPSignalNotification&) message;
|
||||
quint32 sampleRate = notif.getSampleRate();
|
||||
qint64 centerFrequency = notif.getCenterFrequency();
|
||||
|
Loading…
Reference in New Issue
Block a user