aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/shout_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-08-14 11:52:36 +0200
committerMax Kellermann <max@duempel.org>2009-08-14 11:52:36 +0200
commitf38ce5408b5d0126b8cfe730c91d5203ee59a987 (patch)
tree1caecaa642051b5cd7820471aecde19f3da97e42 /src/output/shout_plugin.c
parent7133f560ec24c90671a40c9f9bc9cea6eb31cc17 (diff)
downloadmpd-f38ce5408b5d0126b8cfe730c91d5203ee59a987.tar.gz
mpd-f38ce5408b5d0126b8cfe730c91d5203ee59a987.tar.xz
mpd-f38ce5408b5d0126b8cfe730c91d5203ee59a987.zip
output/shout: minimize the unpause latency
During the pause loop, manually sleep for 500ms if shout_delay() returns a value greater than that. Don't exhaust libshout's buffer.
Diffstat (limited to '')
-rw-r--r--src/output/shout_plugin.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/output/shout_plugin.c b/src/output/shout_plugin.c
index 8e091679e..4412d26ff 100644
--- a/src/output/shout_plugin.c
+++ b/src/output/shout_plugin.c
@@ -448,8 +448,15 @@ my_shout_play(void *data, const void *chunk, size_t size, GError **error)
static bool
my_shout_pause(void *data)
{
+ struct shout_data *sd = (struct shout_data *)data;
static const char silence[1020];
+ if (shout_delay(sd->shout_conn) > 500) {
+ /* cap the latency for unpause */
+ g_usleep(500000);
+ return true;
+ }
+
return my_shout_play(data, silence, sizeof(silence), NULL);
}