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

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

public class RtpSocket
extends java.lang.Object

Author:
Oleg Kulikov

Field Summary
protected  java.net.InetSocketAddress remoteAddress
           
protected  org.mobicents.media.server.spi.Timer timer
           
 
Constructor Summary
RtpSocket(Transceiver transceiver, org.mobicents.media.server.spi.Timer timer, java.util.Map<java.lang.Integer,org.mobicents.media.Format> rtpMap, RtpFactory rtpFactory)
          Creates a new instance of RtpSocket
 
Method Summary
 int getJitter()
          Gets the jitter for time of packet arrival
 RtpSocketListener getListener()
           
 java.lang.String getLocalAddress()
          Gets address to which this socked is bound.
 int getLocalPort()
          Returns port number to which this socked is bound.
protected  int getPayloadType(org.mobicents.media.Format format)
          Determines payload type for specified format.
 org.mobicents.media.MediaSource getReceiveStream()
          Gets receiver stream.
 java.util.HashMap<java.lang.Integer,org.mobicents.media.Format> getRtpMap()
          Gets relations between payload number and format used by this socket.
 SendStream getSendStream()
          (Non Java-doc).
protected  void notify(java.lang.Exception e)
           
 void receive(RtpPacket rtpPacket)
           
 void release()
           
 void resetRtpMap()
           
 void send(org.mobicents.media.Buffer buffer)
          Sends media data to remote peer.
 void setJitter(int jitter)
          Assign new value of packet time arrival jitter.
 void setListener(RtpSocketListener listener)
           
 void setPeer(java.net.InetAddress address, int port)
          Assigns remote end.
 void setRtpMap(java.util.HashMap<java.lang.Integer,org.mobicents.media.Format> rtpMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

remoteAddress

protected java.net.InetSocketAddress remoteAddress

timer

protected org.mobicents.media.server.spi.Timer timer
Constructor Detail

RtpSocket

public RtpSocket(Transceiver transceiver,
                 org.mobicents.media.server.spi.Timer timer,
                 java.util.Map<java.lang.Integer,org.mobicents.media.Format> rtpMap,
                 RtpFactory rtpFactory)
Creates a new instance of RtpSocket

Parameters:
timer - used to synchronize receiver stream.
rtpMap - RTP payloads list.
Method Detail

getLocalAddress

public java.lang.String getLocalAddress()
Gets address to which this socked is bound.

Returns:
either local address to which this socket is bound or public address in case of NAT translation.

getLocalPort

public int getLocalPort()
Returns port number to which this socked is bound.

Returns:
port number or -1 if socket not bound.

getJitter

public int getJitter()
Gets the jitter for time of packet arrival

Returns:
the value of jitter in milliseconds.

setJitter

public void setJitter(int jitter)
Assign new value of packet time arrival jitter.

Parameters:
jitter - the value of jitter in milliseconds.

getReceiveStream

public org.mobicents.media.MediaSource getReceiveStream()
Gets receiver stream.

Returns:
receiver stream instance.

release

public void release()

getListener

public RtpSocketListener getListener()

setListener

public void setListener(RtpSocketListener listener)

setPeer

public void setPeer(java.net.InetAddress address,
                    int port)
             throws java.io.IOException
Assigns remote end.

Parameters:
address - the address of the remote party.
port - the port number of the remote party.
Throws:
java.io.IOException

getRtpMap

public java.util.HashMap<java.lang.Integer,org.mobicents.media.Format> getRtpMap()
Gets relations between payload number and format used by this socket.

Returns:
the map where keya are payload number and object stored under key is Format object

setRtpMap

public void setRtpMap(java.util.HashMap<java.lang.Integer,org.mobicents.media.Format> rtpMap)

resetRtpMap

public void resetRtpMap()

getPayloadType

protected int getPayloadType(org.mobicents.media.Format format)
Determines payload type for specified format.

Parameters:
format - the object representing format.
Returns:
the integer identifier of the payload or -1 if specified format was not previously registered with addFormat().

getSendStream

public SendStream getSendStream()
(Non Java-doc).

See Also:
org.mobicents.media.server.impl.rtp.RtpSocket#startSendStream(PushBufferDataSource);

send

public void send(org.mobicents.media.Buffer buffer)
          throws java.io.IOException
Sends media data to remote peer. This method uses blocking sending to make sure that data is out in time.

Parameters:
buffer - the buffer which contains media data
Throws:
java.io.IOException

receive

public void receive(RtpPacket rtpPacket)

notify

protected void notify(java.lang.Exception e)


Copyright © 2009. All Rights Reserved.