Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.transform
Class TransformUDPOutputStream

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.RTPConnectorOutputStream
      extended by net.java.sip.communicator.impl.neomedia.RTPConnectorUDPOutputStream
          extended by net.java.sip.communicator.impl.neomedia.transform.TransformUDPOutputStream
All Implemented Interfaces:
javax.media.rtp.OutputDataStream

public class TransformUDPOutputStream
extends RTPConnectorUDPOutputStream

Extends RTPConnectorOutputStream with transform logic for UDP. In this implementation, UDP socket is used to send the data out. When a normal RTP/RTCP packet is passed down from RTPManager, we first transform the packet using user define PacketTransformer and then send it out through network to all the stream targets.

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

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.RTPConnectorOutputStream
MAX_PACKETS_PER_MILLIS_POLICY_PACKET_QUEUE_CAPACITY, targets
 
Constructor Summary
TransformUDPOutputStream(DatagramSocket socket)
          Initializes a new TransformOutputStream which is to send packet data out through a specific UDP socket.
 
Method Summary
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 RTPConnectorOutputStream.write(byte[], int, int) method.
 PacketTransformer getTransformer()
          Gets the PacketTransformer which is used to transform packets.
 void setTransformer(PacketTransformer transformer)
          Sets the PacketTransformer which is to be used to transform packets.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.RTPConnectorUDPOutputStream
doLogPacket, isSocketValid, sendToTarget
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.RTPConnectorOutputStream
addTarget, close, removeTarget, removeTargets, setMaxPacketsPerMillis, setPriority, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformUDPOutputStream

public TransformUDPOutputStream(DatagramSocket socket)
Initializes a new TransformOutputStream 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

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 RTPConnectorOutputStream.write(byte[], int, int) method. Transforms the packet to be sent.

Overrides:
createRawPacket in class RTPConnectorOutputStream
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 RTPConnectorOutputStream.write(byte[], int, int) method
See Also:
RTPConnectorOutputStream.createRawPacket(byte[], int, int)

getTransformer

public PacketTransformer getTransformer()
Gets the PacketTransformer which is used to transform packets.

Returns:
the PacketTransformer which is used to transform packets

setTransformer

public void setTransformer(PacketTransformer transformer)
Sets the PacketTransformer which is to be used to transform packets.

Parameters:
transformer - the PacketTransformer which is to be used to transform packets

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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