<Sound Dev> [9] Review Request: 8038139 AudioInputStream.getFrameLength() returns wrong value for floating-point WAV

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Feb 5 17:20:02 UTC 2016

Hello, Audio Guru.

Please review the fix for jdk9.
There are two bugs in this area:
  - in the WaveExtensibleFileReader.java/WaveFloatFileReader.java we 
create the AudioInputStream using the data size in bytes instead of the 
the size in frames. In the fix the size in bytes is divided by the size 
of the frame.
  - in AiffFileWriter.java we incorrectly calculate the data size in 
bytes(for example if the sample size is less than 8). instead of
     numFrames * channels * sampleSize / 8
it should be
     numFrames * channels * ((sampleSize + 7) / 8)

And when later we read this data in AiffFilereader we incorrectly 
calculate the FrameLength.

In the test I created some fake stream and converted it to a different 
formats with expectation that FrameLength will be preserved.

Bug: https://bugs.openjdk.java.net/browse/JDK-8038139
Webrev can be found at: http://cr.openjdk.java.net/~serb/8038139/webrev.00

Best regards, Sergey.

More information about the sound-dev mailing list