changeset 8505:7a2f15b60904

8157753: Audio replay enhancement Reviewed-by: prr
author dmarkov
date Tue, 12 Jul 2016 11:19:59 +0300
parents b8b8ef427a7a
children d14c94c19732
files src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp src/solaris/native/com/sun/media/sound/PLATFORM_API_BsdOS_ALSA_PCM.c src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_PCM.c src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp
diffstat 5 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp	Tue Oct 18 04:14:51 2016 +0100
+++ b/src/macosx/native/com/sun/media/sound/PLATFORM_API_MacOSX_PCM.cpp	Tue Jul 12 11:19:59 2016 +0300
@@ -819,6 +819,10 @@
         ERROR1("<<DAUDIO_Open: ERROR: unsupported encoding (%d)\n", encoding);
         return NULL;
     }
+    if (channels <= 0) {
+        ERROR1("<<DAUDIO_Open: ERROR: Invalid number of channels=%d!\n", channels);
+        return NULL;
+    }
 
     OSX_DirectAudioDevice *device = new OSX_DirectAudioDevice();
 
--- a/src/solaris/native/com/sun/media/sound/PLATFORM_API_BsdOS_ALSA_PCM.c	Tue Oct 18 04:14:51 2016 +0100
+++ b/src/solaris/native/com/sun/media/sound/PLATFORM_API_BsdOS_ALSA_PCM.c	Tue Jul 12 11:19:59 2016 +0300
@@ -434,7 +434,10 @@
         snd_output_stdio_attach(&ALSA_OUTPUT, stdout, 0);
     }
 #endif
-
+    if (channels <= 0) {
+        ERROR1("ERROR: Invalid number of channels=%d!\n", channels);
+        return NULL;
+    }
     info = (AlsaPcmInfo*) malloc(sizeof(AlsaPcmInfo));
     if (!info) {
         ERROR0("Out of memory\n");
--- a/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Tue Oct 18 04:14:51 2016 +0100
+++ b/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Tue Jul 12 11:19:59 2016 +0300
@@ -434,7 +434,10 @@
         snd_output_stdio_attach(&ALSA_OUTPUT, stdout, 0);
     }
 #endif
-
+    if (channels <= 0) {
+        ERROR1("ERROR: Invalid number of channels=%d!\n", channels);
+        return NULL;
+    }
     info = (AlsaPcmInfo*) malloc(sizeof(AlsaPcmInfo));
     if (!info) {
         ERROR0("Out of memory\n");
--- a/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_PCM.c	Tue Oct 18 04:14:51 2016 +0100
+++ b/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_PCM.c	Tue Jul 12 11:19:59 2016 +0300
@@ -182,6 +182,10 @@
         ERROR1(" DAUDIO_Open: invalid encoding %d\n", (int) encoding);
         return NULL;
     }
+    if (channels <= 0) {
+        ERROR1(" DAUDIO_Open: Invalid number of channels=%d!\n", channels);
+        return NULL;
+    }
 
     info = (SolPcmInfo*) malloc(sizeof(SolPcmInfo));
     if (!info) {
--- a/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp	Tue Oct 18 04:14:51 2016 +0100
+++ b/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp	Tue Jul 12 11:19:59 2016 +0300
@@ -859,6 +859,10 @@
         ERROR1("DAUDIO_Open: ERROR: cannot open the device with encoding=%d!\n", encoding);
         return NULL;
     }
+    if (channels <= 0) {
+        ERROR1("DAUDIO_Open: ERROR: Invalid number of channels=%d!\n", channels);
+        return NULL;
+    }
     if (sampleSizeInBits > 8 &&
 #ifdef _LITTLE_ENDIAN
         isBigEndian