jdk/test/javax/sound/sampled/FileWriter/AlawEncoderSync.java
author serb
Tue, 12 Nov 2013 20:24:25 +0400
changeset 21596 0e3a39f29dbc
parent 12413 896432906c20
child 23010 6dadb192ad81
permissions -rw-r--r--
8027696: Incorrect copyright header in the tests Reviewed-by: alanb, malenkov, mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12413
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
     1
/*
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
     2
 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
     4
 *
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
21596
0e3a39f29dbc 8027696: Incorrect copyright header in the tests
serb
parents: 12413
diff changeset
     7
 * published by the Free Software Foundation.
12413
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
     8
 *
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    13
 * accompanied this code).
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    14
 *
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    18
 *
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    21
 * questions.
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    22
 */
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    23
8526
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    24
/**
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    25
 * @test
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    26
 * @bug 6938426
12413
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    27
 * @bug 7058852
8526
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    28
 * @summary Tests that Alaw encoder works properly in multithreaded environment
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    29
 * @author Alex Menkov
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    30
 */
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    31
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    32
import java.io.ByteArrayInputStream;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    33
import java.io.ByteArrayOutputStream;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    34
import java.io.InputStream;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    35
import java.util.Arrays;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    36
import javax.sound.sampled.AudioFormat;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    37
import javax.sound.sampled.AudioInputStream;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    38
import javax.sound.sampled.AudioSystem;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    39
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    40
public class AlawEncoderSync {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    41
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    42
    static final int THREAD_COUNT   = 20;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    43
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    44
    static final AudioFormat pcmFormat = new AudioFormat(8000f, 16, 2, true, false);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    45
    static final int STREAM_LENGTH = 10;    // in seconds
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    46
    static byte[] pcmBuffer;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    47
    static final AudioFormat alawFormat
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    48
            = new AudioFormat(AudioFormat.Encoding.ALAW, 8000f, 8, 2, 2, 8000f, false);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    49
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    50
    static final ConversionThread[] threads = new ConversionThread[THREAD_COUNT];
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    51
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    52
    public static void main(String[] args) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    53
        preparePCMBuffer();
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    54
        log("pcmStream size: " + pcmBuffer.length);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    55
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    56
        for (int i=0; i<THREAD_COUNT; i++) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    57
            threads[i] = new ConversionThread(i);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    58
            threads[i].start();
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    59
        }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    60
12413
896432906c20 7058852: javax/sound/sampled/FileWriter/AlawEncoderSync.java failing intermittently
amenkov
parents: 8526
diff changeset
    61
        for (int i=0; i<THREAD_COUNT; i++) {
8526
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    62
            try {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    63
                threads[i].join();
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    64
            } catch (InterruptedException ex) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    65
                log("Main thread was interrupted, exiting.");
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    66
                return;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    67
            }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    68
        }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    69
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    70
        int failed = 0;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    71
        log("comparing result arrays...");
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    72
        for (int i=1; i<THREAD_COUNT; i++) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    73
            if (!Arrays.equals(threads[0].resultArray, threads[i].resultArray)) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    74
                failed++;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    75
                log("NOT equals: 0 and " + i);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    76
            }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    77
        }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    78
        if (failed > 0) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    79
            throw new RuntimeException("test FAILED");
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    80
        }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    81
        log("test PASSED.");
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    82
    }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    83
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    84
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    85
    static void preparePCMBuffer() {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    86
        pcmBuffer = new byte[STREAM_LENGTH * (int)pcmFormat.getSampleRate()
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    87
                * (pcmFormat.getSampleSizeInBits() / 8) * pcmFormat.getChannels()];
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    88
        for (int i=0; i<pcmBuffer.length; i++) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    89
            pcmBuffer[i] = (byte)(Math.random() * 256.0 - 128.0);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    90
        }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    91
    }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    92
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    93
    static AudioInputStream createPCMStream() {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    94
        InputStream byteStream = new ByteArrayInputStream(pcmBuffer);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    95
        return new AudioInputStream(byteStream, pcmFormat, AudioSystem.NOT_SPECIFIED);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    96
    }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    97
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    98
    static class ConversionThread extends Thread {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
    99
        public final int num;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   100
        public byte[] resultArray = null;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   101
        public ConversionThread(int num) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   102
            this.num = num;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   103
        }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   104
        @Override
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   105
        public void run() {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   106
            log("ConversionThread[" + num + "] started.");
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   107
            try {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   108
                InputStream inStream = new ByteArrayInputStream(pcmBuffer);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   109
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   110
                AudioInputStream pcmStream = new AudioInputStream(
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   111
                        inStream, pcmFormat, AudioSystem.NOT_SPECIFIED);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   112
                AudioInputStream alawStream = AudioSystem.getAudioInputStream(alawFormat, pcmStream);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   113
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   114
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   115
                int read = 0;
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   116
                byte[] data = new byte[4096];
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   117
                while((read = alawStream.read(data)) != -1) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   118
                    outStream.write(data, 0, read);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   119
               }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   120
               alawStream.close();
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   121
               resultArray = outStream.toByteArray();
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   122
            } catch (Exception ex) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   123
                log("ConversionThread[" + num + "] exception:");
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   124
                log(ex);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   125
            }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   126
            log("ConversionThread[" + num + "] completed.");
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   127
        }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   128
    }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   129
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   130
    static void log(String s) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   131
        System.out.println(s);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   132
    }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   133
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   134
    static void log(Exception ex) {
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   135
        ex.printStackTrace(System.out);
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   136
    }
398796acdbd5 6938426: Concurrency bug in ALAW encoder causes random bursts of static/noise in output.
amenkov
parents:
diff changeset
   137
}