changeset 1992:c5cefcfdac9a

6832063: OpenJDK fails to open the default ALSA device when PulseAudio is enabled Reviewed-by: amenkov Contributed-by: omajid@redhat.com
author amenkov
date Fri, 27 Nov 2009 17:54:45 +0300
parents e7483b15706f
children f20c9e76c3e0
files src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Fri Nov 27 17:36:34 2009 +0300
+++ b/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Fri Nov 27 17:54:45 2009 +0300
@@ -143,8 +143,12 @@
             ERROR1("snd_pcm_hw_params_malloc returned error %d\n", ret);
         } else {
             ret = snd_pcm_hw_params_any(handle, hwParams);
-            if (ret != 0) {
-                ERROR1("snd_pcm_hw_params_any returned error %d\n", ret);
+            /* snd_pcm_hw_params_any can return a positive value on success too */
+            if (ret < 0) {
+                 ERROR1("snd_pcm_hw_params_any returned error %d\n", ret);
+            } else {
+                /* for the logic following this code, set ret to 0 to indicate success */
+                ret = 0;
             }
         }
         snd_pcm_hw_params_get_format_mask(hwParams, formatMask);