21 #define MIN(x, y) (((x) < (y)) ? (x) : (y)) 34 qCritical(
"SampleSinkFifo: out of memory");
58 QObject(other.parent()),
70 QMutexLocker mutexLocker(&
m_mutex);
79 return m_data.size() == (uint)size;
84 QMutexLocker mutexLocker(&
m_mutex);
96 qCritical(
"SampleSinkFifo: overflow - dropping %u samples", count - total);
99 qCritical(
"SampleSinkFifo: %u messages dropped",
m_suppressed);
100 qCritical(
"SampleSinkFifo: overflow - dropping %u samples", count - total);
109 while(remaining > 0) {
127 QMutexLocker mutexLocker(&
m_mutex);
128 uint count = end - begin;
138 qCritical(
"SampleSinkFifo: overflow - dropping %u samples", count - total);
141 qCritical(
"SampleSinkFifo: %u messages dropped",
m_suppressed);
142 qCritical(
"SampleSinkFifo: overflow - dropping %u samples", count - total);
151 while(remaining > 0) {
169 QMutexLocker mutexLocker(&
m_mutex);
170 uint count = end - begin;
177 qCritical(
"SampleSinkFifo: underflow - missing %u samples", count - total);
180 while(remaining > 0) {
194 SampleVector::iterator* part1Begin, SampleVector::iterator* part1End,
195 SampleVector::iterator* part2Begin, SampleVector::iterator* part2End)
197 QMutexLocker mutexLocker(&
m_mutex);
205 qCritical(
"SampleSinkFifo: underflow - missing %u samples", count - total);
210 *part1Begin =
m_data.begin() + head;
211 *part1End =
m_data.begin() + head + len;
216 *part1Begin =
m_data.end();
221 *part2Begin =
m_data.begin() + head;
222 *part2End =
m_data.begin() + head + len;
224 *part2Begin =
m_data.end();
233 QMutexLocker mutexLocker(&
m_mutex);
236 qCritical(
"SampleSinkFifo: cannot commit more than available samples");
SampleSinkFifo(QObject *parent=nullptr)
uint write(const quint8 *data, uint count)
uint readCommit(uint count)
uint read(SampleVector::iterator begin, SampleVector::iterator end)
uint readBegin(uint count, SampleVector::iterator *part1Begin, SampleVector::iterator *part1End, SampleVector::iterator *part2Begin, SampleVector::iterator *part2End)