SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.media
Class RTPConnectorOutputStream

java.lang.Object
  extended by net.java.sip.communicator.impl.media.RTPConnectorOutputStream
All Implemented Interfaces:
javax.media.rtp.OutputDataStream
Direct Known Subclasses:
TransformOutputStream

public class RTPConnectorOutputStream
extends Object
implements javax.media.rtp.OutputDataStream

Author:
Bing SU (nova.su@gmail.com), Lubomir Marinov

Field Summary
protected  List<InetSocketAddress> targets
          Stream targets' ip addresses and ports.
 
Constructor Summary
RTPConnectorOutputStream(DatagramSocket socket)
          Initializes a new RTPConnectorOutputStream which is to send packet data out through a specific UDP socket.
 
Method Summary
 void addTarget(InetAddress remoteAddr, int remotePort)
          Add a target to stream targets list
protected  RawPacket createRawPacket(byte[] buffer, int offset, int length)
          Creates a new RawPacket from a specific byte[] buffer in order to have this instance send its packet data through its write(byte[], int, int) method.
 boolean removeTarget(InetAddress remoteAddr, int remotePort)
          Remove a target from stream targets list
 void removeTargets()
          Remove all stream targets from this session.
 int write(byte[] buffer, int offset, int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targets

protected final List<InetSocketAddress> targets
Stream targets' ip addresses and ports.

Constructor Detail

RTPConnectorOutputStream

public RTPConnectorOutputStream(DatagramSocket socket)
Initializes a new RTPConnectorOutputStream which is to send packet data out through a specific UDP socket.

Parameters:
socket - the UDP socket used to send packet data out
Method Detail

addTarget

public void addTarget(InetAddress remoteAddr,
                      int remotePort)
Add a target to stream targets list

Parameters:
remoteAddr - target ip address
remotePort - target port

createRawPacket

protected RawPacket createRawPacket(byte[] buffer,
                                    int offset,
                                    int length)
Creates a new RawPacket from a specific byte[] buffer in order to have this instance send its packet data through its write(byte[], int, int) method. Allows extenders to intercept the packet data and possibly filter and/or modify it.

Parameters:
buffer - the packet data to be sent to the targets of this instance
offset - the offset of the packet data in buffer
length - the length of the packet data in buffer
Returns:
a new RawPacket containing the packet data of the specified byte[] buffer or possibly its modification; null to ignore the packet data of the specified byte[] buffer and not send it to the targets of this instance through its write(byte[], int, int) method

removeTarget

public boolean removeTarget(InetAddress remoteAddr,
                            int remotePort)
Remove a target from stream targets list

Parameters:
remoteAddr - target ip address
remotePort - target port
Returns:
true if the target is in stream target list and can be removed false if not

removeTargets

public void removeTargets()
Remove all stream targets from this session.


write

public int write(byte[] buffer,
                 int offset,
                 int length)
Specified by:
write in interface javax.media.rtp.OutputDataStream

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.