net.sf.fmj.media.rtp
Class RTPSocketAdapter

java.lang.Object
  extended by net.sf.fmj.media.rtp.RTPSocketAdapter
All Implemented Interfaces:
RTPConnector

public class RTPSocketAdapter
extends java.lang.Object
implements RTPConnector

An implementation of RTPConnector based on UDP sockets.

Version:
1-1-alpha2
Author:
Andrew G D Rowley

Constructor Summary
RTPSocketAdapter(java.net.InetAddress laddr, java.net.InetAddress addr, int port, int ttl)
          Creates a new RTPSocketAdaptor
RTPSocketAdapter(java.net.InetAddress addr, int port)
          Creates a new RTPSocketAdaptor with TTL 1
RTPSocketAdapter(java.net.InetAddress addr, int port, int ttl)
          Creates a new RTPSocketAdaptor
 
Method Summary
 void close()
          Close all the RTP, RTCP streams.
 PushSourceStream getControlInputStream()
          Returns an input stream to receive the RTCP data.
 OutputDataStream getControlOutputStream()
          Returns an output stream to send the RTCP data.
 PushSourceStream getDataInputStream()
          Returns an input stream to receive the RTP data.
 OutputDataStream getDataOutputStream()
          Returns an output stream to send the RTP data.
 int getReceiveBufferSize()
          Get the receive buffer size set on the RTP data channel.
 double getRTCPBandwidthFraction()
          Return the RTCP bandwidth fraction.
 double getRTCPSenderBandwidthFraction()
          Return the RTCP sender bandwidth fraction.
 int getSendBufferSize()
          Get the send buffer size set on the RTP data channel.
 void setEncryption(RTPCrypt crypter)
          Sets the encryption on the socket
 void setReceiveBufferSize(int size)
          Set the receive buffer size of the RTP data channel.
 void setSendBufferSize(int size)
          Set the send buffer size of the RTP data channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RTPSocketAdapter

public RTPSocketAdapter(java.net.InetAddress addr,
                        int port)
                 throws java.io.IOException
Creates a new RTPSocketAdaptor with TTL 1

Parameters:
addr - The address of the socket
port - The port of the socket (data)
Throws:
java.io.IOException

RTPSocketAdapter

public RTPSocketAdapter(java.net.InetAddress addr,
                        int port,
                        int ttl)
                 throws java.io.IOException
Creates a new RTPSocketAdaptor

Parameters:
addr - The address of the socket
port - The port of the socket
ttl - The ttl for sending data
Throws:
java.io.IOException

RTPSocketAdapter

public RTPSocketAdapter(java.net.InetAddress laddr,
                        java.net.InetAddress addr,
                        int port,
                        int ttl)
                 throws java.io.IOException
Creates a new RTPSocketAdaptor

Parameters:
laddr - The local address to bind to
addr - The address of the socket
port - The port of the socket
ttl - The ttl for sending data
Throws:
java.io.IOException
Method Detail

setEncryption

public void setEncryption(RTPCrypt crypter)
Sets the encryption on the socket

Parameters:
crypter - The encrypter/decrypter

getDataInputStream

public PushSourceStream getDataInputStream()
Returns an input stream to receive the RTP data.

Specified by:
getDataInputStream in interface RTPConnector

getDataOutputStream

public OutputDataStream getDataOutputStream()
Returns an output stream to send the RTP data.

Specified by:
getDataOutputStream in interface RTPConnector

getControlInputStream

public PushSourceStream getControlInputStream()
Returns an input stream to receive the RTCP data.

Specified by:
getControlInputStream in interface RTPConnector

getControlOutputStream

public OutputDataStream getControlOutputStream()
Returns an output stream to send the RTCP data.

Specified by:
getControlOutputStream in interface RTPConnector

close

public void close()
Close all the RTP, RTCP streams.

Specified by:
close in interface RTPConnector

setReceiveBufferSize

public void setReceiveBufferSize(int size)
                          throws java.io.IOException
Set the receive buffer size of the RTP data channel. This is only a hint to the implementation. The actual implementation may not be able to do anything to this.

Specified by:
setReceiveBufferSize in interface RTPConnector
Throws:
java.io.IOException

getReceiveBufferSize

public int getReceiveBufferSize()
Get the receive buffer size set on the RTP data channel. Return -1 if the receive buffer size is not applicable for the implementation.

Specified by:
getReceiveBufferSize in interface RTPConnector

setSendBufferSize

public void setSendBufferSize(int size)
                       throws java.io.IOException
Set the send buffer size of the RTP data channel. This is only a hint to the implementation. The actual implementation may not be able to do anything to this.

Specified by:
setSendBufferSize in interface RTPConnector
Throws:
java.io.IOException

getSendBufferSize

public int getSendBufferSize()
Get the send buffer size set on the RTP data channel. Return -1 if the send buffer size is not applicable for the implementation.

Specified by:
getSendBufferSize in interface RTPConnector

getRTCPBandwidthFraction

public double getRTCPBandwidthFraction()
Return the RTCP bandwidth fraction. This value is used to initialize the RTPManager. Check RTPManager for more detauls. Return -1 to use the default values.

Specified by:
getRTCPBandwidthFraction in interface RTPConnector

getRTCPSenderBandwidthFraction

public double getRTCPSenderBandwidthFraction()
Return the RTCP sender bandwidth fraction. This value is used to initialize the RTPManager. Check RTPManager for more detauls. Return -1 to use the default values.

Specified by:
getRTCPSenderBandwidthFraction in interface RTPConnector