### Eclipse Workspace Patch 1.0 #P Spark Index: build/lib/dist/windows/jnspeex.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnspeex.dll =================================================================== --- build/lib/dist/windows/jnspeex.dll (revision 0) +++ build/lib/dist/windows/jnspeex.dll (working copy) Property changes on: build/lib/dist/windows/jnspeex.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreference.java =================================================================== --- src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreference.java (revision 13875) +++ src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreference.java (working copy) @@ -85,6 +85,7 @@ panel.setAudioDevice(localPreferences.getAudioDevice()); panel.setStunServer(localPreferences.getStunFallbackHost()); panel.setStunPort(localPreferences.getStunFallbackPort()); + panel.setPlaybackDevice(localPreferences.getPlaybackDevice()); } @Override @@ -94,6 +95,7 @@ pref.setVideoDevice(panel.getVideoDevice()); pref.setStunFallbackHost(panel.getStunServer()); pref.setStunFallbackPort(panel.getStunPort()); + pref.setPlaybackDevice(panel.getPlaybackDevice()); SettingsManager.saveSettings(); } Index: build/lib/dist/windows/jnvpx.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnvpx.dll =================================================================== --- build/lib/dist/windows/jnvpx.dll (revision 0) +++ build/lib/dist/windows/jnvpx.dll (working copy) Property changes on: build/lib/dist/windows/jnvpx.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows/jnportaudio.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnportaudio.dll =================================================================== --- build/lib/dist/windows/jnportaudio.dll (revision 0) +++ build/lib/dist/windows/jnportaudio.dll (working copy) Property changes on: build/lib/dist/windows/jnportaudio.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreferencePanel.java =================================================================== --- src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreferencePanel.java (revision 13875) +++ src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreferencePanel.java (working copy) @@ -41,9 +41,17 @@ import javax.swing.JPanel; import javax.swing.JTextField; -import net.sf.fmj.media.RegistryDefaults; -import net.sf.fmj.media.cdp.GlobalCaptureDevicePlugger; - +import org.jitsi.impl.neomedia.MediaServiceImpl; +import org.jitsi.impl.neomedia.device.AudioSystem; +import org.jitsi.impl.neomedia.device.AudioSystem.DataFlow; +import org.jitsi.impl.neomedia.device.CaptureDeviceInfo2; +import org.jitsi.service.configuration.ConfigurationService; +import org.jitsi.service.libjitsi.LibJitsi; +import org.jitsi.service.neomedia.MediaService; +import org.jitsi.service.neomedia.MediaType; +import org.jitsi.service.neomedia.MediaUseCase; +import org.jitsi.service.neomedia.device.MediaDevice; +import org.jivesoftware.Spark; import org.jivesoftware.resource.Res; import org.jivesoftware.spark.component.VerticalFlowLayout; import org.jivesoftware.spark.util.ResourceUtils; @@ -51,14 +59,16 @@ public class MediaPreferencePanel extends JPanel { private static final long serialVersionUID = 8297469864676223072L; - private Vector vectorAudioDevices; + private Vector vectorAudioDevices; private Vector vectorVideoDevices; - + private Vector vectorPlaybackDevices = new Vector(); + private JComboBox audioDevice = new JComboBox(); + private JComboBox playbackDevice = new JComboBox(); private JComboBox videoDevice = new JComboBox(); private JTextField _stunServerInput = new JTextField(); - private JTextField _stunPortInput = new JTextField(); - + private JTextField _stunPortInput = new JTextField(); + public MediaPreferencePanel() { setLayout(new VerticalFlowLayout()); @@ -67,15 +77,20 @@ add(panel); panel.setLayout(new GridBagLayout()); + + JLabel lPlaybackAudio = new JLabel(); // Res.getString("label.audio.device")); + panel.add( lPlaybackAudio, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); + panel.add(playbackDevice, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); + JLabel lAudio = new JLabel(); // Res.getString("label.audio.device")); - panel.add( lAudio, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); - panel.add(audioDevice, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); + panel.add( lAudio, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); + panel.add(audioDevice, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); JLabel lVideo = new JLabel(); // Res.getString("label.video.device")); - panel.add( lVideo, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); - panel.add(videoDevice, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); + panel.add( lVideo, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); + panel.add(videoDevice, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); JButton redetect = new JButton(); // Res.getString("button.re.detect") ); redetect.addActionListener(new ActionListener() { @@ -87,11 +102,12 @@ }); - panel.add(redetect,new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); + panel.add(redetect,new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0)); // Setup Mnemonics ResourceUtils.resButton(redetect, Res.getString("button.re.detect")); ResourceUtils.resLabel(lVideo, videoDevice, Res.getString("label.video.device") + ":"); + ResourceUtils.resLabel(lPlaybackAudio, playbackDevice, Res.getString("label.audio.device") + ":"); ResourceUtils.resLabel(lAudio, audioDevice, Res.getString("label.audio.device") + ":"); scanDevices(); @@ -110,6 +126,8 @@ return res; } + + @SuppressWarnings("unchecked") public void scanDevices() { @@ -116,11 +134,33 @@ // Remove all Items audioDevice.removeAllItems(); videoDevice.removeAllItems(); + playbackDevice.removeAllItems(); + vectorPlaybackDevices.removeAllElements(); + // FMJ - RegistryDefaults.registerAll(RegistryDefaults.FMJ | RegistryDefaults.FMJ_NATIVE); - GlobalCaptureDevicePlugger.addCaptureDevices(); + System.setProperty(ConfigurationService.PNAME_SC_HOME_DIR_LOCATION, Spark.getUserHome()); + System.setProperty(ConfigurationService.PNAME_SC_HOME_DIR_NAME, "."); + System.setProperty(ConfigurationService.PNAME_SC_CACHE_DIR_LOCATION, Spark.getUserHome()); + System.setProperty(ConfigurationService.PNAME_SC_LOG_DIR_LOCATION, Spark.getUserHome()); + LibJitsi.start(); + + MediaType[] mediaTypes = MediaType.values(); + MediaService mediaService = LibJitsi.getMediaService(); + for (MediaType mediaType : mediaTypes) + { + System.err.println("================================"); + System.err.println("MediaType: " + mediaType); + System.out.println(mediaService); + + MediaDevice device = mediaService.getDefaultDevice(mediaType, MediaUseCase.CALL); + System.out.println(device.getDirection()); + System.err.println("Device: " + device); + System.err.println("================================"); + } + + vectorAudioDevices = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.LINEAR)); for ( CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices) { @@ -132,6 +172,14 @@ { videoDevice.addItem(convertSysString(infoCaptureDevice.getName())); } + vectorVideoDevices.add(null); + videoDevice.addItem(""); + + AudioSystem audioSystem = ((MediaServiceImpl)LibJitsi.getMediaService()).getDeviceConfiguration().getAudioSystem(); + for (CaptureDeviceInfo2 device : audioSystem.getDevices(DataFlow.PLAYBACK)) { + playbackDevice.addItem(convertSysString(device.getName())); + vectorPlaybackDevices.add(device); + } } private void createSTUNPanel() @@ -161,16 +209,39 @@ } public void setAudioDevice(String device) { - for ( CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices) { + AudioSystem audioSystem = ((MediaServiceImpl)LibJitsi.getMediaService()).getDeviceConfiguration().getAudioSystem(); + for ( CaptureDeviceInfo2 infoCaptureDevice : vectorAudioDevices) { if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) { audioDevice.setSelectedItem(infoCaptureDevice.getName()); + audioSystem.setDevice(DataFlow.CAPTURE, infoCaptureDevice, true); } } } + public String getPlaybackDevice() { + if (playbackDevice.getSelectedIndex() >= 0) { + return vectorPlaybackDevices.get(playbackDevice.getSelectedIndex()).getLocator().toExternalForm(); + } + return ""; + } + + public void setPlaybackDevice(String device) { + AudioSystem audioSystem = ((MediaServiceImpl)LibJitsi.getMediaService()).getDeviceConfiguration().getAudioSystem(); + for ( CaptureDeviceInfo2 infoCaptureDevice : vectorPlaybackDevices) { + if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) { + playbackDevice.setSelectedItem(infoCaptureDevice.getName()); + audioSystem.setDevice(DataFlow.PLAYBACK, infoCaptureDevice, true); + audioSystem.setDevice(DataFlow.NOTIFY , infoCaptureDevice, true); + } + } + } + + + public void setVideoDevice(String device) { for ( CaptureDeviceInfo infoCaptureDevice : vectorVideoDevices) { - if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) { + if (infoCaptureDevice != null && + infoCaptureDevice.getLocator().toExternalForm().equals(device)) { videoDevice.setSelectedItem(infoCaptureDevice.getName()); } } @@ -178,6 +249,9 @@ public String getVideoDevice() { if (videoDevice.getSelectedIndex() >= 0) { + if (vectorVideoDevices.get(videoDevice.getSelectedIndex()) == null) { + return ""; + } return vectorVideoDevices.get(videoDevice.getSelectedIndex()).getLocator().toExternalForm(); } return ""; Index: build/lib/dist/fmj.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/libjitsi.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/libjitsi.jar =================================================================== --- build/lib/dist/libjitsi.jar (revision 0) +++ build/lib/dist/libjitsi.jar (working copy) Property changes on: build/lib/dist/libjitsi.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows/jnopus.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnopus.dll =================================================================== --- build/lib/dist/windows/jnopus.dll (revision 0) +++ build/lib/dist/windows/jnopus.dll (working copy) Property changes on: build/lib/dist/windows/jnopus.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneManager.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneManager.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneManager.java (working copy) @@ -680,8 +680,10 @@ localAudioPort = mediaDescription.getMedia().getMediaPort(); else if (mediaDescription.getMedia().getMediaType().equals("video")) localVideoPort = mediaDescription.getMedia().getMediaPort(); + } + AudioMediaSession audioMediaSession = mediaManager.createAudioMediaSession(call.getRemoteSdpDescription().toString(), localAudioPort); call.setAudioMediaSession(audioMediaSession); @@ -719,7 +721,7 @@ int destPort = ((MediaDescription) (call.getRemoteSdpDescription().getMediaDescriptions(true).get(0))).getMedia().getMediaPort(); String destIp = call.getRemoteSdpDescription().getConnection().getAddress(); - AudioReceiverChannel audioReceiverChannel = mediaManager.createAudioReceiverChannel(localPort, destIp, destPort); + AudioReceiverChannel audioReceiverChannel = mediaManager.createAudioReceiverChannel(localPort, destIp, destPort, (destPort + 1)); call.setAudioReceiverChannel(audioReceiverChannel); if (audioReceiverChannel != null) @@ -877,7 +879,7 @@ } PhoneManager.setUsingMediaLocator(true); - + SessionDescription sdpData = null; try { sdpData = mediaManager.generateSdpDescription(); Index: build/lib/dist/windows64/jnawtrenderer.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnawtrenderer.dll =================================================================== --- build/lib/dist/windows64/jnawtrenderer.dll (revision 0) +++ build/lib/dist/windows64/jnawtrenderer.dll (working copy) Property changes on: build/lib/dist/windows64/jnawtrenderer.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/sdes4j.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/sdes4j.jar =================================================================== --- build/lib/dist/sdes4j.jar (revision 0) +++ build/lib/dist/sdes4j.jar (working copy) Property changes on: build/lib/dist/sdes4j.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/osgi.core.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/osgi.core.jar =================================================================== --- build/lib/dist/osgi.core.jar (revision 0) +++ build/lib/dist/osgi.core.jar (working copy) Property changes on: build/lib/dist/osgi.core.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows/jnffmpeg.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnffmpeg.dll =================================================================== --- build/lib/dist/windows/jnffmpeg.dll (revision 0) +++ build/lib/dist/windows/jnffmpeg.dll (working copy) Property changes on: build/lib/dist/windows/jnffmpeg.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows64/jng722.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jng722.dll =================================================================== --- build/lib/dist/windows64/jng722.dll (revision 0) +++ build/lib/dist/windows64/jng722.dll (working copy) Property changes on: build/lib/dist/windows64/jng722.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/net/java/sipmack/media/JmfMediaManager.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/media/JmfMediaManager.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/media/JmfMediaManager.java (working copy) @@ -19,6 +19,8 @@ */ package net.java.sipmack.media; +import gov.nist.javax.sdp.fields.SDPFormat; + import java.io.File; import java.io.IOException; import java.net.Inet6Address; @@ -43,7 +45,6 @@ import javax.sdp.TimeDescription; import javax.sdp.Version; -import net.java.sip.communicator.impl.media.codec.Constants; import net.java.sipmack.common.Log; import net.java.sipmack.sip.Call; import net.java.sipmack.sip.NetworkAddressManager; @@ -50,10 +51,17 @@ import net.java.sipmack.sip.SIPConfig; import net.sf.fmj.media.BonusAudioFormatEncodings; +import org.jitsi.impl.neomedia.MediaUtils; +import org.jitsi.service.libjitsi.LibJitsi; +import org.jitsi.service.neomedia.codec.Constants; +import org.jitsi.service.neomedia.format.MediaFormat; +import org.jitsi.service.neomedia.format.MediaFormatFactory; import org.jivesoftware.sparkimpl.plugin.phone.JMFInit; import org.jivesoftware.sparkimpl.settings.local.LocalPreferences; import org.jivesoftware.sparkimpl.settings.local.SettingsManager; +import com.sun.org.apache.bcel.internal.generic.INSTANCEOF; + /** * JmfMediaManager using JMF based API. * It supports GSM, G711 and G723 codecs. @@ -83,7 +91,7 @@ * @param local * @return */ - public AudioMediaSession createMediaSession(final AudioFormat audioFormat, final TransportCandidate remote, final TransportCandidate local) { + public AudioMediaSession createMediaSession(final MediaFormat audioFormat, final TransportCandidate remote, final TransportCandidate local) { return new AudioMediaSession(audioFormat, remote, local, SettingsManager.getLocalPreferences().getAudioDevice()); } @@ -95,7 +103,6 @@ audioFormats.add(new AudioFormat(Constants.ALAW_RTP)); audioFormats.add(new AudioFormat(AudioFormat.ULAW_RTP)); audioFormats.add(new AudioFormat(AudioFormat.GSM_RTP)); - audioFormats.add(new AudioFormat(BonusAudioFormatEncodings.ILBC_RTP)); audioFormats.add(new AudioFormat(AudioFormat.G723_RTP)); } @@ -185,7 +192,7 @@ remoteTransmisionDetails.put("video", sessionRemoteAddress); } ArrayList ports = new ArrayList(); - ArrayList> formatSets = new ArrayList>(); + ArrayList> formatSets = new ArrayList>(); ArrayList contents = new ArrayList(); ArrayList localPorts = new ArrayList(); for (int i = 0; i < mediaDescriptions.size(); i++) { @@ -204,6 +211,7 @@ // Find ports try { mediaPort = media.getMediaPort(); + System.out.println("MediaType:" + mediaType + ":" + mediaPort); } catch (SdpParseException ex) { throw (new MediaException( @@ -351,7 +359,7 @@ remoteTransmisionDetails.put("video", sessionRemoteAddress); } ArrayList ports = new ArrayList(); - ArrayList> formatSets = new ArrayList>(); + ArrayList> formatSets = new ArrayList>(); ArrayList contents = new ArrayList(); ArrayList localPorts = new ArrayList(); for (int i = 0; i < mediaDescriptions.size(); i++) { @@ -370,6 +378,8 @@ // Find ports try { mediaPort = media.getMediaPort(); + System.out.println("MediaType:" + mediaType + ":" + mediaPort); + } catch (SdpParseException ex) { throw (new MediaException( @@ -430,8 +440,11 @@ else localPorts.add(Integer.valueOf(mediaPort)); + + //formatSets + // .add(); formatSets - .add(extractTransmittableJmfFormats(sdpFormats)); + .add(extractTransmittableJmfFormats(sdpFormats)); } catch (MediaException ex) { Log.error("StartMedia", ex); @@ -444,13 +457,23 @@ } if (atLeastOneTransmitterStarted) { + System.out.println("Remote Port: " + ports.get(0)); + TransportCandidate.Fixed remote = new TransportCandidate.Fixed(remoteAddresses.get(0).toString(), (Integer) ports.get(0)); TransportCandidate.Fixed local = new TransportCandidate.Fixed(NetworkAddressManager.getLocalHost().getHostAddress(), localPort); - AudioFormat audioFormat = new AudioFormat(((formatSets.get(0)).get(0))); - - AudioMediaSession audioMediaSession = new AudioMediaSession(audioFormat, remote, local, SettingsManager.getLocalPreferences().getAudioDevice()); + MediaFormat format = (formatSets.get(0)).get(0); + System.out.println("MediaFormat: " + format); + System.out.println("MediaFormat: " + format.getRTPPayloadType()); + System.out.println("MediaFormat: " + format.getMediaType()); + + MediaFormat mediaFormat = LibJitsi.getMediaService().getFormatFactory().createMediaFormat("speex", 8000); + System.out.println("MediaFormat: " + mediaFormat); + System.out.println("MediaFormat: " + mediaFormat.getRTPPayloadType()); + System.out.println("MediaFormat: " + mediaFormat.getMediaType()); + AudioMediaSession audioMediaSession = new AudioMediaSession(mediaFormat, remote, local, SettingsManager.getLocalPreferences().getAudioDevice()); + return audioMediaSession; } return null; @@ -463,9 +486,9 @@ * @return * @throws MediaException */ - public AudioReceiverChannel createAudioReceiverChannel(int localPort, String remoteIp, int remotePort) throws MediaException { + public AudioReceiverChannel createAudioReceiverChannel(int localPort, String remoteIp, int remotePort, int remoteRTCPPort) throws MediaException { - AudioReceiverChannel audioReceiverChannel = new AudioReceiverChannel(NetworkAddressManager.getLocalHost().getHostAddress(), localPort, remoteIp, remotePort); + AudioReceiverChannel audioReceiverChannel = new AudioReceiverChannel(NetworkAddressManager.getLocalHost().getHostAddress(), localPort, remoteIp, remotePort,remoteRTCPPort); return audioReceiverChannel; @@ -478,14 +501,25 @@ * @return * @throws MediaException */ - protected ArrayList extractTransmittableJmfFormats(Vector sdpFormats) + protected ArrayList extractTransmittableJmfFormats(Vector sdpFormats) throws MediaException { - ArrayList jmfFormats = new ArrayList(); + ArrayList jmfFormats = new ArrayList(); for (int i = 0; i < sdpFormats.size(); i++) { - String jmfFormat = AudioFormatUtils.findCorrespondingJmfFormat(sdpFormats + System.out.println("Add1 ++++++++++++++++++" + sdpFormats); + + if (Integer.parseInt((String)sdpFormats.get(0)) == 31) + { + System.out.println(sdpFormats.get(0)); + MediaFormat videoformat = LibJitsi.getMediaService().getFormatFactory().createMediaFormat( + "H264", + MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED); + jmfFormats.add(videoformat); + } + MediaFormat mediaFormat = AudioFormatUtils.findCorrespondingJmfFormat(sdpFormats .elementAt(i).toString()); - if (jmfFormat != null) { - jmfFormats.add(jmfFormat); + if (mediaFormat != null) { + System.out.println("Add2 ++++++++++++++++++" + mediaFormat); + jmfFormats.add(mediaFormat); } } if (jmfFormats.size() == 0) { @@ -734,7 +768,8 @@ } } } - System.out.println("FORMATE NEU: " + format); + + System.out.println("FORMATE NEU: " + format); return format; } } Index: src/java/org/jivesoftware/spark/phone/PhoneManager.java =================================================================== --- src/java/org/jivesoftware/spark/phone/PhoneManager.java (revision 13875) +++ src/java/org/jivesoftware/spark/phone/PhoneManager.java (working copy) @@ -19,6 +19,25 @@ */ package org.jivesoftware.spark.phone; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Vector; +import java.util.concurrent.CopyOnWriteArrayList; + +import javax.media.CaptureDeviceInfo; +import javax.media.CaptureDeviceManager; +import javax.media.MediaLocator; +import javax.media.format.AudioFormat; +import javax.media.format.VideoFormat; +import javax.media.protocol.DataSource; +import javax.swing.Action; +import javax.swing.JMenu; +import javax.swing.JPopupMenu; + +import org.jivesoftware.Spark; import org.jivesoftware.resource.Res; import org.jivesoftware.resource.SparkRes; import org.jivesoftware.spark.ChatManager; @@ -32,21 +51,7 @@ import org.jivesoftware.spark.ui.rooms.ChatRoomImpl; import org.jivesoftware.spark.util.SwingWorker; import org.jivesoftware.sparkimpl.plugin.phone.JMFInit; -import org.jivesoftware.Spark; -import javax.swing.Action; -import javax.swing.JMenu; -import javax.swing.JPopupMenu; -import javax.media.MediaLocator; -import javax.media.protocol.DataSource; - -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - /** * Handles general phone behavior in Spark. This allows for many different phone systems * to plug into Spark in a more elegant way. @@ -277,6 +282,32 @@ public static MediaLocator getMediaLocator(String locator) { MediaLocator auxLocator; + System.out.println("--------------------------------"); + System.out.println("locator: " + locator); + + Vector vectorAudioDevices = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.LINEAR)); + for ( CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices) + { + System.out.println(infoCaptureDevice.getLocator() + "-" + locator); + if (infoCaptureDevice.getLocator().toString().equals(locator)) + { + System.out.println("Found: " + locator); + return infoCaptureDevice.getLocator(); + } + } + + Vector vectorVideoDevices = CaptureDeviceManager.getDeviceList(new VideoFormat(VideoFormat.RGB)); + for ( CaptureDeviceInfo infoCaptureDevice : vectorVideoDevices ) + { + System.out.println(infoCaptureDevice.getLocator() + "-" + locator); + if (infoCaptureDevice.getLocator().toString().equals(locator)) + { + System.out.println("Found: " + locator); + return infoCaptureDevice.getLocator(); + } + } + + if (useStaticLocator) { if (mediaLocator == null) { mediaLocator = new MediaLocator(locator); Index: src/plugins/sip/src/java/net/java/sipmack/media/VideoReceiver.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/media/VideoReceiver.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/media/VideoReceiver.java (working copy) @@ -74,9 +74,12 @@ */ public synchronized void update(ReceiveStreamEvent evt) { + Participant participant = evt.getParticipant(); // could be null. ReceiveStream stream = evt.getReceiveStream(); // could be null. + System.out.println(evt); + if (evt instanceof RemotePayloadChangeEvent) { System.err.println(" - Received an RTP PayloadChangeEvent."); Index: build/lib/dist/jspeex.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/jspeex.jar =================================================================== --- build/lib/dist/jspeex.jar (revision 0) +++ build/lib/dist/jspeex.jar (working copy) Property changes on: build/lib/dist/jspeex.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows64/jnscreencapture.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnscreencapture.dll =================================================================== --- build/lib/dist/windows64/jnscreencapture.dll (revision 0) +++ build/lib/dist/windows64/jnscreencapture.dll (working copy) Property changes on: build/lib/dist/windows64/jnscreencapture.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows64/jnspeex.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnspeex.dll =================================================================== --- build/lib/dist/windows64/jnspeex.dll (revision 0) +++ build/lib/dist/windows64/jnspeex.dll (working copy) Property changes on: build/lib/dist/windows64/jnspeex.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/org/jivesoftware/sparkplugin/preferences/AudioPreferenceDialog.java =================================================================== --- src/plugins/sip/src/java/org/jivesoftware/sparkplugin/preferences/AudioPreferenceDialog.java (revision 13875) +++ src/plugins/sip/src/java/org/jivesoftware/sparkplugin/preferences/AudioPreferenceDialog.java (working copy) @@ -20,7 +20,9 @@ package org.jivesoftware.sparkplugin.preferences; import org.jivesoftware.sparkplugin.ui.components.JavaMixer; + import net.java.sipmack.softphone.SoftPhoneManager; + import org.jivesoftware.spark.SparkManager; import org.jivesoftware.spark.util.GraphicUtils; @@ -28,6 +30,7 @@ import javax.media.cdm.CaptureDeviceManager; import javax.media.format.AudioFormat; import javax.swing.*; + import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -41,7 +44,7 @@ public class AudioPreferenceDialog extends JPanel { private static final long serialVersionUID = -7436724748439424479L; - private JComboBox audioBox = new JComboBox(); + private JComboBox audioBox = new JComboBox(); private JDialog dialog; private JButton closeButton; private JavaMixer javaMixer = new JavaMixer(); @@ -49,7 +52,7 @@ public AudioPreferenceDialog() { setLayout(new GridBagLayout()); - audioBox = new JComboBox(); + audioBox = new JComboBox(); final JLabel inputValueLabel = new JLabel("Input Volume:"); final JLabel outputValueLabel = new JLabel("Output Volume:"); Index: build/lib/dist/windows64/jnffmpeg.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnffmpeg.dll =================================================================== --- build/lib/dist/windows64/jnffmpeg.dll (revision 0) +++ build/lib/dist/windows64/jnffmpeg.dll (working copy) Property changes on: build/lib/dist/windows64/jnffmpeg.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows/jnwasapi.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnwasapi.dll =================================================================== --- build/lib/dist/windows/jnwasapi.dll (revision 0) +++ build/lib/dist/windows/jnwasapi.dll (working copy) Property changes on: build/lib/dist/windows/jnwasapi.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows64/jnopus.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnopus.dll =================================================================== --- build/lib/dist/windows64/jnopus.dll (revision 0) +++ build/lib/dist/windows64/jnopus.dll (working copy) Property changes on: build/lib/dist/windows64/jnopus.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/ice4j.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/ice4j.jar =================================================================== --- build/lib/dist/ice4j.jar (revision 0) +++ build/lib/dist/ice4j.jar (working copy) Property changes on: build/lib/dist/ice4j.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioFormatUtils.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/media/AudioFormatUtils.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/media/AudioFormatUtils.java (working copy) @@ -23,90 +23,102 @@ import javax.media.format.VideoFormat; import javax.sdp.SdpConstants; -import net.java.sip.communicator.impl.media.codec.Constants; import net.sf.fmj.media.BonusAudioFormatEncodings; import net.sf.fmj.media.datasink.rtp.RTPBonusFormatsMgr; +import org.jitsi.service.libjitsi.LibJitsi; +import org.jitsi.service.neomedia.MediaService; +import org.jitsi.service.neomedia.codec.Constants; +import org.jitsi.service.neomedia.format.MediaFormat; +import org.jitsi.service.neomedia.format.MediaFormatFactory; + /** * Audio Format Utils. - * + * * @author Thiago Camargo */ public class AudioFormatUtils { - protected static String findCorrespondingJmfFormat(String sdpFormatStr) { - int sdpFormat = -1; - try { - sdpFormat = Integer.parseInt(sdpFormatStr); - } - catch (NumberFormatException ex) { - return null; - } - // return AudioFormat.GSM_RTP; - switch (sdpFormat) { - case SdpConstants.PCMU: - return AudioFormat.ULAW_RTP; - case SdpConstants.GSM: - return AudioFormat.GSM_RTP; - case SdpConstants.G723: - return AudioFormat.G723_RTP; - case SdpConstants.DVI4_8000: - return AudioFormat.DVI_RTP; - case SdpConstants.DVI4_16000: - return AudioFormat.DVI_RTP; - case SdpConstants.PCMA: - return BonusAudioFormatEncodings.ALAW_RTP; - case SdpConstants.G728: - return AudioFormat.G728_RTP; - case SdpConstants.G729: - return AudioFormat.G729_RTP; - case RTPBonusFormatsMgr.SPEEX_RTP_INDEX: // 110 - return Constants.SPEEX_RTP; - case RTPBonusFormatsMgr.ILBC_RTP_INDEX: - return BonusAudioFormatEncodings.ILBC_RTP; - case SdpConstants.H263: - return VideoFormat.H263_RTP; - case SdpConstants.JPEG: - return VideoFormat.JPEG_RTP; - case SdpConstants.H261: - return VideoFormat.H261_RTP; - default: - return null; - } - } + protected static MediaFormat findCorrespondingJmfFormat(String sdpFormatStr) { + int sdpFormat = Integer.parseInt(sdpFormatStr); + MediaService mediaService = LibJitsi.getMediaService(); + switch (sdpFormat) { + case SdpConstants.PCMU: + return mediaService.getFormatFactory().createMediaFormat("PCMU", + 8000); + case SdpConstants.GSM: + return mediaService.getFormatFactory().createMediaFormat( + AudioFormat.GSM, 8000); + case SdpConstants.G723: + return mediaService.getFormatFactory().createMediaFormat( + AudioFormat.G723, 8000); + case SdpConstants.DVI4_8000: + return mediaService.getFormatFactory().createMediaFormat( + AudioFormat.DVI, 8000); + case SdpConstants.DVI4_16000: + return mediaService.getFormatFactory().createMediaFormat( + AudioFormat.DVI, 16000); + case SdpConstants.PCMA: + return mediaService.getFormatFactory().createMediaFormat("PCMA", + 8000); + case SdpConstants.G728: + return mediaService.getFormatFactory().createMediaFormat( + AudioFormat.G728, 8000); + case SdpConstants.G729: + return mediaService.getFormatFactory().createMediaFormat( + AudioFormat.G729, 8000); + case RTPBonusFormatsMgr.SPEEX_RTP_INDEX: // 110 + return mediaService.getFormatFactory().createMediaFormat("SPEEX", + 8000); + case SdpConstants.H263: + return mediaService.getFormatFactory().createMediaFormat("H263", + MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED); + case SdpConstants.JPEG: + return mediaService.getFormatFactory().createMediaFormat("JPEG", + MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED); + case SdpConstants.H261: + return mediaService.getFormatFactory().createMediaFormat("H261", + MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED); + default: + byte sdpFormat2 = Byte.parseByte(sdpFormatStr); + return mediaService.getFormatFactory() + .createMediaFormat(sdpFormat2); + } - protected static String findCorrespondingSdpFormat(String jmfFormat) { - if (jmfFormat == null) { - return null; - } else if (jmfFormat.equals(AudioFormat.ULAW_RTP)) { - return Integer.toString(SdpConstants.PCMU); - } else if (jmfFormat.equals(AudioFormat.GSM_RTP)) { - return Integer.toString(SdpConstants.GSM); - } else if (jmfFormat.equals(AudioFormat.G723_RTP)) { - return Integer.toString(SdpConstants.G723); - } else if (jmfFormat.equals(AudioFormat.DVI_RTP)) { - return Integer.toString(SdpConstants.DVI4_8000); - } else if (jmfFormat.equals(AudioFormat.DVI_RTP)) { - return Integer.toString(SdpConstants.DVI4_16000); - } else if (jmfFormat.equals(BonusAudioFormatEncodings.ALAW_RTP)) { - return Integer.toString(SdpConstants.PCMA); - } else if (jmfFormat.equals(AudioFormat.G728_RTP)) { - return Integer.toString(SdpConstants.G728); - } else if (jmfFormat.equals(AudioFormat.G729_RTP)) { - return Integer.toString(SdpConstants.G729); - } else if (jmfFormat.equals(Constants.SPEEX_RTP)) { - return Integer.toString(RTPBonusFormatsMgr.SPEEX_RTP_INDEX); - } else if (jmfFormat.equals(BonusAudioFormatEncodings.ILBC_RTP)) { - return Integer.toString(RTPBonusFormatsMgr.ILBC_RTP_INDEX); - } else if (jmfFormat.equals(VideoFormat.H263_RTP)) { - return Integer.toString(SdpConstants.H263); - } else if (jmfFormat.equals(VideoFormat.JPEG_RTP)) { - return Integer.toString(SdpConstants.JPEG); - } else if (jmfFormat.equals(VideoFormat.H261_RTP)) { - return Integer.toString(SdpConstants.H261); - } else { - return null; - } - } + } + protected static String findCorrespondingSdpFormat(String jmfFormat) { + if (jmfFormat == null) { + return null; + } else if (jmfFormat.equals(AudioFormat.ULAW_RTP)) { + return Integer.toString(SdpConstants.PCMU); + } else if (jmfFormat.equals(AudioFormat.GSM_RTP)) { + return Integer.toString(SdpConstants.GSM); + } else if (jmfFormat.equals(AudioFormat.G723_RTP)) { + return Integer.toString(SdpConstants.G723); + } else if (jmfFormat.equals(AudioFormat.DVI_RTP)) { + return Integer.toString(SdpConstants.DVI4_8000); + } else if (jmfFormat.equals(AudioFormat.DVI_RTP)) { + return Integer.toString(SdpConstants.DVI4_16000); + } else if (jmfFormat.equals(BonusAudioFormatEncodings.ALAW_RTP)) { + return Integer.toString(SdpConstants.PCMA); + } else if (jmfFormat.equals(AudioFormat.G728_RTP)) { + return Integer.toString(SdpConstants.G728); + } else if (jmfFormat.equals(AudioFormat.G729_RTP)) { + return Integer.toString(SdpConstants.G729); + } else if (jmfFormat.equals(Constants.SPEEX_RTP)) { + return Integer.toString(RTPBonusFormatsMgr.SPEEX_RTP_INDEX); + } else if (jmfFormat.equals(BonusAudioFormatEncodings.ILBC_RTP)) { + return Integer.toString(RTPBonusFormatsMgr.ILBC_RTP_INDEX); + } else if (jmfFormat.equals(VideoFormat.H263_RTP)) { + return Integer.toString(SdpConstants.H263); + } else if (jmfFormat.equals(VideoFormat.JPEG_RTP)) { + return Integer.toString(SdpConstants.JPEG); + } else if (jmfFormat.equals(VideoFormat.H261_RTP)) { + return Integer.toString(SdpConstants.H261); + } else { + return null; + } + } + } Index: build/lib/dist/bcpkix.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/bcpkix.jar =================================================================== --- build/lib/dist/bcpkix.jar (revision 0) +++ build/lib/dist/bcpkix.jar (working copy) Property changes on: build/lib/dist/bcpkix.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/java/org/jivesoftware/sparkimpl/plugin/privacy/ui/PrivacyAddDialogUI.java =================================================================== --- src/java/org/jivesoftware/sparkimpl/plugin/privacy/ui/PrivacyAddDialogUI.java (revision 13875) +++ src/java/org/jivesoftware/sparkimpl/plugin/privacy/ui/PrivacyAddDialogUI.java (working copy) @@ -66,8 +66,8 @@ private JCheckBox _showOffCheckbox = new JCheckBox(); private static final long serialVersionUID = -7725304880236329893L; - private DefaultListModel model = new DefaultListModel(); - private JList rosterList = new JList(model); + private DefaultListModel model = new DefaultListModel(); + private JList rosterList = new JList(model); private boolean _showGroups = false; private List _userList = new ArrayList(); private JCheckBox _blockPIn; Index: build/lib/dist/bcprov.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/bcprov.jar =================================================================== --- build/lib/dist/bcprov.jar (revision 0) +++ build/lib/dist/bcprov.jar (working copy) Property changes on: build/lib/dist/bcprov.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows64/jndirectshow.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jndirectshow.dll =================================================================== --- build/lib/dist/windows64/jndirectshow.dll (revision 0) +++ build/lib/dist/windows64/jndirectshow.dll (working copy) Property changes on: build/lib/dist/windows64/jndirectshow.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows64/jnwasapi.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnwasapi.dll =================================================================== --- build/lib/dist/windows64/jnwasapi.dll (revision 0) +++ build/lib/dist/windows64/jnwasapi.dll (working copy) Property changes on: build/lib/dist/windows64/jnwasapi.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/build.xml =================================================================== --- build/build.xml (revision 13875) +++ build/build.xml (working copy) @@ -1019,7 +1019,7 @@ - + Index: build/lib/dist/zrtp4j-light.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/zrtp4j-light.jar =================================================================== --- build/lib/dist/zrtp4j-light.jar (revision 0) +++ build/lib/dist/zrtp4j-light.jar (working copy) Property changes on: build/lib/dist/zrtp4j-light.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioMediaSession.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/media/AudioMediaSession.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/media/AudioMediaSession.java (working copy) @@ -23,9 +23,9 @@ import java.io.IOException; import java.net.ServerSocket; -import javax.media.format.AudioFormat; import javax.media.rtp.ReceiveStreamListener; +import org.jitsi.service.neomedia.format.MediaFormat; import org.jivesoftware.spark.phone.PhoneManager; import org.jivesoftware.sparkimpl.settings.local.SettingsManager; @@ -45,7 +45,7 @@ private AudioChannel audioChannel; private String locator = "javasound://"; // AudioFormat of the Session - private AudioFormat audioFormat; + private MediaFormat audioFormat; // Local Transport details private TransportCandidate local; // Remote Transport details @@ -58,7 +58,7 @@ * @param remote The remote information. The candidate that the jmf will be sent to. * @param local The local information. The candidate that will receive the jmf */ - public AudioMediaSession(final AudioFormat audioFormat, final TransportCandidate remote, + public AudioMediaSession(final MediaFormat audioFormat, final TransportCandidate remote, final TransportCandidate local) { this(audioFormat, remote, local, SettingsManager.getLocalPreferences().getAudioDevice()); } @@ -70,8 +70,9 @@ * @param remote The remote information. The candidate that the jmf will be sent to. * @param local The local information. The candidate that will receive the jmf */ - public AudioMediaSession(final AudioFormat audioFormat, final TransportCandidate remote, + public AudioMediaSession(final MediaFormat audioFormat, final TransportCandidate remote, final TransportCandidate local, String locator) { + this.local = local; this.remote = remote; this.audioFormat = audioFormat; @@ -87,7 +88,7 @@ * * @return */ - public AudioFormat getAudioFormat() { + public MediaFormat getAudioFormat() { return audioFormat; } @@ -125,7 +126,6 @@ localPort = getFreePort(); remotePort = this.getLocal().getSymmetric().getPort(); - System.out.println(this.getLocal().getConnection() + " " + ip + ": " + localPort + "->" + remotePort); } else { ip = this.getRemote().getIp(); @@ -133,8 +133,10 @@ localPort = this.getLocal().getPort(); remotePort = this.getRemote().getPort(); } + System.out.println(this.getLocal().getConnection() + " " + ip + ": " + localPort + "->" + remotePort); - audioChannel = new AudioChannel(PhoneManager.getMediaLocator(locator), localIp, ip, localPort, remotePort, audioFormat); + System.out.println("1----> AudioChannel"); + audioChannel = new AudioChannel(PhoneManager.getMediaLocator(locator), localIp, ip, localPort,-1, remotePort, -1, audioFormat); } /** Index: build/lib/dist/windows/jndirectshow.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jndirectshow.dll =================================================================== --- build/lib/dist/windows/jndirectshow.dll (revision 0) +++ build/lib/dist/windows/jndirectshow.dll (working copy) Property changes on: build/lib/dist/windows/jndirectshow.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows64/jnvpx.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnvpx.dll =================================================================== --- build/lib/dist/windows64/jnvpx.dll (revision 0) +++ build/lib/dist/windows64/jnvpx.dll (working copy) Property changes on: build/lib/dist/windows64/jnvpx.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/net/java/sipmack/media/VideoChannel.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/media/VideoChannel.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/media/VideoChannel.java (working copy) @@ -19,8 +19,13 @@ */ package net.java.sipmack.media; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; import java.io.IOException; +import java.net.DatagramSocket; import java.net.InetAddress; +import java.net.InetSocketAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; @@ -28,36 +33,39 @@ import javax.media.CaptureDeviceInfo; import javax.media.CaptureDeviceManager; -import javax.media.Codec; -import javax.media.Controller; import javax.media.ControllerClosedEvent; import javax.media.ControllerEvent; import javax.media.ControllerListener; import javax.media.Format; import javax.media.MediaLocator; -import javax.media.NoDataSourceException; -import javax.media.NoProcessorException; -import javax.media.PlugInManager; import javax.media.Processor; -import javax.media.control.BufferControl; -import javax.media.control.PacketSizeControl; -import javax.media.control.TrackControl; -import javax.media.format.AudioFormat; import javax.media.format.VideoFormat; -import javax.media.protocol.ContentDescriptor; -import javax.media.protocol.DataSource; -import javax.media.protocol.PushBufferDataSource; -import javax.media.protocol.PushBufferStream; -import javax.media.rtp.RTPManager; import javax.media.rtp.ReceiveStreamListener; import javax.media.rtp.SendStream; -import javax.media.rtp.SessionAddress; +import javax.swing.JFrame; +import javax.swing.JPanel; -import net.java.sipmack.sip.SIPConfig; import net.sf.fmj.media.RegistryDefaults; -import net.sf.fmj.media.cdp.GlobalCaptureDevicePlugger; +import org.jitsi.impl.neomedia.device.MediaDeviceImpl; +import org.jitsi.service.libjitsi.LibJitsi; +import org.jitsi.service.neomedia.DefaultStreamConnector; +import org.jitsi.service.neomedia.MediaDirection; +import org.jitsi.service.neomedia.MediaService; +import org.jitsi.service.neomedia.MediaStream; +import org.jitsi.service.neomedia.MediaStreamTarget; +import org.jitsi.service.neomedia.MediaType; +import org.jitsi.service.neomedia.MediaUseCase; +import org.jitsi.service.neomedia.StreamConnector; +import org.jitsi.service.neomedia.VideoMediaStream; +import org.jitsi.service.neomedia.device.MediaDevice; +import org.jitsi.service.neomedia.format.MediaFormat; +import org.jitsi.service.neomedia.format.MediaFormatFactory; +import org.jitsi.util.event.VideoEvent; +import org.jitsi.util.event.VideoListener; +import org.jitsi.util.swing.VideoContainer; + public class VideoChannel { private MediaLocator locator; @@ -64,20 +72,15 @@ private String localIpAddress; private String ipAddress; private int localPort; - private int portBase; + private int localRTCPPort; + private int remotePort; + private int remoteRTCPPort; private Format format; - - private Processor processor = null; - private RTPManager rtpMgrs[]; - private DataSource dataOutput = null; - private VideoReceiver videoReceiver; - + private StreamConnector connector; private List sendStreams = new ArrayList(); - private List receiveListeners = new ArrayList(); - - private boolean started = false; - + MediaStream mediaStream = null; + /** * Creates an Audio Channel for a desired jmf locator. For instance: new MediaLocator("dsound://") * @@ -98,11 +101,28 @@ this.localIpAddress = localIpAddress; this.ipAddress = ipAddress; this.localPort = localPort; - this.portBase = remotePort; + this.localRTCPPort = (localPort + 1); + this.remotePort = remotePort; + this.remoteRTCPPort = (remotePort + 1); + this.format = format; - this.format = new VideoFormat(VideoFormat.JPEG_RTP); - } + + public synchronized void checkVideo() + { + JPanel visualComponent = new JPanel( new BorderLayout() ); + VideoMediaStream vms = ((VideoMediaStream) mediaStream); + visualComponent.setBackground(Color.BLACK); + for( Component c : vms.getVisualComponents() ) { + VideoContainer vc = new VideoContainer(c,true); + visualComponent.add(vc); + } + + JFrame frame = new JFrame("Frame"); + frame.setSize(640, 480); + frame.add(visualComponent); + frame.setVisible(true); + } /** * Starts the transmission. Returns null if transmission started ok. @@ -110,31 +130,56 @@ * Starts receive also. */ public synchronized String start() { - if (started) return null; - started = true; - String result; + try { + MediaService mediaService = LibJitsi.getMediaService(); + MediaDevice device = mediaService.getDefaultDevice(MediaType.VIDEO, MediaUseCase.ANY); + + mediaStream = mediaService.createMediaStream(device); + mediaStream.setDirection(MediaDirection.SENDRECV); + + MediaFormat usedformat = mediaService.getFormatFactory().createMediaFormat( + "H264", + MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED); + + byte dynamicRTPPayloadType = 99; + mediaStream.addDynamicRTPPayloadType( + dynamicRTPPayloadType, + usedformat); + + mediaStream.setFormat(usedformat); + + connector = new DefaultStreamConnector(new DatagramSocket(this.localPort),new DatagramSocket(this.localRTCPPort)); + mediaStream.setConnector(connector); + mediaStream.setTarget( + new MediaStreamTarget( + new InetSocketAddress(this.ipAddress, this.remotePort), + new InetSocketAddress(this.ipAddress, this.remoteRTCPPort))); + mediaStream.setName(MediaType.VIDEO.toString()); + + ((VideoMediaStream) mediaStream).addVideoListener(new VideoListener(){ - // Create a processor for the specified jmf locator - result = createProcessor(); - if (result != null) { - started = false; - return result; - } + @Override + public void videoAdded(VideoEvent arg0) { + checkVideo(); + } - // Create an RTP session to transmit the output of the - // processor to the specified IP address and port no. - result = createTransmitter(); - if (result != null) { - processor.close(); - processor = null; - started = false; - return result; - } + @Override + public void videoRemoved(VideoEvent arg0) { + } - // Start the transmission - processor.start(); + @Override + public void videoUpdate(VideoEvent arg0) { + } + + }); + mediaStream.start(); - return null; + } + catch (Exception e) + { + e.printStackTrace(); + } + return null; } /** @@ -144,9 +189,7 @@ */ public void addReceiverListener(ReceiveStreamListener listener) { this.receiveListeners.add(listener); - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].addReceiveStreamListener(listener); - } + } /** @@ -156,9 +199,6 @@ */ public void removeReceiverListener(ReceiveStreamListener listener) { this.receiveListeners.remove(listener); - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].removeReceiveStreamListener(listener); - } } /** @@ -165,11 +205,6 @@ * Removes All Receive Listeners. */ private void remevoAllReceiverListener() { - for (ReceiveStreamListener listener : receiveListeners) { - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].removeReceiveStreamListener(listener); - } - } this.receiveListeners.clear(); } @@ -178,222 +213,21 @@ * Stops the receiver also. */ public void stop() { - if (!started) return; - synchronized (this) { - try { - started = false; - - remevoAllReceiverListener(); - - if (processor != null) { - processor.stop(); - processor = null; - - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].removeReceiveStreamListener(videoReceiver); - rtpMgrs[i].removeSessionListener(videoReceiver); - rtpMgrs[i].removeTargets("Session ended."); - rtpMgrs[i].dispose(); - } - - sendStreams.clear(); - - } - } catch (Exception e) { - e.printStackTrace(); - } - } - System.err.println("RTP Transmission Stopped."); + if (connector != null) { + connector.stopped(); + connector.close(); + connector = null; + } + if (mediaStream != null) { + mediaStream.stop(); + mediaStream.close(); + mediaStream = null; + } + + remevoAllReceiverListener(); } /** - * Creates a JMF media PRocessor - * - * @return - */ - private String createProcessor() { - if (locator == null) - return "Locator is null"; - - - System.out.println("CREATE PROCESSOR:" + locator); - - // Try to create a processor to handle the input jmf locator - try { - try { - processor = javax.media.Manager.createProcessor( javax.media.Manager.createDataSource(locator)); - } catch (NoDataSourceException e) { - e.printStackTrace(); - } - } catch (NoProcessorException npe) { - npe.printStackTrace(); - return "Couldn't create processor"; - } catch (IOException ioe) { - ioe.printStackTrace(); - return "IOException creating processor"; - } - - // Wait for it to configure - boolean result = waitForState(processor, Processor.Configured); - if (result == false) - return "Couldn't configure processor"; - - // Get the tracks from the processor - TrackControl[] tracks = processor.getTrackControls(); - - // Do we have atleast one track? - if (tracks == null || tracks.length < 1) - return "Couldn't find tracks in processor"; - - // Set the output content descriptor to RAW_RTP - // This will limit the supported formats reported from - // Track.getSupportedFormats to only valid RTP formats. - ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP); - processor.setContentDescriptor(cd); - - Format supported[]; - Format chosen = null; - boolean atLeastOneTrack = false; - - // Program the tracks. - for (int i = 0; i < tracks.length; i++) { - if (tracks[i].isEnabled()) { - - supported = tracks[i].getSupportedFormats(); - - if (supported.length > 0) { - for (Format format : supported) { - if (format instanceof VideoFormat) { - System.out.println(format); - if (this.format.matches(format)) - chosen = format; - } - } - - if (chosen != null) { - tracks[i].setFormat(chosen); - System.err.println("Track " + i + " is set to transmit as:"); - System.err.println(" " + chosen); - - if (tracks[i].getFormat() instanceof AudioFormat) { - int packetRate = 20; - PacketSizeControl pktCtrl = (PacketSizeControl) processor.getControl(PacketSizeControl.class.getName()); - if (pktCtrl != null) { - try { - pktCtrl.setPacketSize(getPacketSize(tracks[i].getFormat(), packetRate)); - } catch (IllegalArgumentException e) { - pktCtrl.setPacketSize(160); - // Do nothing - } - } - } - - atLeastOneTrack = true; - } else - tracks[i].setEnabled(false); - } else - tracks[i].setEnabled(false); - } - } - - if (!atLeastOneTrack) - return "Couldn't set any of the tracks to a valid RTP format"; - - result = waitForState(processor, Controller.Realized); - if (result == false) - return "Couldn't realize processor"; - - // Get the output data source of the processor - dataOutput = processor.getDataOutput(); - - return null; - } - - /** - * Get the best packet size for a given codec and a codec rate - * - * @param codecFormat - * @param milliseconds - * @return - * @throws IllegalArgumentException - */ - private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException { - String encoding = codecFormat.getEncoding(); - if (encoding.equalsIgnoreCase(AudioFormat.G729) || - encoding.equalsIgnoreCase(AudioFormat.G729_RTP)) { - return milliseconds * 1; // 1 byte per millisec - } else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) || - encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) { - return milliseconds * 8; - } else { - throw new IllegalArgumentException("Unknown codec type"); - } - } - - /** - * Use the RTPManager API to create sessions for each jmf - * track of the processor. - */ - private String createTransmitter() { - - // Cheated. Should have checked the type. - PushBufferDataSource pbds = (PushBufferDataSource) dataOutput; - PushBufferStream pbss[] = pbds.getStreams(); - - rtpMgrs = new RTPManager[pbss.length]; - SessionAddress localAddr, destAddr; - InetAddress ipAddr; - SendStream sendStream; - - videoReceiver = new VideoReceiver(this); - - int port; - - for (int i = 0; i < pbss.length; i++) { - try { - rtpMgrs[i] = RTPManager.newInstance(); - - port = portBase + 2 * i; - ipAddr = InetAddress.getByName(ipAddress); - - localAddr = new SessionAddress(InetAddress.getByName(this.localIpAddress), - localPort); - - destAddr = new SessionAddress(ipAddr, port); - - rtpMgrs[i].addReceiveStreamListener(videoReceiver); - rtpMgrs[i].addSessionListener(videoReceiver); - - BufferControl bc = (BufferControl) rtpMgrs[i].getControl("javax.media.control.BufferControl"); - if (bc != null) { - int bl = 125; - bl = SIPConfig.getDefaultBufferLength() != -1 ? SIPConfig.getDefaultBufferLength() - : bl; - - bc.setBufferLength(bl); - } - - rtpMgrs[i].initialize(localAddr); - rtpMgrs[i].addTarget(destAddr); - - System.err.println("Created RTP session at " + localPort + " to: " + ipAddress + " " + port); - - sendStream = rtpMgrs[i].createSendStream(dataOutput, i); - - sendStreams.add(sendStream); - - sendStream.start(); - - } catch (Exception e) { - e.printStackTrace(); - return e.getMessage(); - } - } - - return null; - } - - /** * Set transmit activity. If the active is true, the instance should trasmit. * If it is set to false, the instance should pause transmit. * @@ -400,95 +234,10 @@ * @param active */ public void setTrasmit(boolean active) { - for (SendStream sendStream : sendStreams) { - try { - if (active) { - sendStream.start(); - System.out.println("START"); - } else { - sendStream.stop(); - System.out.println("STOP"); - } - } - catch (IOException e) { - e.printStackTrace(); - } - - } + mediaStream.setMute(active); } - /** - * ************************************************************* - * Convenience methods to handle processor's state changes. - * ************************************************************** - */ - private Integer stateLock = new Integer(0); - private boolean failed = false; - - Integer getStateLock() { - return stateLock; - } - - void setFailed() { - failed = true; - } - - private synchronized boolean waitForState(Processor p, int state) { - p.addControllerListener(new StateListener()); - failed = false; - - // Call the required method on the processor - if (state == Processor.Configured) { - p.configure(); - } else if (state == Processor.Realized) { - p.realize(); - } - - // Wait until we get an event that confirms the - // success of the method, or a failure event. - // See StateListener inner class - while (p.getState() < state && !failed) { - synchronized (getStateLock()) { - try { - getStateLock().wait(); - } catch (InterruptedException ie) { - return false; - } - } - } - - if (failed) - return false; - else - return true; - } - - /** - * ************************************************************* - * Inner Classes - * ************************************************************** - */ - - class StateListener implements ControllerListener { - - public void controllerUpdate(ControllerEvent ce) { - - // If there was an error during configure or - // realize, the processor will be closed - if (ce instanceof ControllerClosedEvent) - setFailed(); - - // All controller events, send a notification - // to the waiting thread in waitForState method. - if (ce instanceof ControllerEvent) { - synchronized (getStateLock()) { - getStateLock().notifyAll(); - } - } - } - } - public static void main(String args[]) { InetAddress localhost; @@ -496,25 +245,11 @@ // FMJ RegistryDefaults.registerAll(RegistryDefaults.FMJ | RegistryDefaults.FMJ_NATIVE ); //PlugInManager.addPlugIn(, in, out, type) - try - { - String JFFMPEG_VIDEO = "net.sourceforge.jffmpeg.VideoDecoder"; - Codec video = (Codec)Class.forName( JFFMPEG_VIDEO ).newInstance(); - - PlugInManager.addPlugIn( JFFMPEG_VIDEO, - video.getSupportedInputFormats(), - video.getSupportedInputFormats(), - PlugInManager.CODEC ); - } - catch (Exception e) - { - e.printStackTrace(); - } - + + LibJitsi.start(); // Add Device - GlobalCaptureDevicePlugger.addCaptureDevices(); - - + MediaType[] mediaTypes = MediaType.values(); + MediaService mediaService = LibJitsi.getMediaService(); // LOG ALL Devices final Vector vectorDevices = CaptureDeviceManager.getDeviceList(null); for ( CaptureDeviceInfo infoCaptureDevice : vectorDevices ) Index: build/lib/dist/bccontrib.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/bccontrib.jar =================================================================== --- build/lib/dist/bccontrib.jar (revision 0) +++ build/lib/dist/bccontrib.jar (working copy) Property changes on: build/lib/dist/bccontrib.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows/jnwincoreaudio.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnwincoreaudio.dll =================================================================== --- build/lib/dist/windows/jnwincoreaudio.dll (revision 0) +++ build/lib/dist/windows/jnwincoreaudio.dll (working copy) Property changes on: build/lib/dist/windows/jnwincoreaudio.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioChannel.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/media/AudioChannel.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/media/AudioChannel.java (working copy) @@ -19,58 +19,49 @@ */ package net.java.sipmack.media; -import java.io.IOException; +import java.net.DatagramSocket; import java.net.InetAddress; +import java.net.InetSocketAddress; import java.net.UnknownHostException; -import java.util.ArrayList; import java.util.List; +import java.util.Vector; -import javax.media.Controller; -import javax.media.ControllerClosedEvent; -import javax.media.ControllerEvent; -import javax.media.ControllerListener; +import javax.media.CaptureDeviceInfo; +import javax.media.CaptureDeviceManager; import javax.media.Format; import javax.media.MediaLocator; -import javax.media.NoProcessorException; -import javax.media.Processor; -import javax.media.control.BufferControl; -import javax.media.control.PacketSizeControl; -import javax.media.control.TrackControl; import javax.media.format.AudioFormat; -import javax.media.protocol.ContentDescriptor; -import javax.media.protocol.DataSource; -import javax.media.protocol.PushBufferDataSource; -import javax.media.protocol.PushBufferStream; -import javax.media.rtp.RTPManager; import javax.media.rtp.ReceiveStreamListener; -import javax.media.rtp.SendStream; -import javax.media.rtp.SessionAddress; -import net.java.sipmack.sip.SIPConfig; -import net.sf.fmj.media.datasink.rtp.RTPBonusFormatsMgr; -import org.jivesoftware.spark.phone.PhoneManager; -import org.jivesoftware.sparkimpl.plugin.phone.JMFInit; +import org.jitsi.impl.neomedia.MediaUtils; +import org.jitsi.impl.neomedia.device.AudioMediaDeviceImpl; +import org.jitsi.impl.neomedia.device.MediaDeviceImpl; +import org.jitsi.service.libjitsi.LibJitsi; +import org.jitsi.service.neomedia.DefaultStreamConnector; +import org.jitsi.service.neomedia.MediaDirection; +import org.jitsi.service.neomedia.MediaService; +import org.jitsi.service.neomedia.MediaStream; +import org.jitsi.service.neomedia.MediaStreamTarget; +import org.jitsi.service.neomedia.MediaType; +import org.jitsi.service.neomedia.MediaUseCase; +import org.jitsi.service.neomedia.StreamConnector; +import org.jitsi.service.neomedia.device.MediaDevice; +import org.jitsi.service.neomedia.format.MediaFormat; public class AudioChannel { - private MediaLocator locator; + private MediaLocator inLocator; private String localIpAddress; private String ipAddress; private int localPort; - private int portBase; - private Format format; - - private Processor processor = null; - private RTPManager rtpMgrs[]; - private DataSource dataOutput = null; - private AudioReceiver audioReceiver; - - private List sendStreams = new ArrayList(); - - private List receiveListeners = new ArrayList(); - + private int localRTCPPort; + private int remotePort; + private int remoteRTCPPort; + private MediaFormat format; + private StreamConnector connector; private boolean started = false; + MediaStream mediaStream = null; /** * Creates an Audio Channel for a desired jmf locator. For instance: new MediaLocator("dsound://") @@ -81,19 +72,22 @@ * @param remotePort * @param format */ - public AudioChannel(MediaLocator locator, + public AudioChannel(MediaLocator inLocator, String localIpAddress, String ipAddress, int localPort, + int localRTCPPort, int remotePort, - Format format) { + int remoteRTCPPort, + MediaFormat format) { - this.locator = locator; + this.inLocator = inLocator; this.localIpAddress = localIpAddress; this.ipAddress = ipAddress; this.localPort = localPort; - this.portBase = remotePort; + this.remotePort = remotePort; this.format = format; + } /** @@ -102,31 +96,46 @@ * Starts receive also. */ public synchronized String start() { - if (started) return null; - started = true; - String result; + try + { + + MediaService mediaService = LibJitsi.getMediaService(); - // Create a processor for the specified jmf locator - result = createProcessor(); - if (result != null) { - started = false; - return result; - } - - // Create an RTP session to transmit the output of the - // processor to the specified IP address and port no. - result = createTransmitter(); - if (result != null) { - processor.close(); - processor = null; - started = false; - return result; - } - - // Start the transmission - processor.start(); - - return null; + MediaDevice device = null; + List devices = mediaService.getDevices(MediaType.AUDIO, MediaUseCase.CALL); + for (MediaDevice foundDevice : devices) + { + if (foundDevice instanceof AudioMediaDeviceImpl) + { + AudioMediaDeviceImpl amdi = (AudioMediaDeviceImpl) foundDevice; + if(inLocator == amdi.getCaptureDeviceInfo().getLocator()) + { + System.out.println("Test" + inLocator + "-" + amdi.getCaptureDeviceInfo().getLocator()); + device = foundDevice; + } + } + System.out.println(foundDevice.getClass() + "-" + inLocator); + } + mediaStream = mediaService.createMediaStream(device); + + mediaStream.setDirection(MediaDirection.SENDRECV); + + mediaStream.setFormat(format); + + connector = new DefaultStreamConnector(new DatagramSocket(this.localPort),new DatagramSocket(this.localRTCPPort)); + mediaStream.setConnector(connector); + mediaStream.setTarget( + new MediaStreamTarget( + new InetSocketAddress(this.ipAddress, this.remotePort), + new InetSocketAddress(this.ipAddress, this.remoteRTCPPort))); + mediaStream.setName(MediaType.AUDIO.toString()); + mediaStream.start(); + } + catch (Exception e) + { + e.printStackTrace(); + } + return null; } /** @@ -135,10 +144,7 @@ * @param listener listener to add */ public void addReceiverListener(ReceiveStreamListener listener) { - this.receiveListeners.add(listener); - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].addReceiveStreamListener(listener); - } + } /** @@ -147,22 +153,7 @@ * @param listener listener to remove */ public void removeReceiverListener(ReceiveStreamListener listener) { - this.receiveListeners.remove(listener); - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].removeReceiveStreamListener(listener); - } - } - /** - * Removes All Receive Listeners. - */ - private void remevoAllReceiverListener() { - for (ReceiveStreamListener listener : receiveListeners) { - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].removeReceiveStreamListener(listener); - } - } - this.receiveListeners.clear(); } /** @@ -170,235 +161,20 @@ * Stops the receiver also. */ public void stop() { - if (!started) return; - synchronized (this) { - try { - started = false; - - remevoAllReceiverListener(); - - if (processor != null) { - processor.stop(); - processor = null; - - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].removeReceiveStreamListener(audioReceiver); - rtpMgrs[i].removeSessionListener(audioReceiver); - rtpMgrs[i].removeTargets("Session ended."); - rtpMgrs[i].dispose(); - } - - sendStreams.clear(); - - } - } catch (Exception e) { - e.printStackTrace(); - } - } - System.err.println("RTP Transmission Stopped."); + if (connector != null) { + connector.stopped(); + connector.close(); + connector = null; + } + if (mediaStream != null) { + mediaStream.stop(); + mediaStream.close(); + mediaStream = null; + } } - /** - * Creates a JMF media PRocessor - * - * @return - */ - private String createProcessor() { - if (locator == null) - return "Locator is null"; - // Try to create a processor to handle the input jmf locator - try { - processor = javax.media.Manager.createProcessor(PhoneManager.getDataSource(locator)); - } catch (NoProcessorException npe) { - npe.printStackTrace(); - return "Couldn't create processor"; - } catch (IOException ioe) { - ioe.printStackTrace(); - return "IOException creating processor"; - } - - // Wait for it to configure - boolean result = waitForState(processor, Processor.Configured); - if (result == false) - return "Couldn't configure processor"; - - // Get the tracks from the processor - TrackControl[] tracks = processor.getTrackControls(); - - // Do we have atleast one track? - if (tracks == null || tracks.length < 1) - return "Couldn't find tracks in processor"; - - // Set the output content descriptor to RAW_RTP - // This will limit the supported formats reported from - // Track.getSupportedFormats to only valid RTP formats. - ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP); - processor.setContentDescriptor(cd); - - Format supported[]; - Format chosen = null; - boolean atLeastOneTrack = false; - - // Program the tracks. - for (int i = 0; i < tracks.length; i++) { - if (tracks[i].isEnabled()) { - - supported = tracks[i].getSupportedFormats(); - - if (supported.length > 0) { - for (Format format : supported) { - if (format instanceof AudioFormat) { - if (this.format.matches(format)) - chosen = format; - } - } - if (chosen != null) { - tracks[i].setFormat(chosen); - System.err.println("Track " + i + " is set to transmit as:"); - System.err.println(" " + chosen); - - - - - if (tracks[i].getFormat() instanceof AudioFormat) { - int packetRate = 20; - PacketSizeControl pktCtrl = (PacketSizeControl) processor.getControl(PacketSizeControl.class.getName()); - if (pktCtrl != null) { - try { - pktCtrl.setPacketSize(getPacketSize(tracks[i].getFormat(), packetRate)); - } catch (IllegalArgumentException e) { - pktCtrl.setPacketSize(160); - // Do nothing - } - } - - - -// if (tracks[i].getFormat().getEncoding().equals(AudioFormat.ULAW_RTP)) { -// Codec codec[] = new Codec[3]; -// -// codec[0] = new com.ibm.media.codec.audio.rc.RCModule(); -// codec[1] = new com.ibm.media.codec.audio.ulaw.JavaEncoder(); -// codec[2] = new com.sun.media.codec.audio.ulaw.Packetizer(); -// ((com.sun.media.codec.audio.ulaw.Packetizer) codec -// [2]).setPacketSize(160); -// -// try { -// tracks[i].setCodecChain(codec); -// } catch (UnsupportedPlugInException e) { -// e.printStackTrace(); -// } -// } - - } - - atLeastOneTrack = true; - } else - tracks[i].setEnabled(false); - } else - tracks[i].setEnabled(false); - } - } - - if (!atLeastOneTrack) - return "Couldn't set any of the tracks to a valid RTP format"; - - result = waitForState(processor, Controller.Realized); - if (result == false) - return "Couldn't realize processor"; - - // Get the output data source of the processor - dataOutput = processor.getDataOutput(); - - return null; - } - /** - * Get the best packet size for a given codec and a codec rate - * - * @param codecFormat - * @param milliseconds - * @return - * @throws IllegalArgumentException - */ - private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException { - String encoding = codecFormat.getEncoding(); - if (encoding.equalsIgnoreCase(AudioFormat.G729) || - encoding.equalsIgnoreCase(AudioFormat.G729_RTP)) { - return milliseconds * 1; // 1 byte per millisec - } else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) || - encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) { - return milliseconds * 8; - } else { - throw new IllegalArgumentException("Unknown codec type"); - } - } - - /** - * Use the RTPManager API to create sessions for each jmf - * track of the processor. - */ - private String createTransmitter() { - - // Cheated. Should have checked the type. - PushBufferDataSource pbds = (PushBufferDataSource) dataOutput; - PushBufferStream pbss[] = pbds.getStreams(); - - rtpMgrs = new RTPManager[pbss.length]; - - SessionAddress localAddr, destAddr; - InetAddress ipAddr; - SendStream sendStream; - audioReceiver = new AudioReceiver(this); - int port; - - for (int i = 0; i < pbss.length; i++) { - try { - rtpMgrs[i] = RTPManager.newInstance(); - RTPBonusFormatsMgr.addBonusFormats(rtpMgrs[i]); - - port = portBase + 2 * i; - ipAddr = InetAddress.getByName(ipAddress); - - localAddr = new SessionAddress(InetAddress.getByName(this.localIpAddress), - localPort); - - destAddr = new SessionAddress(ipAddr, port); - - rtpMgrs[i].addReceiveStreamListener(audioReceiver); - rtpMgrs[i].addSessionListener(audioReceiver); - - BufferControl bc = (BufferControl) rtpMgrs[i].getControl("javax.media.control.BufferControl"); - if (bc != null) { - int bl = 125; - bl = SIPConfig.getDefaultBufferLength() != -1 ? SIPConfig.getDefaultBufferLength() - : bl; - - bc.setBufferLength(bl); - } - - rtpMgrs[i].initialize(localAddr); - rtpMgrs[i].addTarget(destAddr); - - System.err.println("Created RTP session at " + localPort + " to: " + ipAddress + " " + port); - - sendStream = rtpMgrs[i].createSendStream(dataOutput, i); - - sendStreams.add(sendStream); - - sendStream.start(); - - } catch (Exception e) { - e.printStackTrace(); - return e.getMessage(); - } - } - - return null; - } - - /** * Set transmit activity. If the active is true, the instance should trasmit. * If it is set to false, the instance should pause transmit. * @@ -405,107 +181,34 @@ * @param active */ public void setTrasmit(boolean active) { - for (SendStream sendStream : sendStreams) { - try { - if (active) { - sendStream.start(); - System.out.println("START"); - } else { - sendStream.stop(); - System.out.println("STOP"); - } - } - catch (IOException e) { - e.printStackTrace(); - } - - } + mediaStream.setMute(active); } - /** - * ************************************************************* - * Convenience methods to handle processor's state changes. - * ************************************************************** - */ - private Integer stateLock = new Integer(0); - private boolean failed = false; - - Integer getStateLock() { - return stateLock; - } - - void setFailed() { - failed = true; - } - - private synchronized boolean waitForState(Processor p, int state) { - p.addControllerListener(new StateListener()); - failed = false; - - // Call the required method on the processor - if (state == Processor.Configured) { - p.configure(); - } else if (state == Processor.Realized) { - p.realize(); - } - - // Wait until we get an event that confirms the - // success of the method, or a failure event. - // See StateListener inner class - while (p.getState() < state && !failed) { - synchronized (getStateLock()) { - try { - getStateLock().wait(); - } catch (InterruptedException ie) { - return false; - } - } - } - - if (failed) - return false; - else - return true; - } - - /** - * ************************************************************* - * Inner Classes - * ************************************************************** - */ - - class StateListener implements ControllerListener { - - public void controllerUpdate(ControllerEvent ce) { - - // If there was an error during configure or - // realize, the processor will be closed - if (ce instanceof ControllerClosedEvent) - setFailed(); - - // All controller events, send a notification - // to the waiting thread in waitForState method. - if (ce instanceof ControllerEvent) { - synchronized (getStateLock()) { - getStateLock().notifyAll(); - } - } - } - } - public static void main(String args[]) { InetAddress localhost; try { - JMFInit.start(true); + LibJitsi.start(); + MediaType[] mediaTypes = MediaType.values(); + MediaService mediaService = LibJitsi.getMediaService(); + + Vector vectorAudioDevices = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.LINEAR)); + for ( CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices) + { + System.out.println(infoCaptureDevice.getLocator()); + } + localhost = InetAddress.getLocalHost(); - AudioChannel audioChannel0 = new AudioChannel(new MediaLocator("dsound://"), localhost.getHostAddress(), localhost.getHostAddress(), 7002, 7020, new AudioFormat(AudioFormat.GSM_RTP)); - AudioChannel audioChannel1 = new AudioChannel(new MediaLocator("dsound://"), localhost.getHostAddress(), localhost.getHostAddress(), 7020, 7002, new AudioFormat(AudioFormat.GSM_RTP)); + byte format = 3; + + AudioChannel audioChannel0 = new AudioChannel(vectorAudioDevices.get(0).getLocator(), localhost.getHostAddress(), localhost.getHostAddress(), 7002, -1, 7020, -1, MediaUtils.getMediaFormat(new AudioFormat(AudioFormat.GSM_RTP))); + AudioChannel audioChannel1 = new AudioChannel(vectorAudioDevices.get(0).getLocator(), localhost.getHostAddress(), localhost.getHostAddress(), 7020, -1, 7002, -1, MediaUtils.getMediaFormat(new AudioFormat(AudioFormat.GSM_RTP))); + audioChannel0.start(); audioChannel1.start(); Index: build/lib/dist/windows64/jnwincoreaudio.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnwincoreaudio.dll =================================================================== --- build/lib/dist/windows64/jnwincoreaudio.dll (revision 0) +++ build/lib/dist/windows64/jnwincoreaudio.dll (working copy) Property changes on: build/lib/dist/windows64/jnwincoreaudio.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiver.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiver.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiver.java (working copy) @@ -59,7 +59,6 @@ ReceiveStream stream = evt.getReceiveStream(); // could be null. if (evt instanceof RemotePayloadChangeEvent) { - System.err.println(" - Received an RTP PayloadChangeEvent."); System.err.println("Sorry, cannot handle payload change."); // System.exit(0); Index: build/lib/dist/windows64/jnportaudio.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows64/jnportaudio.dll =================================================================== --- build/lib/dist/windows64/jnportaudio.dll (revision 0) +++ build/lib/dist/windows64/jnportaudio.dll (working copy) Property changes on: build/lib/dist/windows64/jnportaudio.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java =================================================================== --- src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java (revision 13875) +++ src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java (working copy) @@ -1010,7 +1010,15 @@ public String getAudioDevice() { return props.getProperty("audioDevice","javasound://"); } + + public void setPlaybackDevice(String device) { + props.setProperty("playbackDevice", device); + } + public String getPlaybackDevice() { + return props.getProperty("playbackDevice","javasound://"); + } + public void setVideoDevice(String device) { props.setProperty("videoDevice", device); } Index: build/lib/dist/windows/jng722.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jng722.dll =================================================================== --- build/lib/dist/windows/jng722.dll (revision 0) +++ build/lib/dist/windows/jng722.dll (working copy) Property changes on: build/lib/dist/windows/jng722.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiverChannel.java =================================================================== --- src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiverChannel.java (revision 13875) +++ src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiverChannel.java (working copy) @@ -19,12 +19,26 @@ */ package net.java.sipmack.media; +import java.net.DatagramSocket; import java.net.InetAddress; +import java.net.InetSocketAddress; import javax.media.control.BufferControl; import javax.media.rtp.RTPManager; import javax.media.rtp.SessionAddress; +import org.jitsi.service.libjitsi.LibJitsi; +import org.jitsi.service.neomedia.DefaultStreamConnector; +import org.jitsi.service.neomedia.MediaDirection; +import org.jitsi.service.neomedia.MediaService; +import org.jitsi.service.neomedia.MediaStream; +import org.jitsi.service.neomedia.MediaStreamTarget; +import org.jitsi.service.neomedia.MediaType; +import org.jitsi.service.neomedia.MediaUseCase; +import org.jitsi.service.neomedia.StreamConnector; +import org.jitsi.service.neomedia.device.MediaDevice; +import org.jitsi.service.neomedia.format.MediaFormat; + import net.java.sipmack.sip.SIPConfig; /** @@ -66,7 +80,8 @@ public AudioReceiverChannel(String localIpAddress, int localPort, String remoteIpAddress, - int remotePort) { + int remotePort, + int remoteRTCPPort) { this.localIpAddress = localIpAddress; this.localPort = localPort; this.remoteIpAddress = remoteIpAddress; @@ -79,19 +94,31 @@ * Starts receive also. */ public synchronized String start() { - if (started) return null; - started = true; - String result; - - // Create an RTP session to transmit the output of the - // processor to the specified IP address and port no. - result = createReceiver(); - if (result != null) { - started = false; - return result; - } - - return null; + try + { + System.out.println("REcviert start"); + MediaService mediaService = LibJitsi.getMediaService(); + MediaDevice device = mediaService.getDefaultDevice(MediaType.AUDIO, MediaUseCase.CALL); + MediaStream mediaStream = mediaService.createMediaStream(device); + mediaStream.setDirection(MediaDirection.RECVONLY); + MediaFormat format = mediaService.getFormatFactory().createMediaFormat( + "PCMU", + 8000); + mediaStream.setFormat(format); + StreamConnector connector = new DefaultStreamConnector(new DatagramSocket(this.localPort),new DatagramSocket(this.localPort + 1)); + mediaStream.setConnector(connector); + mediaStream.setTarget( + new MediaStreamTarget( + new InetSocketAddress(this.remoteIpAddress, this.remotePort), + new InetSocketAddress(this.remoteIpAddress, this.remotePort+1))); + mediaStream.setName(MediaType.AUDIO.toString()); + mediaStream.start(); + } + catch (Exception e) + { + e.printStackTrace(); + } + return null; } /** @@ -99,69 +126,8 @@ * Stops the receiver also. */ public void stop() { - if (!started) return; - synchronized (this) { - try { - started = false; - for (int i = 0; i < rtpMgrs.length; i++) { - rtpMgrs[i].removeReceiveStreamListener(audioReceiver); - rtpMgrs[i].removeSessionListener(audioReceiver); - rtpMgrs[i].removeTargets("Session ended."); - rtpMgrs[i].dispose(); - rtpMgrs[i] = null; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - System.err.println("RTP Transmission Stopped."); } - /** - * Use the RTPManager API to create sessions for each jmf - * track of the processor. - */ - private String createReceiver() { - - rtpMgrs = new RTPManager[1]; - SessionAddress localAddr, destAddr; - audioReceiver = new AudioReceiver(this); - - try { - rtpMgrs[0] = RTPManager.newInstance(); - - localAddr = new SessionAddress( - InetAddress.getByName(this.localIpAddress), localPort); - - destAddr = new SessionAddress( - InetAddress.getByName(this.remoteIpAddress), remotePort); - - rtpMgrs[0].addReceiveStreamListener(audioReceiver); - rtpMgrs[0].addSessionListener(audioReceiver); - - BufferControl bc = (BufferControl) rtpMgrs[0] - .getControl("javax.media.control.BufferControl"); - if (bc != null) { - int bl = 160; - bl = SIPConfig.getDefaultBufferLength() != -1 ? SIPConfig - .getDefaultBufferLength() : bl; - - bc.setBufferLength(bl); - } - - rtpMgrs[0].initialize(localAddr); - - rtpMgrs[0].addTarget(destAddr); - - System.err.println("Created RTP session at " + localPort); - - } catch (Exception e) { - e.printStackTrace(); - return e.getMessage(); - } - - return null; - } - + } Index: build/lib/dist/windows/jnscreencapture.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnscreencapture.dll =================================================================== --- build/lib/dist/windows/jnscreencapture.dll (revision 0) +++ build/lib/dist/windows/jnscreencapture.dll (working copy) Property changes on: build/lib/dist/windows/jnscreencapture.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: build/lib/dist/windows/jnawtrenderer.dll =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: build/lib/dist/windows/jnawtrenderer.dll =================================================================== --- build/lib/dist/windows/jnawtrenderer.dll (revision 0) +++ build/lib/dist/windows/jnawtrenderer.dll (working copy) Property changes on: build/lib/dist/windows/jnawtrenderer.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property