Revert "libspark/record: always fill read buffer"

This reverts commit f77184cb68.
This commit is contained in:
max10
2014-07-07 21:01:47 +02:00
parent 29a5800ff9
commit 38f9e896c5

View File

@@ -244,11 +244,7 @@ void cRecord::RecordThread()
while (exit_flag == RECORD_RUNNING) while (exit_flag == RECORD_RUNNING)
{ {
uint8_t *bufstart = io_buf[chunk]; ssize_t s = dmx->Read(io_buf[chunk], readsize, 50);
int left = readsize;
ssize_t len = 0;
while ((exit_flag == RECORD_RUNNING) && (left > 0)) {
int s = dmx->Read(bufstart, left, 50);
lt_debug("%s: Read chunk=%d size=%d\n", __func__, chunk, s); lt_debug("%s: Read chunk=%d size=%d\n", __func__, chunk, s);
if (s < 0) if (s < 0)
{ {
@@ -263,18 +259,14 @@ void cRecord::RecordThread()
overflow_count++; overflow_count++;
continue; continue;
} }
len += s;
left -= s;
bufstart += s;
if (overflow_count) { if (overflow_count) {
lt_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count); lt_info("%s: Overflow cleared after %d iterations\n", __func__, overflow_count);
overflow_count = 0; overflow_count = 0;
} }
} if (!s)
if (!len)
continue; continue;
io_len[chunk] = len; io_len[chunk] = s;
sem_post(&sem); sem_post(&sem);
chunk++; chunk++;
chunk %= RECORD_WRITER_CHUNKS; chunk %= RECORD_WRITER_CHUNKS;