diff --git a/plugins/channelrx/demoddatv/datvdemodsink.cpp b/plugins/channelrx/demoddatv/datvdemodsink.cpp index 7a580ec57..f8bb361a8 100644 --- a/plugins/channelrx/demoddatv/datvdemodsink.cpp +++ b/plugins/channelrx/demoddatv/datvdemodsink.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "audio/audiooutputdevice.h" #include "dsp/dspengine.h" @@ -49,7 +50,8 @@ DATVDemodSink::DATVDemodSink() : m_modcodCodeRate(-1), m_enmModulation(DATVDemodSettings::BPSK /*DATV_FM1*/), m_channelSampleRate(1024000), - m_messageQueueToGUI(nullptr) + m_messageQueueToGUI(nullptr), + m_mutex(QMutex::Recursive) { //*************** DATV PARAMETERS *************** m_blnInitialized=false; @@ -155,6 +157,8 @@ bool DATVDemodSink::videoDecodeOK() bool DATVDemodSink::playVideo() { + QMutexLocker mlock(&m_mutex); + if (m_objVideoStream == nullptr) { return false; } @@ -1283,6 +1287,9 @@ void DATVDemodSink::feed(const SampleVector::const_iterator& begin, const Sample //********** init leandvb framework ********** if (m_blnNeedConfigUpdate) { + QMutexLocker mlock(&m_mutex); + stopVideo(); + qDebug("DATVDemodSink::feed: Settings applied. Standard : %d...", m_settings.m_standard); m_blnNeedConfigUpdate = false; diff --git a/plugins/channelrx/demoddatv/datvdemodsink.h b/plugins/channelrx/demoddatv/datvdemodsink.h index 36df3441c..103013909 100644 --- a/plugins/channelrx/demoddatv/datvdemodsink.h +++ b/plugins/channelrx/demoddatv/datvdemodsink.h @@ -18,6 +18,8 @@ #ifndef INCLUDE_DATVDEMODSINK_H #define INCLUDE_DATVDEMODSINK_H +#include + //LeanSDR #include "leansdr/framework.h" #include "leansdr/generic.h" @@ -317,6 +319,7 @@ private: MovingAverageUtil m_objMagSqAverage; MessageQueue *m_messageQueueToGUI; + QMutex m_mutex; static const unsigned int m_rfFilterFftLength; };