Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8294904

Incorrect treatment of 24-bit sampling resolutions in the WAVE format

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Only on Windows. This has been a bug since at least version 7 of the jdk.

      A DESCRIPTION OF THE PROBLEM :
      The relevant Windows native code is in jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp.

      The above code treats sampled audio lines with the 8- and 16-bit sampling resolutions as pulse code modulation (PCM) with WAVE format compression code 0x0001 and anything else as needing the extensible WAVE format (assuming this is with compression code 0xFFFE). This prevents Java on Windows from opening sampled audio devices for 24-bit audio playback and recording. In short, Java on Windows does not support 24-bit sampled audio, which has now emerged as the professional standard.

      The fixes would be simple: add 24 bit to line 282 and change 16 to 24 on line 643 of the file. This was tested and would be sufficient to both play and record 24-bit PCM sampled audio.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use the standard Windows sound controls (e.g., control panel) to verify that the existing audio device / soundcard supports 24-bit audio. To replicate the issue:
      1. The following line:
      java.sound.sampled.mixer::isLineSupported(DataLine.Info);
      for that device returns false, whereas it should return true.
      2. The following two lines:

      SourceDataLine someLine = (SourceDataLine) java.sound.sampled.mixer::.getLine(DataLine.Info);
      someLine.open(format, someBufferSize);

      would return an error if format is 24-bit PCM.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      One should be able to open and start 24-bit source and target data lines for devices that support 24-bit sampled audio.
      ACTUAL -
      See the steps to reproduce above.

      CUSTOMER SUBMITTED WORKAROUND :
      A solution is provided in the description. There is no known workaround., as the extensible wave format created by createWaveFormat() in PLATFORM_API_WinOS_DirectSound.cpp will cause an error.

      FREQUENCY : always


            kizune Alexander Zuev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: