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

re-open #4281181 (Changing sample rate while clip is playing -> aborts)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs

      jerry.barnes@eng 2001-02-21
      This bug shows up in SQE testing as well.
      Simply change sample rate while a clip is playing and the application will crash and the message regarding "An unexpected exception has been detected in native code outside the VM" is displayed.
      This bug is a block to reliability testing.


      Name: krC82822 Date: 12/19/2000


      orig synopsis: "Bug #4281181 test program doesn't work"

      19 Dec 2000, eval1127@eng -- once the test program is altered
      to run without the noted exception, it fails with an
      "unexpected exception...outside the VM"
      (under both 1.3.0 and merlin-beta45)
      Thus, this may be a runtime/HS issue, not a classes_sound issue, per se
      ------------------

      user's submission:

      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      I had some problems with the SAMPLE_RATE control, so I entered the sample
      program at the bottom of bug #4281181. The sample program does not work.
      Specifically, it fails with this stack trace:

      java.lang.IllegalArgumentException: This method should not have been invoked!
              at com.sun.media.sound.MixerClip.implOpen(Unknown Source)
              at com.sun.media.sound.AbstractDataLine.open(Unknown Source)
              at com.sun.media.sound.AbstractDataLine.open(Unknown Source)
              at SoundTest.main(SoundTest.java:24)

      The problem is that the Clip.open() method is being called with no parameters.
      It should read "Clip.open(ais)".

      I am reporting this as a bug because the error message is not helpful, even
      though the semantics of the test program are wrong. Also, it is sort of a
      "metabug" since the bug database has a bug :)

      ---------------

      19 Dec 2000, eval1127@eng -- with 1.3.0, using the "new test" at the
      bottom of bug # 42811 (with "Bug4281181" substituted for
      "SoundTest" classname):

      java.lang.IllegalArgumentException: This method should not have been invoked!
              at com.sun.media.sound.MixerClip.implOpen(MixerClip.java:457)
              at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:87)
              at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:383)
              at Bug4281181.main(Bug4281181.java:21)

      The reason this compiles is because open() is valid in superinterface Line.

      Replacing open() with open(ais) plays the sound, but then aborts with:

      # # An unexpected exception has been detected in native code outside the VM.#
      Program counter=0xfe0cf488
      #
      # Problematic Thread: prio=10 tid=0x1c5930 nid=0xc runnable
      #
      Abort

      -------------

      With merlin(1.4) beta 45, the .wav plays longer, but the program still aborts:

      % java -version
      java version "1.4.0beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b45)
      Java HotSpot(TM) Client VM (build 1.4beta-B45, mixed mode)

      % javac -d . Bug4281181.java

      % java Bug4281181 drums.wav
      drums.wav
      # # An unexpected exception has been detected in native code outside the VM.#
      Program counter=0xfaada890
      #
      # Problematic Thread: prio=10 tid=0x23a130 nid=0xc runnable
      #
      Abort




           1 import javax.sound.sampled.*;
           2 import java.io.File;
           3
           4 public class Bug4281181 {
           5 public static void main(String args[]) {
           6 if (args.length != 1) {
           7 System.out.println("Usage : java Bug4281181 foobar.wav");
           8 System.exit(0);
           9 }
          10 try {
          11 File file = new File(args[0]);
          12 System.out.println(file);
          13 AudioInputStream ais = AudioSystem.getAudioInputStream(file);
          14 AudioFormat format = ais.getFormat();
          15 DataLine.Info info = new DataLine.Info(
          16 Clip.class,
          17 format,
          18 ((int) ais.getFrameLength() *
          19 format.getFrameSize()));
          20 Clip clip = (Clip) AudioSystem.getLine(info);
          21 clip.open();
          22 FloatControl rateControl =
          23 (FloatControl) clip.getControl(FloatControl.Type.SAMPLE_RATE);
          24 while(true) {
          25 clip.stop();
          26 clip.setFramePosition(0);
          27 clip.start();
          28 for(float frq = 22000; frq < 44100; frq = frq + 100) {
          29 try {
          30 Thread.currentThread().sleep(20);
          31 } catch (Exception e) {break;}
          32 rateControl.setValue(frq);
          33 }
          34 }
          35 } catch (Exception ex) { ex.printStackTrace(); }
          36 }
          37 }

      (Review ID: 110294)
      ======================================================================

            amenkov Alex Menkov
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: