1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 13:47:01 -04:00

LimeSDR: fixed lockup problem by moving start/stop stream from thread run method to start/stop work methods

This commit is contained in:
f4exb
2017-10-29 18:38:04 +01:00
parent c7e7bf3480
commit e8fb70096c
6 changed files with 36 additions and 55 deletions
@@ -39,6 +39,12 @@ void LimeSDRInputThread::startWork()
{
if (m_running) return; // return if running already
if (LMS_StartStream(m_stream) < 0) {
qCritical("LimeSDRInputThread::startWork: could not start stream");
} else {
qDebug("LimeSDRInputThread::startWork: stream started");
}
m_startWaitMutex.lock();
start();
while(!m_running)
@@ -52,6 +58,12 @@ void LimeSDRInputThread::stopWork()
m_running = false;
wait();
if (LMS_StopStream(m_stream) < 0) {
qCritical("LimeSDRInputThread::stopWork: could not stop stream");
} else {
qDebug("LimeSDRInputThread::stopWork: stream stopped");
}
}
void LimeSDRInputThread::setLog2Decimation(unsigned int log2_decim)
@@ -75,13 +87,6 @@ void LimeSDRInputThread::run()
m_running = true;
m_startWaiter.wakeAll();
if (LMS_StartStream(m_stream) < 0) {
qCritical("LimeSDRInputThread::run: could not start stream");
} else {
usleep(100000);
qDebug("LimeSDRInputThread::run: stream started");
}
while (m_running)
{
if ((res = LMS_RecvStream(m_stream, (void *) m_buf, LIMESDR_BLOCKSIZE, &metadata, 1000)) < 0)
@@ -93,14 +98,6 @@ void LimeSDRInputThread::run()
callback(m_buf, 2 * res);
}
if (LMS_StopStream(m_stream) < 0) {
qCritical("LimeSDRInputThread::run: could not stop stream");
} else {
usleep(100000);
qDebug("LimeSDRInputThread::run: stream stopped");
}
m_running = false;
}