6832063: OpenJDK fails to open the default ALSA device when PulseAudio is enabled
authoramenkov
Fri, 27 Nov 2009 17:54:45 +0300
changeset 4387 83ff9b5213c4
parent 4386 3477770cfaac
child 4388 179f99c62ec4
6832063: OpenJDK fails to open the default ALSA device when PulseAudio is enabled Reviewed-by: amenkov Contributed-by: omajid@redhat.com
jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Fri Nov 27 17:36:34 2009 +0300
+++ b/jdk/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);