changeset 147:078e8d627f0f

6832063: OpenJDK fails to open the default ALSA device when PulseAudio is enabled Reviewed-by: amenkov Contributed-by: omajid@redhat.com
author amenkov
date Wed, 13 May 2009 19:12:22 +0400
parents 6a7ad6179c01
children 86f52477d472
files src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Sat May 09 11:36:36 2009 +0100
+++ b/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Wed May 13 19:12:22 2009 +0400
@@ -143,9 +143,13 @@
             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);
 #ifdef ALSA_PCM_NEW_HW_PARAMS_API