diff options
-rwxr-xr-x | .classpath | 2 | ||||
-rw-r--r-- | build.xml | 2 | ||||
-rw-r--r-- | lib/installer-exclude/libjitsi-1.0-20170207.194207-242.jar (renamed from lib/installer-exclude/libjitsi-1.0-20170201.212655-235.jar) | bin | 9011068 -> 9014770 bytes | |||
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java | 30 | ||||
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/media/TransportManager.java | 21 |
5 files changed, 48 insertions, 7 deletions
@@ -55,7 +55,7 @@ <attribute name="javadoc_location" value="http://dbus.freedesktop.org/doc/dbus-java/api/"/> </attributes> </classpathentry> - <classpathentry kind="lib" path="lib/installer-exclude/libjitsi-1.0-20170201.212655-235.jar" sourcepath="/libjitsi/src"/> + <classpathentry kind="lib" path="lib/installer-exclude/libjitsi-1.0-20170207.194207-242.jar" sourcepath="/libjitsi/src"/> <classpathentry kind="lib" path="lib/bundle/log4j.jar"/> <classpathentry kind="lib" path="lib/installer-exclude/mac_widgets-0.9.5.jar"/> <classpathentry kind="lib" path="lib/installer-exclude/objenesis-1.2.jar"/> @@ -978,7 +978,7 @@ <!-- Copying of all unmodified libraries that are already bundles --> <target name="bundle-bundles"> - <copy file="${lib.noinst}/libjitsi-1.0-20170201.212655-235.jar" tofile="${bundles.dest}/libjitsi.jar"/> + <copy file="${lib.noinst}/libjitsi-1.0-20170207.194207-242.jar" tofile="${bundles.dest}/libjitsi.jar"/> <copy file="${lib.noinst}/fmj-1.0-SNAPSHOT.jar" tofile="${bundles.dest}/fmj.jar"/> <copy file="${lib.noinst}/jitsi-lgpl-dependencies-1.0-SNAPSHOT.jar" tofile="${bundles.dest}/jitsi-lgpl-dependencies.jar"/> <copy file="${lib.noinst}/jitsi-gpl-dependencies-1.0-SNAPSHOT.jar" tofile="${bundles.dest}/jitsi-gpl-dependencies.jar"/> diff --git a/lib/installer-exclude/libjitsi-1.0-20170201.212655-235.jar b/lib/installer-exclude/libjitsi-1.0-20170207.194207-242.jar Binary files differindex bbcf1c6..a8ca832 100644 --- a/lib/installer-exclude/libjitsi-1.0-20170201.212655-235.jar +++ b/lib/installer-exclude/libjitsi-1.0-20170207.194207-242.jar diff --git a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java index c8a3a12..ead01d1 100644 --- a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java +++ b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java @@ -87,6 +87,16 @@ public abstract class CallPeerMediaHandler<T extends MediaAwareCallPeer<?,?,?>> public static final String VIDEO_REMOTE_SSRC = "VIDEO_REMOTE_SSRC"; /** + * The initial content of a hole punch packet. It has some fields pre-set. + * Like rtp verion, sequence number and timestamp. + */ + private static final byte[] HOLE_PUNCH_PACKET = + { + (byte)0x80, 0x00, 0x02, (byte)0x9E, 0x00, 0x09, + (byte)0xD0, (byte)0x80, 0x00, 0x00, 0x00, (byte)0x00, + }; + + /** * List of advertised encryption methods. Indicated before establishing the * call. */ @@ -1575,11 +1585,21 @@ public abstract class CallPeerMediaHandler<T extends MediaAwareCallPeer<?,?,?>> * to open port on NAT or RTP proxy if any. In order to be really efficient, * this method should be called after we send our offer or answer. * - * @param target <tt>MediaStreamTarget</tt> + * @param stream <tt>MediaStream</tt> non-null stream + * @param mediaType <tt>MediaType</tt> */ - protected void sendHolePunchPacket(MediaStreamTarget target) + protected void sendHolePunchPacket(MediaStream stream, MediaType mediaType) { - getTransportManager().sendHolePunchPacket(target, MediaType.VIDEO); + // send as a hole punch packet a constructed rtp packet + // has the correct payload type and ssrc + RawPacket packet = new RawPacket( + HOLE_PUNCH_PACKET, 0, RawPacket.FIXED_HEADER_SIZE); + packet.setPayloadType( + dynamicPayloadTypes.getPayloadType(stream.getFormat())); + packet.setSSRC((int)stream.getLocalSourceID()); + + getTransportManager().sendHolePunchPacket( + stream.getTarget(), mediaType, packet); } /** @@ -1936,6 +1956,8 @@ public abstract class CallPeerMediaHandler<T extends MediaAwareCallPeer<?,?,?>> stream.getTarget(), MediaType.AUDIO); stream.start(); + + sendHolePunchPacket(stream, MediaType.AUDIO); } stream = getStream(MediaType.VIDEO); @@ -1964,7 +1986,7 @@ public abstract class CallPeerMediaHandler<T extends MediaAwareCallPeer<?,?,?>> * send the hole-punch packet anyway to let the remote video * reach this local peer. */ - sendHolePunchPacket(stream.getTarget()); + sendHolePunchPacket(stream, MediaType.VIDEO); } } } diff --git a/src/net/java/sip/communicator/service/protocol/media/TransportManager.java b/src/net/java/sip/communicator/service/protocol/media/TransportManager.java index a8222e0..051a302 100644 --- a/src/net/java/sip/communicator/service/protocol/media/TransportManager.java +++ b/src/net/java/sip/communicator/service/protocol/media/TransportManager.java @@ -516,6 +516,21 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>> */ public void sendHolePunchPacket(MediaStreamTarget target, MediaType type) { + this.sendHolePunchPacket(target, type, null); + } + + /** + * Sends empty UDP packets to target destination data/control ports in order + * to open ports on NATs or and help RTP proxies latch onto our RTP ports. + * + * @param target <tt>MediaStreamTarget</tt> + * @param type the {@link MediaType} of the connector we'd like to send the + * hole punching packet through. + * @param packet (optional) use a pre-generated packet that will be sent + */ + public void sendHolePunchPacket( + MediaStreamTarget target, MediaType type, RawPacket packet) + { logger.info("Send NAT hole punch packets"); //check how many hole punch packets we would be supposed to send: @@ -536,7 +551,11 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>> if(connector.getProtocol() == StreamConnector.Protocol.TCP) return; - byte[] buf = new byte[0]; + byte[] buf; + if (packet != null) + buf = packet.getBuffer(); + else + buf = new byte[0]; synchronized(connector) { |