diff options
| author | jepler <jepler@gmail.com> | 2019-09-08 21:58:04 -0500 |
|---|---|---|
| committer | jepler <jepler@gmail.com> | 2019-09-08 21:59:07 -0500 |
| commit | ccf08aa3dfbaf97f2792fe55cfcbecd5ee687588 (patch) | |
| tree | da5f4034127455fea71b70d755cace41060aef11 | |
| parent | b613a50d8c1888c9ae2675d58f1f22e90bab5871 (diff) | |
nrf: I2SOut: deal more gracefully with errors from the sample
| -rw-r--r-- | ports/nrf/common-hal/audiobusio/I2SOut.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/nrf/common-hal/audiobusio/I2SOut.c b/ports/nrf/common-hal/audiobusio/I2SOut.c index 6c64fb8cd..25ae48f59 100644 --- a/ports/nrf/common-hal/audiobusio/I2SOut.c +++ b/ports/nrf/common-hal/audiobusio/I2SOut.c @@ -140,6 +140,10 @@ stopping: ; goto stopping; } } + if (get_buffer_result == GET_BUFFER_ERROR || sample_buffer_length == 0) { + self->stopping = true; + goto stopping; + } } uint16_t bytecount = MIN(bytesleft, (size_t)(self->sample_end - self->sample_data)); if (self->samples_signed) { |
