1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 16:22:06 +01:00

Use Alternative Session Address if default on fail

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7978 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-04-11 02:17:50 +00:00 committed by thiago
parent eb3d196bce
commit 60e0222c14

View file

@ -33,12 +33,15 @@ import javax.media.protocol.PushBufferStream;
import javax.media.rtp.RTPManager;
import javax.media.rtp.SendStream;
import javax.media.rtp.SessionAddress;
import javax.media.rtp.InvalidSessionAddressException;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import com.sun.media.rtp.RTPSessionMgr;
/**
* An Easy to use Audio Channel implemented using JMF.
* It sends and receives jmf for and from desired IPs and ports.
@ -356,8 +359,19 @@ public class AudioChannel {
bc.setBufferLength(bl);
}
try {
rtpMgrs[i].initialize(localAddr);
}
catch (InvalidSessionAddressException e) {
// In case the local address is not allowed to read, we user another local address
SessionAddress sessAddr = new SessionAddress();
localAddr = new SessionAddress(InetAddress.getByName(sessAddr.getDataHostAddress()),
localPort);
rtpMgrs[i].initialize(localAddr);
}
rtpMgrs[i].addTarget(destAddr);
System.err.println("Created RTP session at " + localPort + " to: " + remoteIpAddress + " " + port);