6832063: OpenJDK fails to open the default ALSA device when PulseAudio is enabled
Reviewed-by: amenkov
Contributed-by: omajid@redhat.com
--- 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);