aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/alsa_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-08 04:11:30 +0100
committerMax Kellermann <max@duempel.org>2009-03-08 04:11:30 +0100
commitab656a52da187dd09b4e400ca1fd13ab2f59e345 (patch)
tree59e4d36f9ec2e0cbd7f7b0cb0bdde29e428fc9ba /src/output/alsa_plugin.c
parent554a34fb958cfa15c00a81671a72079cae00ca5f (diff)
downloadmpd-ab656a52da187dd09b4e400ca1fd13ab2f59e345.tar.gz
mpd-ab656a52da187dd09b4e400ca1fd13ab2f59e345.tar.xz
mpd-ab656a52da187dd09b4e400ca1fd13ab2f59e345.zip
alsa: determine buffer_time if not already known
This patch fixes a theoretical (but practically impossible) flaw: the variable "buffer_time" may be uninitialized when it is used. Initialize the variable with snd_pcm_hw_params_get_buffer_time().
Diffstat (limited to 'src/output/alsa_plugin.c')
-rw-r--r--src/output/alsa_plugin.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c
index 489d4f32b..923d70ad8 100644
--- a/src/output/alsa_plugin.c
+++ b/src/output/alsa_plugin.c
@@ -309,6 +309,11 @@ configure_hw:
&buffer_time, NULL);
if (err < 0)
goto error;
+ } else {
+ err = snd_pcm_hw_params_get_buffer_time(hwparams, &buffer_time,
+ NULL);
+ if (err < 0)
+ buffer_time = 0;
}
if (period_time_ro == 0 && buffer_time >= 10000) {