diff --git a/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java b/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java index 593cb46f8..16f97feb6 100644 --- a/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java +++ b/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java @@ -89,7 +89,7 @@ public class MediaStreamImpl * RTP and RTCP traffic. The instance is a TransformConnector in * order to also enable packet transformations. */ - private final TransformConnector rtpConnector; + private final RTPTransformConnector rtpConnector; /** * The one and only MediaStreamTarget this instance has added as a @@ -163,7 +163,7 @@ public MediaStreamImpl(StreamConnector connector, MediaDevice device) */ setDevice(device); - this.rtpConnector = new TransformConnector(connector); + this.rtpConnector = new RTPTransformConnector(connector); } /** @@ -580,7 +580,8 @@ private RTPManager getRTPManager() //JMF inits the local SSRC upon initialize(RTPConnector) so now's //the time to ask: setLocalSourceID(Long.toHexString( - (((RTPSessionMgr)rtpManager).getLocalSSRC()))); + (((com.sun.media.rtp.RTPSessionMgr) + rtpManager).getLocalSSRC()))); createSendStreams(); } @@ -1330,7 +1331,6 @@ private void setLocalSourceID(String ssrc) String oldValue = this.localSourceID; this.localSourceID = ssrc; -System.out.println("old local ssrc = " + oldValue + " newLocalSSRC= " + localSourceID ); firePropertyChange(PNAME_LOCAL_SSRC, oldValue, ssrc); } @@ -1346,7 +1346,6 @@ private void setRemoteSourceID(String ssrc) String oldValue = this.remoteSourceID; this.remoteSourceID = ssrc; -System.out.println("old remote ssrc = " + oldValue + " newRemoteSSRC= " + remoteSourceID ); firePropertyChange(PNAME_REMOTE_SSRC, oldValue, ssrc); } } diff --git a/src/net/java/sip/communicator/impl/neomedia/RawPacket.java b/src/net/java/sip/communicator/impl/neomedia/RawPacket.java index 8e56815aa..d46d5d2d8 100755 --- a/src/net/java/sip/communicator/impl/neomedia/RawPacket.java +++ b/src/net/java/sip/communicator/impl/neomedia/RawPacket.java @@ -7,16 +7,16 @@ package net.java.sip.communicator.impl.neomedia; /** - * When using TransformConnector, a RTP/RTCP packet is represented using + * When using TransformConnector, a RTP/RTCP packet is represented using * RawPacket. RawPacket stores the buffer holding the RTP/RTCP packet, as well * as the inner offset and length of RTP/RTCP packet data. - * - * After transformation, data is also store in RawPacket objects, either the + * + * After transformation, data is also store in RawPacket objects, either the * original RawPacket (in place transformation), or a newly created RawPacket. - * + * * Besides packet info storage, RawPacket also provides some other operations * such as readInt() to ease the development process. - * + * * @author Werner Dittmann (Werner.Dittmann@t-online.de) * @author Bing SU (nova.su@gmail.com) */ @@ -26,14 +26,14 @@ public class RawPacket * Byte array storing the content of this Packet */ protected byte[] buffer; - + /** * Start offset of the packet data inside buffer. - * Usually this value would be 0. But in order to be compatible with + * Usually this value would be 0. But in order to be compatible with * RTPManager we store this info. (Not assuming the offset is always zero) */ protected int offset; - + /** * Length of this packet's data */ @@ -41,7 +41,7 @@ public class RawPacket /** * Construct a RawPacket using specified value. - * + * * @param buffer Byte array holding the content of this Packet * @param offset Start offset of packet content inside buffer * @param length Length of the packet's data @@ -62,7 +62,7 @@ public byte[] getBuffer() { return this.buffer; } - + /** * Get the length of this packet's data * @@ -108,7 +108,7 @@ public short readShort(int off) return (short) ((this.buffer[this.offset + off + 0] << 8) | (this.buffer[this.offset + off + 1] & 0xff)); } - + /** * Read an unsigned short at specified offset as a int * @@ -146,44 +146,45 @@ public long readUnsignedIntAsLong(int off) int b1 = (0x000000FF & (this.buffer[this.offset + off + 1])); int b2 = (0x000000FF & (this.buffer[this.offset + off + 2])); int b3 = (0x000000FF & (this.buffer[this.offset + off + 3])); - + return ((b0 << 24 | b1 << 16 | b2 << 8 | b3)) & 0xFFFFFFFFL; } - + /** * Read a byte region from specified offset with specified length * - * @param off start offset of the region to be read + * @param off start offset of the region to be read * @param len length of the region to be read * @return byte array of [offset, offset + length) */ public byte[] readRegion(int off, int len) { int startOffset = this.offset + off; - if (off < 0 || len <= 0 + if (off < 0 || len <= 0 || startOffset + len > this.buffer.length) { return null; } byte[] region = new byte[len]; - + System.arraycopy(this.buffer, startOffset, region, 0, len); - + return region; } - + /** - * Read a byte region from specified offset with specified length in given buffer + * Read a byte region from specified offset with specified length in given + * buffer * - * @param off start offset of the region to be read + * @param off start offset of the region to be read * @param len length of the region to be read * @param outBuff output buffer */ public void readRegionToBuff(int off, int len, byte[] outBuff) { int startOffset = this.offset + off; - if (off < 0 || len <= 0 + if (off < 0 || len <= 0 || startOffset + len > this.buffer.length) { return; @@ -198,25 +199,25 @@ public void readRegionToBuff(int off, int len, byte[] outBuff) /** * Append a byte array to then end of the packet. This will change the data - * buffer of this packet. + * buffer of this packet. * * @param data byte array to append * @param len the number of bytes to append */ - public void append(byte[] data, int len) + public void append(byte[] data, int len) { - if (data == null || len == 0) + if (data == null || len == 0) { return; } - + byte[] newBuffer = new byte[this.length + len]; System.arraycopy(this.buffer, this.offset, newBuffer, 0, this.length); System.arraycopy(data, 0, newBuffer, this.length, len); this.offset = 0; this.length = this.length + len; this.buffer = newBuffer; - + } /** * Shrink the buffer of this packet by specified length @@ -229,7 +230,7 @@ public void shrink(int len) { return; } - + this.length -= len; if (this.length < 0) { diff --git a/src/net/java/sip/communicator/impl/neomedia/device/MediaDeviceSession.java b/src/net/java/sip/communicator/impl/neomedia/device/MediaDeviceSession.java index 96834341e..53412dfb4 100644 --- a/src/net/java/sip/communicator/impl/neomedia/device/MediaDeviceSession.java +++ b/src/net/java/sip/communicator/impl/neomedia/device/MediaDeviceSession.java @@ -29,9 +29,10 @@ /** * Represents the use of a specific MediaDevice by a * MediaStream. - * + * * @author Lubomir Marinov * @author Damian Minkov + * @author Emil Ivov */ public class MediaDeviceSession extends PropertyChangeNotifier @@ -1010,9 +1011,9 @@ else if (event instanceof ControllerClosedEvent) } /** - * Notifies this instance that a specific Processor of + * Notifies this instance that a specific Processor of * remote content has generated a RealizeCompleteEvent. - * Allows extenders to carry out additional processing on the + * Allows extenders to carry out additional processing on the * Processor. The Processor is used as a Player. * * @param player the Processor which is the source of a @@ -1363,4 +1364,29 @@ private static boolean waitForState(Processor processor, int state) { return new ProcessorUtility().waitForState(processor, state); } + + /** + * Returns the list of SSRC identifiers that this device session is handling + * streams from. In this case (i.e. the case of a device session handling + * a single remote party) we would rarely (if ever) have more than a single + * SSRC identifier returned. However, we would also be using the same method + * 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 List of SSRC identifiers (in a hexadecimal + * String form) that this device session is. + * handling streams from. + */ + public List getRemoteSSRCList() + { + Set streams = this.receiveStreams.keySet(); + List ssrcIDList = new ArrayList(); + + for ( ReceiveStream stream : streams) + { + ssrcIDList.add(Long.toHexString(stream.getSSRC())); + } + + return ssrcIDList; + } }