mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 05:11:49 -05:00
UDP sink plugin: block output at zero if read and write frame pointers are equal
This commit is contained in:
parent
1b2df9f0fc
commit
7277757b7c
@ -136,14 +136,29 @@ void UDPSinkUDPHandler::moveData(char *blk)
|
||||
|
||||
void UDPSinkUDPHandler::readSample(FixReal &t)
|
||||
{
|
||||
memcpy(&t, &m_udpBuf[m_readFrameIndex][m_readIndex], sizeof(FixReal));
|
||||
advanceReadPointer((int) sizeof(FixReal));
|
||||
if (m_readFrameIndex == m_writeIndex) // block until more writes
|
||||
{
|
||||
t = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&t, &m_udpBuf[m_readFrameIndex][m_readIndex], sizeof(FixReal));
|
||||
advanceReadPointer((int) sizeof(FixReal));
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSinkUDPHandler::readSample(Sample &s)
|
||||
{
|
||||
memcpy(&s, &m_udpBuf[m_readFrameIndex][m_readIndex], sizeof(Sample));
|
||||
advanceReadPointer((int) sizeof(Sample));
|
||||
if (m_readFrameIndex == m_writeIndex) // block until more writes
|
||||
{
|
||||
s.m_real = 0;
|
||||
s.m_imag = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&s, &m_udpBuf[m_readFrameIndex][m_readIndex], sizeof(Sample));
|
||||
advanceReadPointer((int) sizeof(Sample));
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSinkUDPHandler::advanceReadPointer(int nbBytes)
|
||||
|
Loading…
Reference in New Issue
Block a user