diff --git a/plugins/samplesink/filesink/filesinkthread.cpp b/plugins/samplesink/filesink/filesinkthread.cpp index 98655de9c..910b0113d 100644 --- a/plugins/samplesink/filesink/filesinkthread.cpp +++ b/plugins/samplesink/filesink/filesinkthread.cpp @@ -86,7 +86,7 @@ void FileSinkThread::setSamplerate(int samplerate) // resize sample FIFO if (m_sampleFifo) { - m_sampleFifo->resize(samplerate, samplerate/4); // 1s buffer with 250ms write chunk size + m_sampleFifo->resize(samplerate); // 1s buffer } m_samplerate = samplerate; diff --git a/sdrbase/dsp/basebandsamplesource.cpp b/sdrbase/dsp/basebandsamplesource.cpp index 0cc4870da..14c023e48 100644 --- a/sdrbase/dsp/basebandsamplesource.cpp +++ b/sdrbase/dsp/basebandsamplesource.cpp @@ -18,7 +18,8 @@ #include "dsp/basebandsamplesource.h" #include "util/message.h" -BasebandSampleSource::BasebandSampleSource() +BasebandSampleSource::BasebandSampleSource() : + m_sampleFifo(48000) // arbitrary, will be adjusted to match device sink FIFO size { connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); } diff --git a/sdrbase/dsp/basebandsamplesource.h b/sdrbase/dsp/basebandsamplesource.h index 83e29e2e2..f0cd3a060 100644 --- a/sdrbase/dsp/basebandsamplesource.h +++ b/sdrbase/dsp/basebandsamplesource.h @@ -57,6 +57,7 @@ public: protected: MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_outputMessageQueue; //!< Queue for asynchronous outbound communication + SampleSourceFifo m_sampleFifo; //!< Internal FIFO for multi-channel processing protected slots: void handleInputMessages(); diff --git a/sdrbase/dsp/dspdevicesinkengine.cpp b/sdrbase/dsp/dspdevicesinkengine.cpp index 2b8305370..a8ba9d278 100644 --- a/sdrbase/dsp/dspdevicesinkengine.cpp +++ b/sdrbase/dsp/dspdevicesinkengine.cpp @@ -380,12 +380,14 @@ DSPDeviceSinkEngine::State DSPDeviceSinkEngine::gotoRunning() for(BasebandSampleSources::const_iterator it = m_basebandSampleSources.begin(); it != m_basebandSampleSources.end(); it++) { qDebug() << "DSPDeviceSinkEngine::gotoRunning: starting " << (*it)->objectName().toStdString().c_str(); + // TODO: equalize channel source FIFO size with device sink FIFO size (*it)->start(); } for (ThreadedBasebandSampleSources::const_iterator it = m_threadedBasebandSampleSources.begin(); it != m_threadedBasebandSampleSources.end(); ++it) { qDebug() << "DSPDeviceSinkEngine::gotoRunning: starting ThreadedSampleSource(" << (*it)->getSampleSourceObjectName().toStdString().c_str() << ")"; + // TODO: equalize channel source FIFO size with device sink FIFO size (*it)->start(); } diff --git a/sdrbase/dsp/samplesourcefifo.cpp b/sdrbase/dsp/samplesourcefifo.cpp index f09ad4f8d..e6264b588 100644 --- a/sdrbase/dsp/samplesourcefifo.cpp +++ b/sdrbase/dsp/samplesourcefifo.cpp @@ -29,10 +29,9 @@ SampleSourceFifo::SampleSourceFifo(uint32_t size) : SampleSourceFifo::~SampleSourceFifo() {} -void SampleSourceFifo::resize(uint32_t size, uint32_t samplesChunkSize) +void SampleSourceFifo::resize(uint32_t size) { - qDebug("SampleSourceFifo::resize: %d, %d", size, samplesChunkSize); - assert(samplesChunkSize <= size/4); + qDebug("SampleSourceFifo::resize: %d", size); m_size = size; m_data.resize(2*m_size); @@ -60,7 +59,7 @@ void SampleSourceFifo::readAdvance(SampleVector::iterator& readUntil, unsigned i if (m_init) { - emit dataWrite(m_size); + emit dataWrite(m_size/2); m_init = false; } else if (i_delta > 0) diff --git a/sdrbase/dsp/samplesourcefifo.h b/sdrbase/dsp/samplesourcefifo.h index 3767bf15d..16953aabd 100644 --- a/sdrbase/dsp/samplesourcefifo.h +++ b/sdrbase/dsp/samplesourcefifo.h @@ -31,7 +31,7 @@ public: SampleSourceFifo(uint32_t size); ~SampleSourceFifo(); - void resize(uint32_t size, uint32_t samplesChunkSize); + void resize(uint32_t size); void init(); /** advance read pointer for the given length and activate R/W signals */ void readAdvance(SampleVector::iterator& readUntil, unsigned int nbSamples);