diff --git a/example/sio_sine.c b/example/sio_sine.c index cca9b19..c53843e 100644 --- a/example/sio_sine.c +++ b/example/sio_sine.c @@ -62,7 +62,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m for (;;) { int frame_count = frames_left; if ((err = soundio_outstream_begin_write(outstream, &areas, &frame_count))) { - fprintf(stderr, "%s\n", soundio_strerror(err)); + fprintf(stderr, "unrecoverable stream error: %s\n", soundio_strerror(err)); exit(1); } @@ -85,7 +85,7 @@ static void write_callback(struct SoundIoOutStream *outstream, int frame_count_m if ((err = soundio_outstream_end_write(outstream))) { if (err == SoundIoErrorUnderflow) return; - fprintf(stderr, "%s\n", soundio_strerror(err)); + fprintf(stderr, "unrecoverable stream error: %s\n", soundio_strerror(err)); exit(1); } diff --git a/src/alsa.cpp b/src/alsa.cpp index 56a3013..e94efe0 100644 --- a/src/alsa.cpp +++ b/src/alsa.cpp @@ -1091,7 +1091,8 @@ void outstream_thread_run(void *arg) { continue; } - outstream->write_callback(outstream, 0, avail); + if (avail > 0) + outstream->write_callback(outstream, 0, avail); continue; } case SND_PCM_STATE_XRUN: