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

JVM crash playing AudioClip

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Won't Fix
    • Affects Version/s: 7u45
    • Fix Version/s: 7-pool
    • Component/s: javafx
    • Environment:

      Windows 7, Windows 8, JRE7u45 32 bits at least

      Description

      When playing many AudioClip, the JVM crashes brutally.

      Don't know is it's related to playing always the same or just very frequently.
      use the <Note1.wav> from Java FX Ensemble.jar

      [Dynamic-linking native method com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer.gstGetPresentationTime ... JNI]
      [Dynamic-linking native method com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMedia.gstDispose ... JNI]

      import java.net.URL;

      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.media.AudioClip;
      import javafx.stage.Stage;

      public class AudioMain extends Application {
      public static void main(String[] args) {
      launch(AudioMain.class, args);
      }

      @Override
      public void start(final Stage primaryStage) throws Exception {
      final Label label = new Label();

      final AudioThread at = new AudioThread(100, label);

      primaryStage.setResizable(false);
      primaryStage.setScene(new Scene(label, 200, 100));
      primaryStage.show();

      at.start();
      }

      private final class AudioThread extends Thread {
      /** sleep time */
      private final int sleep;
      private final Label label;

      private AudioThread(final int sleep, final Label label) {
      super("Audio-Thread");

      setPriority(Thread.MIN_PRIORITY);
      setDaemon(true);

      this.sleep = sleep;
      this.label = label;
      }

      @Override
      public void run() {
      final int[] run = new int[1];
      run[0] = 0;

      for (;;) {
      try {
      final URL url = AudioMain.class.getResource("Note1.wav");
      final String string = url.toString();
      final AudioClip audioClip = new AudioClip(string);

      audioClip.play();

      Platform.runLater(new Runnable() {

      @Override
      public void run() {
      label.setText(String.valueOf(run[0]++));
      }
      });

      sleep(this.sleep);
      } catch (final Throwable throwable) {
      throwable.printStackTrace();
      }
      }
      }
      }
      }

        Attachments

          Activity

            People

            Assignee:
            alexp Alexander Potochkin (Inactive)
            Reporter:
            sdazujfx Senf Dazu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: