aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/shout_output_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-10-01 23:50:50 +0200
committerMax Kellermann <max@duempel.org>2012-10-02 00:26:40 +0200
commitadbe8c409a17b85ec10eb131fb81e3da9036dcef (patch)
tree202c2f33d5952fbb572e6da65f47c997e1d5c4c0 /src/output/shout_output_plugin.c
parent58e600f408bed5cfdc9b3cebded108a8593e5b7b (diff)
downloadmpd-adbe8c409a17b85ec10eb131fb81e3da9036dcef.tar.gz
mpd-adbe8c409a17b85ec10eb131fb81e3da9036dcef.tar.xz
mpd-adbe8c409a17b85ec10eb131fb81e3da9036dcef.zip
output/{recorder,shout}: call encoder_read() in a loop
This is necessary for Ogg packets that span more than one page.
Diffstat (limited to 'src/output/shout_output_plugin.c')
-rw-r--r--src/output/shout_output_plugin.c18
1 files changed, 10 insertions, 8 deletions
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;
}