aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-07-20 06:54:51 +0200
committerMax Kellermann <max@duempel.org>2011-07-20 06:54:51 +0200
commitd1eeed6a5ba0ac35f9dcad6355fc2d18c1860a9f (patch)
tree096eab7aff9312fe00837459d29e67e219e3353b
parent736fd0e29326548152e91e4e3fb8c0ea9c1b50ac (diff)
downloadmpd-d1eeed6a5ba0ac35f9dcad6355fc2d18c1860a9f.tar.gz
mpd-d1eeed6a5ba0ac35f9dcad6355fc2d18c1860a9f.tar.xz
mpd-d1eeed6a5ba0ac35f9dcad6355fc2d18c1860a9f.zip
output/alsa: fix SIGFPE when alsa announces a period size of 0
-rw-r--r--NEWS2
-rw-r--r--src/output/alsa_plugin.c8
2 files changed, 10 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 4756b64f6..ddba638c7 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ ver 0.16.4 (2011/??/??)
* decoder:
- ffmpeg: workaround for semantic API change in recent ffmpeg versions
- flac: validate the sample rate when scanning the tag
+* output:
+ - alsa: fix SIGFPE when alsa announces a period size of 0
ver 0.16.3 (2011/06/04)
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;