org.mobicents.media.server.impl.rtp
Class RtpFactory

java.lang.Object
  extended by org.mobicents.media.server.impl.rtp.RtpFactory

public class RtpFactory
extends java.lang.Object

Author:
Oleg Kulikov, amit bhayani

Field Summary
protected  java.net.InetSocketAddress publicAddress
           
protected  BufferConcurrentLinkedQueue<RtpSocket> registerQueue
           
 
Constructor Summary
RtpFactory()
          Creates RTP Factory instance
 
Method Summary
 AVProfile getAVProfile()
           
 java.lang.String getBindAddress()
          Gets the IP address to which trunk is bound.
 RtpClock getClock(org.mobicents.media.server.spi.MediaType media)
           
 java.util.Hashtable<org.mobicents.media.server.spi.MediaType,java.util.List<org.mobicents.media.server.spi.dsp.CodecFactory>> getCodecs()
           
 int getHighPort()
           
 java.lang.Integer getJitter()
          Gets the size of the jitter buffer in milliseconds.
 int getLowPort()
           
protected  int getNextPort()
          Get the next port to be used by the RtpSocket to bind Socket to passed port.
 int getPeriod()
           
 RtpSocket getRTPSocket(org.mobicents.media.server.spi.MediaType media)
          Constructs new RTP socket.
protected  java.nio.channels.Selector getSelector()
           
 java.lang.String getStunAddress()
          Gets the address of stun server if present.
 org.mobicents.media.server.spi.clock.Timer getTimer()
          Gets media processing timer used by RTP socket.
protected  void register()
           
 void setAVProfile(AVProfile avProfile)
           
 void setBindAddress(java.lang.String bindAddress)
          Modify the bind address.
 void setCodecs(java.util.Hashtable<org.mobicents.media.server.spi.MediaType,java.util.List<org.mobicents.media.server.spi.dsp.CodecFactory>> codecFactories)
           
 void setHighPort(int highPort)
           
 void setJitter(java.lang.Integer jitter)
          Modify size of the jitter buffer.
 void setLowPort(int lowPort)
           
 void setPeriod(int period)
           
 void setStunAddress(java.lang.String address)
          Assigns address of the STUN server.
 void setTimer(org.mobicents.media.server.spi.clock.Timer timer)
          Assigns media processing timer.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

publicAddress

protected java.net.InetSocketAddress publicAddress

registerQueue

protected BufferConcurrentLinkedQueue<RtpSocket> registerQueue
Constructor Detail

RtpFactory

public RtpFactory()
Creates RTP Factory instance

Method Detail

getStunAddress

public java.lang.String getStunAddress()
Gets the address of stun server if present.

Returns:
the address of stun server or null if not assigned.

setStunAddress

public void setStunAddress(java.lang.String address)
Assigns address of the STUN server.

Parameters:
address - the address of the stun server in format host[:port]. if port is not set then default port is used.

start

public void start()
           throws java.net.SocketException,
                  java.io.IOException,
                  net.java.stun4j.StunException
Throws:
java.net.SocketException
java.io.IOException
net.java.stun4j.StunException

getNextPort

protected int getNextPort()
Get the next port to be used by the RtpSocket to bind Socket to passed port.
The portIndex increments cyclic starting from lowPort to highPort and then back to lowPort
The Port is incremented by 2 as every alternate port is for RTCP.

Returns:

stop

public void stop()

getPeriod

public int getPeriod()

setPeriod

public void setPeriod(int period)

getTimer

public org.mobicents.media.server.spi.clock.Timer getTimer()
Gets media processing timer used by RTP socket.

Returns:
timer object.

setTimer

public void setTimer(org.mobicents.media.server.spi.clock.Timer timer)
Assigns media processing timer.

Parameters:
timer - tmer object.

getBindAddress

public java.lang.String getBindAddress()
Gets the IP address to which trunk is bound. All endpoints of the trunk use this address for RTP connection.

Returns:
the IP address string to which this trunk is bound.

setBindAddress

public void setBindAddress(java.lang.String bindAddress)
                    throws java.net.UnknownHostException
Modify the bind address. All endpoints of the trunk use this address for RTP connection.

Parameters:
bindAddress - IP address as string or host name.
Throws:
java.net.UnknownHostException

getLowPort

public int getLowPort()

setLowPort

public void setLowPort(int lowPort)

getHighPort

public int getHighPort()

setHighPort

public void setHighPort(int highPort)

getJitter

public java.lang.Integer getJitter()
Gets the size of the jitter buffer in milliseconds. Jitter buffer is used at the receiving ends of a VoIP connection. A jitter buffer stores received, time-jittered VoIP packets, that arrive within its time window. It then plays stored packets out, in sequence, and at a constant rate for subsequent decoding. A jitter buffer is typically filled half-way before playing out packets to allow early, or late, packet-arrival jitter compensation. Choosing a large jitter buffer reduces packet dropping from jitter but increases VoIP path delay

Returns:
the size of the buffer in milliseconds.

setJitter

public void setJitter(java.lang.Integer jitter)
Modify size of the jitter buffer. Jitter buffer is used at the receiving ends of a VoIP connection. A jitter buffer stores received, time-jittered VoIP packets, that arrive within its time window. It then plays stored packets out, in sequence, and at a constant rate for subsequent decoding. A jitter buffer is typically filled half-way before playing out packets to allow early, or late, packet-arrival jitter compensation. Choosing a large jitter buffer reduces packet dropping from jitter but increases VoIP path delay

Parameters:
jitter - the new buffer's size in milliseconds

getAVProfile

public AVProfile getAVProfile()

setAVProfile

public void setAVProfile(AVProfile avProfile)

getClock

public RtpClock getClock(org.mobicents.media.server.spi.MediaType media)

getCodecs

public java.util.Hashtable<org.mobicents.media.server.spi.MediaType,java.util.List<org.mobicents.media.server.spi.dsp.CodecFactory>> getCodecs()

setCodecs

public void setCodecs(java.util.Hashtable<org.mobicents.media.server.spi.MediaType,java.util.List<org.mobicents.media.server.spi.dsp.CodecFactory>> codecFactories)

getSelector

protected java.nio.channels.Selector getSelector()

register

protected void register()

getRTPSocket

public RtpSocket getRTPSocket(org.mobicents.media.server.spi.MediaType media)
                       throws java.io.IOException,
                              org.mobicents.media.server.spi.ResourceUnavailableException
Constructs new RTP socket.

Returns:
the RTPSocketInstance.
Throws:
net.java.stun4j.StunException
java.io.IOException
java.net.SocketException
net.java.stun4j.StunException
java.io.IOException
org.mobicents.media.server.spi.ResourceUnavailableException


Copyright © 2010. All Rights Reserved.