< prev index next >

src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp

Print this page
rev 1553 : 8157753: Audio replay enhancement
Reviewed-by: prr

@@ -857,10 +857,14 @@
     }
     if (encoding != DAUDIO_PCM) {
         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
 #else
         !isBigEndian
< prev index next >