From 60e0222c148e6ea07faa426cf76842b3db8141e8 Mon Sep 17 00:00:00 2001 From: Thiago Camargo Date: Wed, 11 Apr 2007 02:17:50 +0000 Subject: [PATCH] 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 --- .../jingle/mediaimpl/jmf/AudioChannel.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/AudioChannel.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/AudioChannel.java index c11fb39a2..888607bc2 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/AudioChannel.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/AudioChannel.java @@ -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,7 +359,18 @@ public class AudioChannel { bc.setBufferLength(bl); } - rtpMgrs[i].initialize(localAddr); + 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);