Changes storage of SSRC id-s to long rather than String to optimize their insertion in RTP packets as well as garbage collection

cusax-fix
Emil Ivov 16 years ago
parent e11acf8495
commit 314d199066

@ -1360,30 +1360,29 @@ private void setRemoteSourceID(long ssrc)
* return an empty <tt>List</tt> in case this stream is not part of a mixed
* conference call.
*
* @return a <tt>List</tt> of CSRC IDs for parties that are currently known
* to contribute to the media that this stream is currently streaming or
* an empty <tt>List</tt> in case this <tt>MediaStream</tt> is not part of
* a conference call.
* @return a <tt>List</tt> array of CSRC IDs stored as <tt>Long</tt>
* instances and representing parties that are currently known to contribute
* to the media that this stream or an empty <tt>List</tt> in case this
* <tt>MediaStream</tt> is not part of a conference call.
*/
public List<String> getLocalContributingSourceIDs()
public List<Long> getLocalContributingSourceIDs()
{
List<String> csrcList = new ArrayList<String>();
if( this.deviceSession == null)
return null;
MediaDeviceSession deviceSession = getDeviceSession();
if( this.deviceSession != null)
csrcList.addAll( deviceSession.getRemoteSSRCList() );
Iterator<String> csrcIter = csrcList.iterator();
long[] ssrcArray = deviceSession.getRemoteSSRCList();
List<Long> csrcList = new ArrayList<Long>(ssrcArray.length);
//in case of a conf call the mixer would return all SSRC IDs that are
//currently contributing including this stream's counterpart. This
//method is about
while(csrcIter.hasNext())
for(long csrc : ssrcArray)
{
String csrc = csrcIter.next();
if (csrc.equals(getRemoteSourceID()))
csrcIter.remove();
if (csrc != this.getRemoteSourceID())
csrcList.add(csrc);
}
return csrcList;
@ -1398,10 +1397,12 @@ public List<String> getLocalContributingSourceIDs()
* contributing to the stream that we are receiving from this
* <tt>MediaStream</tt>'s remote party.
*/
public List<String> getRemoteContributingSourceIDs()
public long[] getRemoteContributingSourceIDs()
{
List<String> csrcList = new ArrayList<String>();
long[] remoteSsrcList = getDeviceSession().getRemoteSSRCList();
return csrcList;
//todo -implement
return remoteSsrcList;
}
}

@ -449,12 +449,12 @@ public void removeReceiveStream(ReceiveStream receiveStream)
* a pseudo device we would simply be delegating the call to the
* corresponding method of the master mixer device session.
*
* @return a <tt>List</tt> of SSRC identifiers (in a hexadecimal
* <tt>String</tt> form) that are currently contributing to the mixer
* encapsulated by this device session.
* @return a <tt>long[]</tt> array of SSRC identifiers that are
* currently contributing to the mixer encapsulated by this device
* session.
*/
@Override
public List<String> getRemoteSSRCList()
public long[] getRemoteSSRCList()
{
return audioMixerMediaDeviceSession.getRemoteSSRCList();
}

@ -224,8 +224,7 @@ protected void addReceiveStream(
receiveStreams.put(receiveStream, receiveStreamDataSource);
if (logger.isTraceEnabled())
logger
.trace(
logger.trace(
"Added ReceiveStream with ssrc " + receiveStream.getSSRC());
synchronized (players)
@ -250,15 +249,13 @@ protected void addReceiveStream(
}
if (exception != null)
logger
.error(
logger.error(
"Failed to create player"
+ " for ReceiveStream with ssrc "
+ receiveStream.getSSRC(),
exception);
else if (!waitForState(player, Processor.Configured))
logger
.error(
logger.error(
"Failed to configure player"
+ " for ReceiveStream with ssrc "
+ receiveStream.getSSRC());
@ -1373,18 +1370,19 @@ private static boolean waitForState(Processor processor, int state)
* to query a device session operating over a mixer in which case we would
* have the SSRC IDs of all parties currently contributing to the mixing.
*
* @return a <tt>List</tt> of SSRC identifiers (in a hexadecimal
* <tt>String</tt> form) that this device session is.
* handling streams from.
* @return a <tt>long[]</tt> array of SSRC identifiers that this device
* session is handling streams from.
*/
public List<String> getRemoteSSRCList()
public long[] getRemoteSSRCList()
{
Set<ReceiveStream> streams = this.receiveStreams.keySet();
List<String> ssrcIDList = new ArrayList<String>();
List<ReceiveStream> streams
= new LinkedList<ReceiveStream>(this.receiveStreams.keySet());
long[] ssrcIDList = new long[streams.size()];
for ( ReceiveStream stream : streams)
for ( int i = 0; i < ssrcIDList.length; i++)
{
ssrcIDList.add(Long.toHexString(stream.getSSRC()));
ReceiveStream stream = streams.get(i);
ssrcIDList[i] = stream.getSSRC();
}
return ssrcIDList;

@ -10,24 +10,35 @@
import net.java.sip.communicator.impl.neomedia.transform.*;
/**
* We use this engine to add the list of CSRC identifiers in RTP packets that
* we send to conference participants during calls where we are the mixer.
*
* @author Emil Ivov
*/
public class CsrcTransformEngine
implements TransformEngine,
PacketTransformer
{
/**
* The <tt>MediaStreamImpl</tt> that this transform engine was created to
* transform packets fro.
*/
private final MediaStreamImpl mediaStream;
/* (non-Javadoc)
* @see net.java.sip.communicator.impl.neomedia.transform.TransformEngine#getRTCPTransformer()
/**
* Creates
* @param stream
*/
public CsrcTransformEngine(MediaStreamImpl stream)
{
this.mediaStream = stream;
}
public PacketTransformer getRTCPTransformer()
{
return null;
}
/* (non-Javadoc)
* @see net.java.sip.communicator.impl.neomedia.transform.TransformEngine#getRTPTransformer()
*/
public PacketTransformer getRTPTransformer()
{
return this;

Loading…
Cancel
Save