changeset 3186:2e988f44b85d

alsa-ng: Don't crash on SND_PCM_FORMAT_UNKNOWN.
author William Pitcock <nenolod@atheme.org>
date Fri, 19 Jun 2009 08:23:51 -0500
parents d3cf6d14c960
children 360e92f3211d
files src/alsa-ng/alsa-core.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/alsa-ng/alsa-core.c	Fri Jun 19 07:59:56 2009 -0500
+++ b/src/alsa-ng/alsa-core.c	Fri Jun 19 08:23:51 2009 -0500
@@ -290,6 +290,11 @@
     snd_pcm_hw_params_t *hwparams = NULL;
 
     afmt = alsaplug_format_convert(fmt);
+    if (afmt == SND_PCM_FORMAT_UNKNOWN)
+    {
+        _ERROR("unsupported format requested: %d -> %d", fmt, afmt);
+        return -1;
+    }
 
     if ((err = snd_pcm_open(&pcm_handle, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0)
     {