From 468621f78044fd3a9e38fdef9190906800484fab Mon Sep 17 00:00:00 2001 From: Emil Ivov Date: Fri, 27 Nov 2009 00:20:11 +0000 Subject: [PATCH] Fixes a few bugs in the addition of the SSRC list to RawPackets. And prepares for a first commit of the whole functionality to SVN --- .../communicator/impl/neomedia/MediaStreamImpl.java | 12 +++++++++--- .../sip/communicator/impl/neomedia/RawPacket.java | 13 +++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java b/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java index dea517e5e..8d4336a5e 100644 --- a/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java +++ b/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java @@ -1377,11 +1377,9 @@ public long[] getLocalContributingSourceIDs() { if( this.deviceSession == null) return null; - MediaDeviceSession deviceSession = getDeviceSession(); long[] ssrcArray = deviceSession.getRemoteSSRCList(); - List csrcList = new ArrayList(ssrcArray.length); //in case of a conf call the mixer would return all SSRC IDs that are @@ -1390,9 +1388,17 @@ public long[] getLocalContributingSourceIDs() for(long csrc : ssrcArray) { if (csrc != this.getRemoteSourceID()) + { csrcList.add(csrc); + } + else + { + } } + //now add our own ID since we are also participating in the call. + csrcList.add(getLocalSourceID()); + int cc = csrcList.size(); if ( cc == 0) return null; @@ -1420,7 +1426,7 @@ public long[] getRemoteContributingSourceIDs() { long[] remoteSsrcList = getDeviceSession().getRemoteSSRCList(); - //todo -implement + /** @todo -implement */ return remoteSsrcList; } diff --git a/src/net/java/sip/communicator/impl/neomedia/RawPacket.java b/src/net/java/sip/communicator/impl/neomedia/RawPacket.java index d374bd5c6..68b9476de 100755 --- a/src/net/java/sip/communicator/impl/neomedia/RawPacket.java +++ b/src/net/java/sip/communicator/impl/neomedia/RawPacket.java @@ -254,7 +254,7 @@ public void shrink(int len) */ public int getCsrcCount() { - return (buffer[offset] & 0x0fb); + return (buffer[offset] & 0x0f); } /** @@ -267,6 +267,7 @@ public int getCsrcCount() */ public void setCsrcList(long[] newCsrcList) { + int newCsrcCount = newCsrcList.length; byte[] csrcBuff = new byte[newCsrcCount * 4]; int csrcOffset = 0; @@ -309,11 +310,15 @@ public void setCsrcList(long[] newCsrcList) System.arraycopy( oldBuffer, payloadOffsetForOldBuff, newBuffer, payloadOffsetForNewBuff, - csrcBuff.length - payloadOffsetForOldBuff); + oldBuffer.length - payloadOffsetForOldBuff); //set the new CSRC count - newBuffer[offset] = (byte)((newBuffer[offset] & 0xF0b) - & newCsrcCount); + newBuffer[offset] = (byte)((newBuffer[offset] & 0xF0) + | newCsrcCount); + + this.buffer = newBuffer; + this.length = newBuffer.length; + } /**