< prev index next >

test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveFiles.java

Print this page

        

*** 28,51 **** import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; /** * @test ! * @bug 8132782 */ ! public final class RecognizeHugeWaveFloatFiles { /** * The maximum size in bytes per WAVE specification. */ private static final /*unsigned int */ long MAX_UNSIGNED_INT = 0xffffffffL; /** * The supported wave pcm_float format and sample size in bits. */ private static final byte[][] waveTypeBits = { ! {0x0003/*WAVE_FORMAT_IEEE_FLOAT*/, 32} }; /** * The list of supported sample rates(stored as unsigned int). */ --- 28,61 ---- import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; /** * @test ! * @bug 8132782 6729836 */ ! public final class RecognizeHugeWaveFiles { /** * The maximum size in bytes per WAVE specification. */ private static final /*unsigned int */ long MAX_UNSIGNED_INT = 0xffffffffL; /** * The supported wave pcm_float format and sample size in bits. */ private static final byte[][] waveTypeBits = { ! {0x0001/*WAVE_FORMAT_PCM*/,1}, ! {0x0001/*WAVE_FORMAT_PCM*/,2}, ! {0x0001/*WAVE_FORMAT_PCM*/,4}, ! {0x0001/*WAVE_FORMAT_PCM*/,8}, ! {0x0001/*WAVE_FORMAT_PCM*/,16}, ! {0x0001/*WAVE_FORMAT_PCM*/,20}, ! {0x0001/*WAVE_FORMAT_PCM*/,24}, ! {0x0001/*WAVE_FORMAT_PCM*/,32}, ! {0x0003/*WAVE_FORMAT_IEEE_FLOAT*/, 32}, ! {0x0006/*WAVE_FORMAT_ALAW*/, 8}, ! {0x0007/*WAVE_FORMAT_MULAW*/, 8} }; /** * The list of supported sample rates(stored as unsigned int). */
*** 123,133 **** /** * Tests the {@code AudioInputStream} fetched from the fake header. * <p> * Note that the frameLength is stored as long which means that {@code ! * AudioInputStream} must store all possible data from au file. */ private static void testAIS(final byte[] type, final int rate, final int channel, final long size) throws Exception { final byte[] header = createHeader(type, rate, channel, size); --- 133,143 ---- /** * Tests the {@code AudioInputStream} fetched from the fake header. * <p> * Note that the frameLength is stored as long which means that {@code ! * AudioInputStream} must store all possible data from wave file. */ private static void testAIS(final byte[] type, final int rate, final int channel, final long size) throws Exception { final byte[] header = createHeader(type, rate, channel, size);
*** 164,175 **** if (format.getChannels() != channel) { System.err.println("Expected: " + channel); System.err.println("Actual: " + format.getChannels()); throw new RuntimeException(); } ! if (format.getFrameSize() != ((bits + 7) / 8) * channel) { ! System.err.println("Expected: " + (bits * channel + 1) / 8); System.err.println("Actual: " + format.getFrameSize()); throw new RuntimeException(); } } --- 174,186 ---- if (format.getChannels() != channel) { System.err.println("Expected: " + channel); System.err.println("Actual: " + format.getChannels()); throw new RuntimeException(); } ! int frameSize = ((bits + 7) / 8) * channel; ! if (format.getFrameSize() != frameSize) { ! System.err.println("Expected: " + frameSize); System.err.println("Actual: " + format.getFrameSize()); throw new RuntimeException(); } }
< prev index next >