1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 14:04:46 -04:00

SDRdaemon: updated write data to raw buffer methods

This commit is contained in:
f4exb
2016-01-27 08:40:54 +01:00
parent 2fe57dabae
commit 13d698a940
2 changed files with 24 additions and 24 deletions
@@ -117,15 +117,35 @@ void SDRdaemonBuffer::writeData(char *array, std::size_t length)
}
else
{
// TODO: uncompressed case
writeDataUncompressed(array, length);
}
}
}
void SDRdaemonBuffer::writeDataUncompressed(char *array, std::size_t length)
{
if (m_inCount + length < m_frameSize)
{
std::memcpy((void *) &m_rawBuffer[m_inCount], (const void *) array, length);
m_inCount += length;
}
else
{
std::memcpy((void *) &m_rawBuffer[m_inCount], (const void *) array, m_frameSize - m_inCount); // copy rest of data in compressed Buffer
m_inCount += length;
}
if (m_inCount >= m_frameSize) // full block retrieved
{
// TODO: to do?
}
}
void SDRdaemonBuffer::writeDataLZ4(char *array, std::size_t length)
{
if (m_lz4InCount + length < m_lz4InSize)
{
std::memcpy((void *) &m_lz4InBuffer[m_lz4InCount], (const void *) array, length);
m_lz4InCount += length;
}
else
@@ -162,31 +182,8 @@ void SDRdaemonBuffer::writeDataLZ4(char *array, std::size_t length)
if (compressedSize == m_lz4InSize)
{
/*
std::cerr << "SDRdaemonBuffer::writeAndReadLZ4: decoding OK:"
<< " read: " << compressedSize
<< " expected: " << m_lz4InSize
<< " out: " << m_lz4OutSize
<< std::endl;
*/
m_nbSuccessfulDecodes++;
}
else
{
// std::cerr << "SDRdaemonBuffer::writeAndReadLZ4: decoding error:"
// << " read: " << compressedSize
// << " expected: " << m_lz4InSize
// << " out: " << m_lz4OutSize
// << std::endl;
//if (compressedSize > 0)
//{
//}
//else
//{
// dataLength = 0;
//}
}
m_lz4InCount = 0;
}