From adbe8c409a17b85ec10eb131fb81e3da9036dcef Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 1 Oct 2012 23:50:50 +0200 Subject: output/{recorder,shout}: call encoder_read() in a loop This is necessary for Ogg packets that span more than one page. --- src/output/shout_output_plugin.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/output/shout_output_plugin.c') diff --git a/src/output/shout_output_plugin.c b/src/output/shout_output_plugin.c index 63f1001ba..56456a0ea 100644 --- a/src/output/shout_output_plugin.c +++ b/src/output/shout_output_plugin.c @@ -342,14 +342,16 @@ write_page(struct shout_data *sd, GError **error) { assert(sd->encoder != NULL); - size_t nbytes = encoder_read(sd->encoder, - sd->buffer, sizeof(sd->buffer)); - if (nbytes == 0) - return true; - - int err = shout_send(sd->shout_conn, sd->buffer, nbytes); - if (!handle_shout_error(sd, err, error)) - return false; + while (true) { + size_t nbytes = encoder_read(sd->encoder, + sd->buffer, sizeof(sd->buffer)); + if (nbytes == 0) + return true; + + int err = shout_send(sd->shout_conn, sd->buffer, nbytes); + if (!handle_shout_error(sd, err, error)) + return false; + } return true; } -- cgit v1.2.3