revert external write loop change

This commit is contained in:
philippe44
2019-08-24 01:30:43 -07:00
parent 93568723fd
commit 07d8342e1d

View File

@@ -50,7 +50,7 @@ static struct {
*/ */
static void sink_data_handler(const uint8_t *data, uint32_t len) static void sink_data_handler(const uint8_t *data, uint32_t len)
{ {
size_t bytes; size_t bytes, space;
// would be better to lock decoder, but really, it does not matter // would be better to lock decoder, but really, it does not matter
if (decode.state != DECODE_STOPPED) { if (decode.state != DECODE_STOPPED) {
@@ -75,6 +75,7 @@ static void sink_data_handler(const uint8_t *data, uint32_t len)
} }
#endif #endif
_buf_inc_writep(outputbuf, bytes); _buf_inc_writep(outputbuf, bytes);
space = _buf_space(outputbuf);
len -= bytes; len -= bytes;
data += bytes; data += bytes;
@@ -82,7 +83,7 @@ static void sink_data_handler(const uint8_t *data, uint32_t len)
UNLOCK_O; UNLOCK_O;
// allow i2s to empty the buffer if needed // allow i2s to empty the buffer if needed
if (len) usleep(50000); if (len && !space) usleep(50000);
} }
} }