diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java
index ffa4ce006..314cd1ebb 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java
@@ -762,7 +762,7 @@ public ContentPacketExtension getRemoteContent(String contentType)
@Override
public long getRemoteSSRC(MediaType mediaType)
{
- long[] ssrcs = getRemoteSSRCs(mediaType);
+ int[] ssrcs = getRemoteSSRCs(mediaType);
/*
* A peer (regardless of whether it is local or remote) may send
@@ -772,13 +772,8 @@ public long getRemoteSSRC(MediaType mediaType)
* known in the list reported by the Jitsi Videobridge server is the
* last.
*/
- for (int i = ssrcs.length - 1; i >= 0; i--)
- {
- long ssrc = ssrcs[i];
-
- if (ssrc != SSRC_UNKNOWN)
- return ssrc;
- }
+ if (ssrcs.length != 0)
+ return 0xFFFFFFFFL & ssrcs[ssrcs.length - 1];
/*
* XXX In the case of Jitsi Videobridge, the super implementation of
@@ -803,11 +798,11 @@ public long getRemoteSSRC(MediaType mediaType)
*
* @param mediaType the MediaType of the RTP streams the SSRCs of
* which are to be returned
- * @return an array of long values which represent the SSRCs of RTP
+ * @return an array of int values which represent the SSRCs of RTP
* streams with the specified mediaType known to be received by a
* MediaStream associated with this instance
*/
- public long[] getRemoteSSRCs(MediaType mediaType)
+ private int[] getRemoteSSRCs(MediaType mediaType)
{
/*
* If the Jitsi Videobridge server-side technology is utilized, a single
@@ -817,6 +812,7 @@ public long[] getRemoteSSRCs(MediaType mediaType)
* why the server will report them to the conference focus.
*/
ColibriConferenceIQ.Channel channel = getColibriChannel(mediaType);
+
if (channel != null)
return channel.getSSRCs();
@@ -830,7 +826,7 @@ public long[] getRemoteSSRCs(MediaType mediaType)
return
(ssrc == SSRC_UNKNOWN)
? ColibriConferenceIQ.NO_SSRCS
- : new long[] { ssrc };
+ : new int[] { (int) ssrc };
}
/**
@@ -1060,7 +1056,7 @@ public List getVisualComponents()
return Collections.emptyList();
else
{
- long[] remoteSSRCs = getRemoteSSRCs(MediaType.VIDEO);
+ int[] remoteSSRCs = getRemoteSSRCs(MediaType.VIDEO);
if (remoteSSRCs.length == 0)
return Collections.emptyList();
@@ -1070,16 +1066,15 @@ public List getVisualComponents()
List visualComponents
= new LinkedList();
- for (long remoteSSRC : remoteSSRCs)
+ for (int i = 0; i < remoteSSRCs.length; i++)
{
- if (remoteSSRC != -1)
- {
- Component visualComponent
- = videoStream.getVisualComponent(remoteSSRC);
+ int remoteSSRC = remoteSSRCs[i];
+ Component visualComponent
+ = videoStream.getVisualComponent(
+ 0xFFFFFFFFL & remoteSSRC);
- if (visualComponent != null)
- visualComponents.add(visualComponent);
- }
+ if (visualComponent != null)
+ visualComponents.add(visualComponent);
}
return visualComponents;
}
@@ -1376,25 +1371,11 @@ void processColibriConferenceIQ(ColibriConferenceIQ conferenceIQ)
if (src != null)
{
- long[] ssrcs = src.getSSRCs();
- long[] dstSsrcs = dst.getSSRCs();
+ int[] ssrcs = src.getSSRCs();
+ int[] dstSSRCs = dst.getSSRCs();
- if (!Arrays.equals(dstSsrcs, ssrcs))
- {
+ if (!Arrays.equals(dstSSRCs, ssrcs))
dst.setSSRCs(ssrcs);
- if(logger.isDebugEnabled())
- {
- logger.debug(
- "SSRCs changed for colibri "
- + mediaType.toString()
- + " channel "
- + dst.getID()
- + " from: "
- + Arrays.toString(dstSsrcs)
- + " to: "
- + Arrays.toString(ssrcs));
- }
- }
}
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java
index af5caaf65..9a4f8526a 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java
@@ -43,11 +43,11 @@ public class ColibriConferenceIQ
= "http://jitsi.org/protocol/colibri";
/**
- * An array of longs which represents the lack of any (RTP) SSRCs
+ * An array of ints which represents the lack of any (RTP) SSRCs
* seen/received on a Channel. Explicitly defined to reduce
* unnecessary allocations.
*/
- public static final long[] NO_SSRCS = new long[0];
+ public static final int[] NO_SSRCS = new int[0];
/**
* The list of {@link Content}s included into this conference IQ.
@@ -395,7 +395,7 @@ public static class Channel
* Channel by now. These may exclude SSRCs which are no longer
* active. Set by the Jitsi Videobridge server, not its clients.
*/
- private long[] ssrcs = NO_SSRCS;
+ private int[] ssrcs = NO_SSRCS;
private IceUdpTransportPacketExtension transport;
@@ -460,15 +460,15 @@ public synchronized boolean addSource(SourcePacketExtension source)
* Channel has been modified as part of the method call;
* otherwise, false
*/
- public synchronized boolean addSSRC(long ssrc)
+ public synchronized boolean addSSRC(int ssrc)
{
// contains
- for (long element : ssrcs)
- if (element == ssrc)
+ for (int i = 0; i < ssrcs.length; i++)
+ if (ssrcs[i] == ssrc)
return false;
// add
- long[] newSSRCs = new long[ssrcs.length + 1];
+ int[] newSSRCs = new int[ssrcs.length + 1];
System.arraycopy(ssrcs, 0, newSSRCs, 0, ssrcs.length);
newSSRCs[ssrcs.length] = ssrc;
@@ -483,9 +483,7 @@ public synchronized boolean addSSRC(long ssrc)
*/
public MediaDirection getDirection()
{
- return direction == null
- ? MediaDirection.SENDRECV
- : direction;
+ return (direction == null) ? MediaDirection.SENDRECV : direction;
}
/**
@@ -601,10 +599,10 @@ public synchronized List getSources()
* Gets (a copy of) the list of (RTP) SSRCs seen/received on this
* Channel.
*
- * @return an array of longs which represents (a copy of) the
+ * @return an array of ints which represents (a copy of) the
* list of (RTP) SSRCs seen/received on this Channel
*/
- public synchronized long[] getSSRCs()
+ public synchronized int[] getSSRCs()
{
return (ssrcs.length == 0) ? NO_SSRCS : ssrcs.clone();
}
@@ -670,7 +668,7 @@ public synchronized boolean removeSource(SourcePacketExtension source)
* Channel has been modified as part of the method call;
* otherwise, false
*/
- public synchronized boolean removeSSRC(long ssrc)
+ public synchronized boolean removeSSRC(int ssrc)
{
if (ssrcs.length == 1)
{
@@ -688,7 +686,7 @@ public synchronized boolean removeSSRC(long ssrc)
{
if (ssrcs[i] == ssrc)
{
- long[] newSSRCs = new long[ssrcs.length - 1];
+ int[] newSSRCs = new int[ssrcs.length - 1];
if (i != 0)
System.arraycopy(ssrcs, 0, newSSRCs, 0, i);
@@ -843,7 +841,7 @@ public void setRTPPort(int rtpPort)
* @param ssrcs the list of (RTP) SSRCs to be set as seen/received on
* this Channel
*/
- public void setSSRCs(long[] ssrcs)
+ public void setSSRCs(int[] ssrcs)
{
/*
* TODO Make sure that the SSRCs set on this instance do not contain
@@ -948,7 +946,7 @@ public void toXML(StringBuilder xml)
boolean hasPayloadTypes = !payloadTypes.isEmpty();
List sources = getSources();
boolean hasSources = !sources.isEmpty();
- long[] ssrcs = getSSRCs();
+ int[] ssrcs = getSSRCs();
boolean hasSSRCs = (ssrcs.length != 0);
IceUdpTransportPacketExtension transport = getTransport();
boolean hasTransport = (transport != null);
@@ -968,11 +966,12 @@ public void toXML(StringBuilder xml)
}
if (hasSSRCs)
{
- for (long ssrc : ssrcs)
+ for (int i = 0; i < ssrcs.length; i++)
{
xml.append('<').append(SSRC_ELEMENT_NAME).append('>')
- .append(ssrc).append("")
- .append(SSRC_ELEMENT_NAME).append('>');
+ .append(Long.toString(ssrcs[i] & 0xFFFFFFFFL))
+ .append("").append(SSRC_ELEMENT_NAME)
+ .append('>');
}
}
if (hasTransport)
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java
index ea9a32d60..7335dd532 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java
@@ -168,7 +168,23 @@ else if (ColibriConferenceIQ.Channel.ELEMENT_NAME.equals(
else if (ColibriConferenceIQ.Channel.SSRC_ELEMENT_NAME
.equals(name))
{
- channel.addSSRC(Long.parseLong(ssrc.toString().trim()));
+ String s = ssrc.toString().trim();
+
+ if (s.length() != 0)
+ {
+ int i;
+
+ /*
+ * Legacy versions of Jitsi and Jitsi Videobridge
+ * may send a synchronization source (SSRC)
+ * identifier as a negative integer.
+ */
+ if (s.startsWith("-"))
+ i = Integer.parseInt(s);
+ else
+ i = (int) Long.parseLong(s);
+ channel.addSSRC(i);
+ }
ssrc = null;
}
else if (ColibriConferenceIQ.Content.ELEMENT_NAME.equals(