diff options
Diffstat (limited to 'src/output/ao_plugin.c')
-rw-r--r-- | src/output/ao_plugin.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c index b0662d7a1..c9d10174e 100644 --- a/src/output/ao_plugin.c +++ b/src/output/ao_plugin.c @@ -208,29 +208,23 @@ static int ao_play_deconst(ao_device *device, const void *output_samples, return ao_play(device, u.out, num_bytes); } -static bool +static size_t audioOutputAo_play(void *data, const char *playChunk, size_t size) { AoData *ad = (AoData *)data; - size_t chunk_size; if (ad->device == NULL) return false; - while (size > 0) { - chunk_size = ad->writeSize > size - ? size : ad->writeSize; - - if (ao_play_deconst(ad->device, playChunk, chunk_size) == 0) { - audioOutputAo_error("Closing libao device due to play error"); - return false; - } + if (size > ad->writeSize) + size = ad->writeSize; - playChunk += chunk_size; - size -= chunk_size; + if (ao_play_deconst(ad->device, playChunk, size) == 0) { + audioOutputAo_error("Closing libao device due to play error"); + return 0; } - return true; + return size; } const struct audio_output_plugin aoPlugin = { |