1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-06 05:01:12 +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:
Thiago Camargo 2007-02-27 13:23:21 +00:00 committed by thiago
parent 9e4be21775
commit 79b19ce620
10 changed files with 186 additions and 125 deletions

View file

@ -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()));
}
/**