From d3312c90d48197f710c7a3d1e51ba27f9ee75269 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 18 Apr 2017 13:56:05 +0200 Subject: [PATCH] LimeSDR input: start and stop stream before and after the read loop. Use actual number of samples for callback --- .../limesdrinput/limesdrinputthread.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/samplesource/limesdrinput/limesdrinputthread.cpp b/plugins/samplesource/limesdrinput/limesdrinputthread.cpp index 4b8126d6c..0da63813a 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputthread.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinputthread.cpp @@ -70,6 +70,12 @@ void LimeSDRInputThread::run() m_running = true; m_startWaiter.wakeAll(); + if (LMS_StartStream(m_stream) < 0) { + qCritical("LimeSDRInputThread::run: could not start stream"); + } else { + qDebug("LimeSDRInputThread::run: stream started"); + } + while (m_running) { if ((res = LMS_RecvStream(m_stream, (void *) m_buf, LIMESDR_BLOCKSIZE, &metadata, 1000)) < 0) @@ -78,7 +84,14 @@ void LimeSDRInputThread::run() break; } - callback(m_buf, 2 * LIMESDR_BLOCKSIZE); + callback(m_buf, 2 * res); + } + + + if (LMS_StopStream(m_stream) < 0) { + qCritical("LimeSDRInputThread::run: could not stop stream"); + } else { + qDebug("LimeSDRInputThread::run: stream stopped"); } m_running = false;