mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-08 20:11:08 +01:00
More Refactoring
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7311 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
9e4be21775
commit
79b19ce620
10 changed files with 186 additions and 125 deletions
|
|
@ -51,6 +51,8 @@ import java.util.List;
|
|||
* portB ---> portA
|
||||
* <p/>
|
||||
* <i>Transmit and Receive are interdependents. To receive you MUST trasmit. </i>
|
||||
*
|
||||
* @author Thiago Camargo
|
||||
*/
|
||||
public class AudioChannel {
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ import org.jivesoftware.smackx.jingle.media.PayloadType;
|
|||
import javax.media.format.AudioFormat;
|
||||
|
||||
/**
|
||||
* Audio Format Ttils.
|
||||
* Audio Format Utils.
|
||||
*
|
||||
* @author Thiago Camargo
|
||||
*/
|
||||
public class AudioFormatUtils {
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,15 @@ import java.net.ServerSocket;
|
|||
* But you could also use in any VOIP application.
|
||||
* For better NAT Traversal support this implementation don´t support only receive or only transmit.
|
||||
* To receive you MUST transmit. So the only implemented and functionally methods are startTransmit() and stopTransmit()
|
||||
*
|
||||
* @author Thiago Camargo
|
||||
*
|
||||
*/
|
||||
public class AudioMediaSession extends JingleMediaSession {
|
||||
|
||||
private AudioFormat format;
|
||||
private AudioChannel audioChannel;
|
||||
private String locator = "javasound://";
|
||||
|
||||
/**
|
||||
* Creates a org.jivesoftware.jingleaudio.jmf.AudioMediaSession with defined payload type, remote and local candidates
|
||||
|
|
@ -50,8 +54,23 @@ public class AudioMediaSession extends JingleMediaSession {
|
|||
* @param local The local information. The candidate that will receive the jmf
|
||||
*/
|
||||
public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote,
|
||||
final TransportCandidate local) {
|
||||
final TransportCandidate local) {
|
||||
this(payloadType, remote, local, "javasound://");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a org.jivesoftware.jingleaudio.jmf.AudioMediaSession with defined payload type, remote and local candidates
|
||||
*
|
||||
* @param payloadType Payload of the jmf
|
||||
* @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 PayloadType payloadType, final TransportCandidate remote,
|
||||
final TransportCandidate local, String locator) {
|
||||
super(payloadType, remote, local);
|
||||
if (locator != null && !locator.equals(""))
|
||||
this.locator = locator;
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,14 +91,15 @@ public class AudioMediaSession extends JingleMediaSession {
|
|||
|
||||
System.out.println(this.getLocal().getConnection() + " " + ip + ": " + localPort + "->" + remotePort);
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ip = this.getRemote().getIp();
|
||||
localIp = this.getLocal().getLocalIp();
|
||||
localPort = this.getLocal().getPort();
|
||||
remotePort = this.getRemote().getPort();
|
||||
}
|
||||
|
||||
audioChannel = new AudioChannel(new MediaLocator("dsound://"), localIp, ip, localPort, remotePort, AudioFormatUtils.getAudioFormat(this.getPayloadType()));
|
||||
audioChannel = new AudioChannel(new MediaLocator(locator), localIp, ip, localPort, remotePort, AudioFormatUtils.getAudioFormat(this.getPayloadType()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package org.jivesoftware.jingleaudio.jmf; /**
|
||||
/**
|
||||
* $RCSfile$
|
||||
* $Revision: $
|
||||
* $Date: 08/11/2006
|
||||
|
|
@ -18,6 +18,8 @@ package org.jivesoftware.jingleaudio.jmf; /**
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.jingleaudio.jmf;
|
||||
|
||||
import javax.media.*;
|
||||
import javax.media.protocol.DataSource;
|
||||
import javax.media.rtp.*;
|
||||
|
|
@ -25,6 +27,8 @@ import javax.media.rtp.event.*;
|
|||
|
||||
/**
|
||||
* This class implements receive methods and listeners to be used in AudioChannel
|
||||
*
|
||||
* @author Thiago Camargo
|
||||
*/
|
||||
public class AudioReceiver implements ReceiveStreamListener, SessionListener,
|
||||
ControllerListener {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ import java.io.IOException;
|
|||
/**
|
||||
* Implements a jingleMediaManager using JMF based API.
|
||||
* It supports GSM and G723 codecs.
|
||||
* <i>This API only currently works on windows.</i>
|
||||
* <i>This API only currently works on windows and Mac.</i>
|
||||
*
|
||||
* @author Thiago Camargo
|
||||
*/
|
||||
public class JmfMediaManager extends JingleMediaManager {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue