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.util.Collection<org.mobicents.media.server.spi.dsp.Codec> codecs
           
protected  java.lang.String media
           
protected  java.net.InetSocketAddress remoteAddress
           
protected  org.mobicents.media.server.spi.Timer timer
           
 
Constructor Summary
RtpSocket(RtpFactory rtpFactory, Transceiver transceiver, org.mobicents.media.server.spi.Timer timer, java.util.Collection<org.mobicents.media.server.spi.dsp.Codec> codecs, AVProfile avProfile, java.lang.String media)
          Creates a new instance of RtpSocket
 
Method Summary
 AVProfile getAVProfile()
           
 RtpClock getClock()
          Gets current RTP clock instance.
 java.util.Collection<org.mobicents.media.server.spi.dsp.Codec> getCodecs()
           
 org.mobicents.media.Format getFormat()
           
 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.
 org.mobicents.media.MediaSource getReceiveStream()
          Gets receiver stream.
 SendStream getSendStream()
          (Non Java-doc).
protected  org.mobicents.media.server.spi.Timer getTimer()
           
protected  void notify(java.lang.Exception e)
           
 void receive(RtpPacket rtpPacket)
          This method is called when rtp socket receives new rtp frame.
 void release()
          Closes this socket and resets its streams;
 void send(byte[] packet)
           
 void send(RtpPacket packet)
          Sends media data to remote peer.
 void setClock(RtpClock clock)
          Assign RTP clock implementation.
 void setDtmfPayload(int dtmf)
           
 void setFormat(int payloadId, org.mobicents.media.Format format)
          Specifies format and payload id which will be used by this socket for transmission This methods should be used by other components which are responsible for SDP negotiation.
 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 setPeriod(int period)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

media

protected java.lang.String media

remoteAddress

protected java.net.InetSocketAddress remoteAddress

timer

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

codecs

protected java.util.Collection<org.mobicents.media.server.spi.dsp.Codec> codecs
Constructor Detail

RtpSocket

public RtpSocket(RtpFactory rtpFactory,
                 Transceiver transceiver,
                 org.mobicents.media.server.spi.Timer timer,
                 java.util.Collection<org.mobicents.media.server.spi.dsp.Codec> codecs,
                 AVProfile avProfile,
                 java.lang.String media)
Creates a new instance of RtpSocket

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

getTimer

protected org.mobicents.media.server.spi.Timer getTimer()

getFormat

public org.mobicents.media.Format getFormat()

setPeriod

public void setPeriod(int period)

getCodecs

public java.util.Collection<org.mobicents.media.server.spi.dsp.Codec> getCodecs()

setFormat

public void setFormat(int payloadId,
                      org.mobicents.media.Format format)
Specifies format and payload id which will be used by this socket for transmission This methods should be used by other components which are responsible for SDP negotiation. The socket itself can not negotiate SDP.

Parameters:
payloadId - rtp payload number
format - the format object.

setDtmfPayload

public void setDtmfPayload(int dtmf)

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.

setClock

public void setClock(RtpClock clock)
Assign RTP clock implementation.

Parameters:
clock - the RTP clock instance;

getClock

public RtpClock getClock()
Gets current RTP clock instance.

Returns:
the RTP clock instance.

getReceiveStream

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

Returns:
receiver stream instance.

getAVProfile

public AVProfile getAVProfile()

release

public void release()
Closes this socket and resets its streams;


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

getSendStream

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

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

send

public void send(RtpPacket packet)
          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:
RtpPacket - - the packet which contains media data and rtp header
Throws:
java.io.IOException

send

public void send(byte[] packet)
          throws java.io.IOException
Throws:
java.io.IOException

receive

public void receive(RtpPacket rtpPacket)
This method is called when rtp socket receives new rtp frame.

Parameters:
rtpPacket -

notify

protected void notify(java.lang.Exception e)


Copyright © 2010. All Rights Reserved.