From d1eeed6a5ba0ac35f9dcad6355fc2d18c1860a9f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 20 Jul 2011 06:54:51 +0200 Subject: output/alsa: fix SIGFPE when alsa announces a period size of 0 --- src/output/alsa_plugin.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/output') diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c index 9177fabe4..422264f53 100644 --- a/src/output/alsa_plugin.c +++ b/src/output/alsa_plugin.c @@ -508,6 +508,14 @@ configure_hw: g_debug("buffer_size=%u period_size=%u", (unsigned)alsa_buffer_size, (unsigned)alsa_period_size); + if (alsa_period_size == 0) + /* this works around a SIGFPE bug that occurred when + an ALSA driver indicated period_size==0; this + caused a division by zero in alsa_play(). By using + the fallback "1", we make sure that this won't + happen again. */ + alsa_period_size = 1; + ad->period_frames = alsa_period_size; ad->period_position = 0; -- cgit v1.2.3 From 13539961b25940ca6d28c28ab7972c244681e3b5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 20 Jul 2011 19:16:47 +0200 Subject: output/httpd: explicitly convert size_t to bool in pause() --- src/output/httpd_output_plugin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/output') diff --git a/src/output/httpd_output_plugin.c b/src/output/httpd_output_plugin.c index b82dc0599..0137965a6 100644 --- a/src/output/httpd_output_plugin.c +++ b/src/output/httpd_output_plugin.c @@ -493,7 +493,8 @@ httpd_output_pause(void *data) if (has_clients) { static const char silence[1020]; - return httpd_output_play(data, silence, sizeof(silence), NULL); + return httpd_output_play(data, silence, sizeof(silence), + NULL) > 0; } else { g_usleep(100000); return true; -- cgit v1.2.3 From 838f7cd210dbd3f071d48d54c168c123c3d20c58 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 20 Jul 2011 20:54:34 +0200 Subject: encoder_plugin: add method pre_tag() In the "vorbis" plugin, this is a copy of the old flush() method, while flush() gets a lot of code remove, it just sets the "flush" flag and nothing else. It doesn't start a new stream now, which should fix a few problems in some players. --- src/output/httpd_output_plugin.c | 2 +- src/output/shout_plugin.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/output') diff --git a/src/output/httpd_output_plugin.c b/src/output/httpd_output_plugin.c index 0137965a6..40ad05c3d 100644 --- a/src/output/httpd_output_plugin.c +++ b/src/output/httpd_output_plugin.c @@ -523,7 +523,7 @@ httpd_output_tag(void *data, const struct tag *tag) /* flush the current stream, and end it */ - encoder_flush(httpd->encoder, NULL); + encoder_pre_tag(httpd->encoder, NULL); httpd_output_encoder_to_clients(httpd); /* send the tag to the encoder - which starts a new diff --git a/src/output/shout_plugin.c b/src/output/shout_plugin.c index 5e1ef762a..35efd9fc7 100644 --- a/src/output/shout_plugin.c +++ b/src/output/shout_plugin.c @@ -511,7 +511,7 @@ static void my_shout_set_tag(void *data, if (sd->encoder->plugin->tag != NULL) { /* encoder plugin supports stream tags */ - ret = encoder_flush(sd->encoder, &error); + ret = encoder_pre_tag(sd->encoder, &error); if (!ret) { g_warning("%s", error->message); g_error_free(error); -- cgit v1.2.3