mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 17:58:43 -05:00
DV Serial: implement FIFO slots
This commit is contained in:
parent
13e832a20e
commit
18a8e7c903
@ -258,10 +258,12 @@ void DVSerialEngine::pushMbeFrame(const unsigned char *mbeFrame, int mbeRateInde
|
||||
{
|
||||
it->worker->pushMbeFrame(mbeFrame, mbeRateIndex, mbeVolumeIndex, channels, audioFifo);
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
else if (it->worker->isAvailable())
|
||||
{
|
||||
itAvail = it;
|
||||
break;
|
||||
}
|
||||
|
||||
++it;
|
||||
|
@ -32,7 +32,7 @@ DVSerialWorker::DVSerialWorker() :
|
||||
{
|
||||
m_audioBuffer.resize(48000);
|
||||
m_audioBufferFill = 0;
|
||||
m_audioFifo = 0;
|
||||
// m_audioFifo = 0;
|
||||
}
|
||||
|
||||
DVSerialWorker::~DVSerialWorker()
|
||||
@ -105,7 +105,7 @@ void DVSerialWorker::handleInputMessages()
|
||||
}
|
||||
}
|
||||
|
||||
m_timestamp = QDateTime::currentDateTime();
|
||||
m_fifoSlots[0].m_timestamp = QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
void DVSerialWorker::pushMbeFrame(const unsigned char *mbeFrame,
|
||||
@ -113,22 +113,22 @@ void DVSerialWorker::pushMbeFrame(const unsigned char *mbeFrame,
|
||||
int mbeVolumeIndex,
|
||||
unsigned char channels, AudioFifo *audioFifo)
|
||||
{
|
||||
m_audioFifo = audioFifo;
|
||||
m_fifoSlots[0].m_audioFifo = audioFifo;
|
||||
m_inputMessageQueue.push(MsgMbeDecode::create(mbeFrame, mbeRateIndex, mbeVolumeIndex, channels, audioFifo));
|
||||
}
|
||||
|
||||
bool DVSerialWorker::isAvailable()
|
||||
{
|
||||
if (m_audioFifo == 0) {
|
||||
if (m_fifoSlots[0].m_audioFifo == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_timestamp.time().msecsTo(QDateTime::currentDateTime().time()) > 1000; // 1 second inactivity timeout
|
||||
return m_fifoSlots[0].m_timestamp.time().msecsTo(QDateTime::currentDateTime().time()) > 1000; // 1 second inactivity timeout
|
||||
}
|
||||
|
||||
bool DVSerialWorker::hasFifo(AudioFifo *audioFifo)
|
||||
{
|
||||
return m_audioFifo == audioFifo;
|
||||
return m_fifoSlots[0].m_audioFifo == audioFifo;
|
||||
}
|
||||
|
||||
void DVSerialWorker::upsample6(short *in, int nbSamplesIn, unsigned char channels, AudioFifo *audioFifo)
|
||||
|
@ -105,8 +105,6 @@ public:
|
||||
}
|
||||
|
||||
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
||||
AudioFifo *m_audioFifo;
|
||||
QDateTime m_timestamp;
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
@ -122,6 +120,13 @@ private:
|
||||
|
||||
typedef std::vector<AudioSample> AudioVector;
|
||||
|
||||
struct FifoSlot
|
||||
{
|
||||
FifoSlot() : m_audioFifo(0), m_timestamp(QDate(2000, 1, 1)) {}
|
||||
AudioFifo *m_audioFifo;
|
||||
QDateTime m_timestamp;
|
||||
};
|
||||
|
||||
void upsample6(short *in, short *out, int nbSamplesIn);
|
||||
void upsample6(short *in, int nbSamplesIn, unsigned char channels, AudioFifo *audioFifo);
|
||||
|
||||
@ -133,6 +138,7 @@ private:
|
||||
//short m_audioSamples[SerialDV::MBE_AUDIO_BLOCK_SIZE * 6 * 2]; // upsample to 48k and duplicate channel
|
||||
AudioVector m_audioBuffer;
|
||||
uint m_audioBufferFill;
|
||||
FifoSlot m_fifoSlots[2];
|
||||
short m_upsamplerLastValue;
|
||||
float m_phase;
|
||||
MBEAudioInterpolatorFilter m_upsampleFilter;
|
||||
|
Loading…
Reference in New Issue
Block a user