United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6672710 Allow for openjdk sound to be built without the binary plugs (IMPORT_BINARY_PLUGS=false)
JDK-6672710 : Allow for openjdk sound to be built without the binary plugs (IMPORT_BINARY_PLUGS=false)

Details
Type:
Bug
Submit Date:
2008-03-07
Status:
Resolved
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2008-03-07
Component:
infrastructure
OS:
generic
Sub-Component:
build
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
OpenJDK6
Fixed Versions:
OpenJDK6 (b07)

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

Description
This is a bit of a temporary measure until the "open" sound replacement code is in place.

These changes allow for the openjdk6 sources to build without the binary plugs being imported. Building would need to use:

   gnumake OPENJDK=true IMPORT_BINARY_PLUGS=false ...

The sound replacement code is on it's way and this change may not last long.

                                    

Comments
SUGGESTED FIX

--- old/make/javax/sound/Makefile	Thu Mar  6 14:20:52 2008
+++ new/make/javax/sound/Makefile	Thu Mar  6 14:20:52 2008
@@ -58,11 +58,16 @@
 #
 ifdef OPENJDK
 
+  # skip closed lib if the flag is set
+  ifeq ($(IMPORT_BINARY_PLUGS),true)
+
 # copy closed .class files
-build: import-binary-plug-sound-classes 
+build: import-binary-plug-sound-classes
 
 include $(BUILDDIR)/common/internal/BinaryPlugs.gmk
 
+  endif # IMPORT_BINARY_PLUGS
+
 endif # OPENJDK
 
 #
@@ -98,7 +103,13 @@
 #
 # add "closed" library
 #
-SUBDIRS += jsoundhs
+ifdef OPENJDK
+  ifeq ($(IMPORT_BINARY_PLUGS),true)
+    SUBDIRS += jsoundhs
+  endif # IMPORT_BINARY_PLUGS
+else
+  SUBDIRS += jsoundhs
+endif # OPENJDK
 
 #
 # system dependent flags
--- old/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Thu Mar  6 14:20:53 2008
+++ new/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Thu Mar  6 14:20:53 2008
@@ -75,13 +75,6 @@
     /**
      * This is the device handle returned from native code
      */
-    /*
-     * $$rratta Solaris 64 bit holds pointer must be long
-     *
-     * $$mp 2003-08-07:
-     * 'id' is a really bad name. The variable should
-     * be called nativePointer or something similar.
-     */
     protected long id                   = 0;
 
 
@@ -586,7 +579,6 @@
 
         private ArrayList<Transmitter> transmitters = new ArrayList<Transmitter>();
         private MidiOutDevice.MidiOutReceiver midiOutReceiver;
-        private MixerSynth.SynthReceiver mixerSynthReceiver;
 
         // how many transmitters must be present for optimized
         // handling
@@ -621,22 +613,14 @@
                 if (midiOutReceiver == oldR) {
                     midiOutReceiver = null;
                 }
-                if (mixerSynthReceiver == oldR) {
-                    mixerSynthReceiver = null;
-                }
                 if (newR != null) {
                     if ((newR instanceof MidiOutDevice.MidiOutReceiver)
                         && (midiOutReceiver == null)) {
                         midiOutReceiver = ((MidiOutDevice.MidiOutReceiver) newR);
                     }
-                    if ((newR instanceof MixerSynth.SynthReceiver)
-                        && (mixerSynthReceiver == null)) {
-                        mixerSynthReceiver = ((MixerSynth.SynthReceiver) newR);
-                    }
                 }
                 optimizedReceiverCount =
-                      ((midiOutReceiver!=null)?1:0)
-                    + ((mixerSynthReceiver!=null)?1:0);
+                      ((midiOutReceiver!=null)?1:0);
             }
             // more potential for optimization here
         }
@@ -670,10 +654,6 @@
                             if (TRACE_TRANSMITTER) Printer.println("Sending packed message to MidiOutReceiver");
                             midiOutReceiver.sendPackedMidiMessage(packedMessage, timeStamp);
                         }
-                        if (mixerSynthReceiver != null) {
-                            if (TRACE_TRANSMITTER) Printer.println("Sending packed message to MixerSynthReceiver");
-                            mixerSynthReceiver.sendPackedMidiMessage(packedMessage, timeStamp);
-                        }
                     } else {
                         if (TRACE_TRANSMITTER) Printer.println("Sending packed message to "+size+" transmitter's receivers");
                         for (int i = 0; i < size; i++) {
@@ -682,9 +662,6 @@
                                 if (optimizedReceiverCount > 0) {
                                     if (receiver instanceof MidiOutDevice.MidiOutReceiver) {
                                         ((MidiOutDevice.MidiOutReceiver) receiver).sendPackedMidiMessage(packedMessage, timeStamp);
-                                    }
-                                    else if (receiver instanceof MixerSynth.SynthReceiver) {
-                                        ((MixerSynth.SynthReceiver) receiver).sendPackedMidiMessage(packedMessage, timeStamp);
                                     } else {
                                         receiver.send(new FastShortMessage(packedMessage), timeStamp);
                                     }
@@ -739,10 +716,6 @@
                         if (TRACE_TRANSMITTER) Printer.println("Sending MIDI message to MidiOutReceiver");
                         midiOutReceiver.send(message, timeStamp);
                     }
-                    if (mixerSynthReceiver != null) {
-                        if (TRACE_TRANSMITTER) Printer.println("Sending MIDI message to MixerSynthReceiver");
-                        mixerSynthReceiver.send(message, timeStamp);
-                    }
                 } else {
                     if (TRACE_TRANSMITTER) Printer.println("Sending MIDI message to "+size+" transmitter's receivers");
                     for (int i = 0; i < size; i++) {
--- old/src/share/classes/com/sun/media/sound/Platform.java	Thu Mar  6 14:20:53 2008
+++ new/src/share/classes/com/sun/media/sound/Platform.java	Thu Mar  6 14:20:53 2008
@@ -158,14 +158,20 @@
         if(Printer.trace)Printer.trace(">>Platform.loadLibraries");
 
         try {
-            // load the main libraries
+            // load the main library
             JSSecurityManager.loadLibrary(libNameMain);
-            JSSecurityManager.loadLibrary(libNameMain2);
             // just for the heck of it...
             loadedLibs |= LIB_MAIN;
+            // load "closed" library
+            JSSecurityManager.loadLibrary(libNameMain2);
         } catch (SecurityException e) {
             if(Printer.err)Printer.err("Security exception loading main native library.  JavaSound requires access to these resources.");
             throw(e);
+        } catch (UnsatisfiedLinkError e) {
+            // libNameMain2 may be absent!
+            if ((loadedLibs & LIB_MAIN) != LIB_MAIN) {
+                throw(e);
+            }
         }
 
         // now try to load extra libs. They are defined at compile time in the Makefile
--- old/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Thu Mar  6 14:20:54 2008
+++ new/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Thu Mar  6 14:20:54 2008
@@ -146,7 +146,7 @@
 
 
     /** for RMF media we need the RMF sequencer */
-    private MixerSequencer seqBridge = null;
+    private Sequencer seqBridge = null;
 
     /** automatic connection support */
     private boolean autoConnect = false;
@@ -259,7 +259,12 @@
                 // seems to be RMF
                 if (seqBridge == null) {
                     try {
-                        seqBridge = new MixerSequencer();
+                        try {
+                            Class cls = Class.forName("com.sun.media.sound.MixerSequencer");
+                            seqBridge = (Sequencer)cls.newInstance();
+                        } catch (Exception ex) {
+                            throw new InvalidMidiDataException();
+                        }
                         if (isOpen()) {
                             seqBridge.open();
                         }
                                     
2008-03-07
EVALUATION

See suggested fix
                                     
2008-03-07



Hardware and Software, Engineered to Work Together