RTPSession Class Reference

Full RTP session. More...

#include <yatertp.h>

Inheritance diagram for RTPSession:

RTPProcessor GenObject

List of all members.

Public Types

enum  Direction { FullStop = 0, RecvOnly = 1, SendOnly = 2, SendRecv = 3 }

Public Member Functions

 RTPSession ()
virtual ~RTPSession ()
virtual void rtpData (const void *data, int len)
virtual void rtcpData (const void *data, int len)
virtual bool rtpRecvData (bool marker, unsigned int timestamp, const void *data, int len)
virtual bool rtpRecvEvent (int event, char key, int duration, int volume, unsigned int timestamp)
virtual void rtpNewPayload (int payload, unsigned int timestamp)
virtual void rtpNewSSRC (u_int32_t newSsrc, bool marker)
virtual RTPSendercreateSender ()
virtual RTPReceivercreateReceiver ()
virtual RTPTransportcreateTransport ()
bool initTransport ()
bool initGroup (int msec=0, Thread::Priority prio=Thread::Normal)
bool rtpSend (bool marker, int payload, unsigned int timestamp, const void *data, int len)
bool rtpSendData (bool marker, unsigned int timestamp, const void *data, int len)
bool rtpSendEvent (int event, int duration, int volume=0, unsigned int timestamp=0)
bool rtpSendKey (char key, int duration, int volume=0, unsigned int timestamp=0)
int padding () const
bool padding (int chunk)
void setDejitter (unsigned int mindelay=20, unsigned int maxdelay=50)
RTPTransporttransport () const
void transport (RTPTransport *trans)
RTPSendersender () const
void sender (RTPSender *send)
RTPReceiverreceiver () const
void receiver (RTPReceiver *recv)
Direction direction () const
bool direction (Direction dir)
bool addDirection (Direction dir)
bool delDirection (Direction dir)
bool dataPayload (int type)
bool eventPayload (int type)
bool silencePayload (int type)
bool localAddr (SocketAddr &addr, bool rtcp=true)
bool remoteAddr (SocketAddr &addr, bool sniff=false)
bool setTOS (int tos)
SocketrtpSock ()
bool drillHole ()
void setTimeout (int interval)

Protected Member Functions

virtual void timerTick (const Time &when)
virtual void timeout (bool initial)


Detailed Description

Full RTP session.

An unidirectional or bidirectional RTP session


Member Enumeration Documentation

enum Direction

Direction of the session


Constructor & Destructor Documentation

RTPSession (  ) 

Default constructor, creates a detached session

virtual ~RTPSession (  )  [virtual]

Destructor - shuts down the session and destroys the transport


Member Function Documentation

bool addDirection ( Direction  dir  )  [inline]

Add a direction of this session. A transport must exist for this method to succeed.

Parameters:
dir New Direction to add for this session
Returns:
True if direction was set, false if a failure occured

virtual RTPReceiver* createReceiver (  )  [virtual]

Create a new RTP receiver for this session. Override this method to create objects derived from RTPReceiver.

Returns:
Pointer to the new receiver or NULL on failure

virtual RTPSender* createSender (  )  [virtual]

Create a new RTP sender for this session. Override this method to create objects derived from RTPSender.

Returns:
Pointer to the new sender or NULL on failure

virtual RTPTransport* createTransport (  )  [virtual]

Create a new RTP transport for this session. Override this method to create objects derived from RTPTransport.

Returns:
Pointer to the new transport or NULL on failure

bool dataPayload ( int  type  ) 

Set the data payload type for both receiver and sender.

Parameters:
type Payload type, -1 to disable
Returns:
True if changed, false if invalid payload type

bool delDirection ( Direction  dir  )  [inline]

Delete a direction of this session. A transport must exist for this method to succeed.

Parameters:
dir Direction to remove for this session
Returns:
True if direction was set, false if a failure occured

bool direction ( Direction  dir  ) 

Set the direction of this session. A transport must exist for this method to succeed.

Parameters:
dir New Direction for this session
Returns:
True if direction was set, false if a failure occured

Direction direction (  )  const [inline]

Get the direction of this session

Returns:
Session's direction as a Direction enum

bool drillHole (  )  [inline]

Drill a hole in a firewall or NAT for the RTP and RTCP sockets

Returns:
True if at least a packet was sent for the RTP socket

bool eventPayload ( int  type  ) 

Set the event payload type for both receiver and sender.

Parameters:
type Payload type, -1 to disable
Returns:
True if changed, false if invalid payload type

bool initGroup ( int  msec = 0,
Thread::Priority  prio = Thread::Normal 
)

Initialize the RTP session, attach a group if none is present

Parameters:
msec Minimum time to sleep in group loop in milliseconds
prio Thread priority to run the new group
Returns:
True if initialized, false on some failure

bool initTransport (  ) 

Initialize the RTP session, attach a transport if there is none

Returns:
True if initialized, false on some failure

bool localAddr ( SocketAddr addr,
bool  rtcp = true 
) [inline]

Set the local network address of the RTP transport of this session

Parameters:
addr New local RTP transport address
rtpc Enable RTCP in this session
Returns:
True if address set, false if a failure occured

bool padding ( int  chunk  )  [inline]

Set the padding to a multiple of a data chunk

Parameters:
chunk Size to pad the payload to a multiple of
Returns:
True if the new chunk size is valid

int padding (  )  const [inline]

Get the payload padding size

Returns:
Chunk size to pad the payload to a multiple of

void receiver ( RTPReceiver recv  ) 

Set the RTP/RTCP receiver of this session

Parameters:
recv A pointer to the new RTPReceiver of this session or NULL

RTPReceiver* receiver (  )  const [inline]

Get the RTP/RTCP receiver of this session

Returns:
A pointer to the RTPReceiver of this session

bool remoteAddr ( SocketAddr addr,
bool  sniff = false 
) [inline]

Set the remote network address of the RTP transport of this session

Parameters:
addr New remote RTP transport address
sniff Automatically adjust the address from the first incoming packet
Returns:
True if address set, false if a failure occured

virtual void rtcpData ( const void *  data,
int  len 
) [virtual]

This method is called to process a RTCP packet.

Parameters:
data Pointer to raw RTCP data
len Length of the data packet

Reimplemented from RTPProcessor.

virtual void rtpData ( const void *  data,
int  len 
) [virtual]

This method is called to process a RTP packet.

Parameters:
data Pointer to raw RTP data
len Length of the data packet

Reimplemented from RTPProcessor.

virtual void rtpNewPayload ( int  payload,
unsigned int  timestamp 
) [virtual]

Method called for unknown payload types just before attempting to call rtpRecvData(). This is a good opportunity to change the payload type and continue.

Parameters:
payload Payload number
timestamp Sampling instant of the unexpected packet data

virtual void rtpNewSSRC ( u_int32_t  newSsrc,
bool  marker 
) [virtual]

Method called when a packet with an unexpected SSRC is received just before processing further. This is a good opportunity to change the SSRC and continue

Parameters:
newSsrc SSRC received in packet
marker True if marker bit is set in the RTP packet

virtual bool rtpRecvData ( bool  marker,
unsigned int  timestamp,
const void *  data,
int  len 
) [virtual]

Process one RTP data packet

Parameters:
marker Set to true if the marker bit is set
timestamp Sampling instant of the packet data
data Pointer to data block to process
len Length of the data block in bytes
Returns:
True if data was handled

virtual bool rtpRecvEvent ( int  event,
char  key,
int  duration,
int  volume,
unsigned int  timestamp 
) [virtual]

Process one RTP event

Parameters:
event Received event code
key Received key (for events 0-16) or zero
duration Duration of the event as number of samples
volume Attenuation of the tone, zero for don't care
timestamp Sampling instant of the initial packet data
Returns:
True if data was handled

bool rtpSend ( bool  marker,
int  payload,
unsigned int  timestamp,
const void *  data,
int  len 
) [inline]

Send one RTP payload packet

Parameters:
marker Set to true if the marker bit must be set
payload Payload number
timestamp Sampling instant of the packet data
data Pointer to data block to send
len Length of the data block
Returns:
True if data sending was attempted

bool rtpSendData ( bool  marker,
unsigned int  timestamp,
const void *  data,
int  len 
) [inline]

Send one RTP data packet

Parameters:
marker Set to true if the marker bit must be set
timestamp Sampling instant of the packet data
data Pointer to data block to send
len Length of the data block
Returns:
True if data sending was attempted

bool rtpSendEvent ( int  event,
int  duration,
int  volume = 0,
unsigned int  timestamp = 0 
) [inline]

Send one RTP event

Parameters:
event Event code to send
duration Duration of the event as number of samples
volume Attenuation of the tone, zero for don't care
timestamp Sampling instant of the packet data, zero to use current
Returns:
True if data sending was attempted

bool rtpSendKey ( char  key,
int  duration,
int  volume = 0,
unsigned int  timestamp = 0 
) [inline]

Send one RTP key event

Parameters:
key Key to send
duration Duration of the event as number of samples
volume Attenuation of the tone, zero for don't care
timestamp Sampling instant of the packet data, zero to use current
Returns:
True if data sending was attempted

Socket* rtpSock (  )  [inline]

Get the RTP socket used by this session

Returns:
Pointer to the RTP socket, NULL if no transport exists

void sender ( RTPSender send  ) 

Set the RTP/RTCP sender of this session

Parameters:
send A pointer to the new RTPSender of this session or NULL

RTPSender* sender (  )  const [inline]

Get the RTP/RTCP sender of this session

Returns:
A pointer to the RTPSender of this session

void setDejitter ( unsigned int  mindelay = 20,
unsigned int  maxdelay = 50 
) [inline]

Allocate and set a new dejitter buffer for the receiver in the session

Parameters:
mindelay Minimum length of the dejitter buffer in microseconds
maxdelay Maximum length of the dejitter buffer in microseconds

void setTimeout ( int  interval  ) 

Set the interval until receiver timeout is detected

Parameters:
interval Milliseconds until receiver times out, zero to disable

bool setTOS ( int  tos  )  [inline]

Set the Type Of Service for the RTP transport socket

Parameters:
tos Type Of Service bits to set
Returns:
True if operation was successfull, false if an error occured

bool silencePayload ( int  type  ) 

Set the silence payload type for both receiver and sender.

Parameters:
type Payload type, -1 to disable
Returns:
True if changed, false if invalid payload type

virtual void timeout ( bool  initial  )  [protected, virtual]

Method called when the receiver timed out

Parameters:
initial True if no packet was ever received in this session

virtual void timerTick ( const Time when  )  [protected, virtual]

Method called periodically to push any asynchronous data or statistics

Parameters:
when Time to use as base in all computing

Implements RTPProcessor.

void transport ( RTPTransport trans  ) 

Set the RTP/RTCP transport of data handled by this session

Parameters:
trans A pointer to the new RTPTransport for this session

RTPTransport* transport (  )  const [inline]

Get the RTP/RTCP transport of data handled by this session.

Returns:
A pointer to the RTPTransport of this session


The documentation for this class was generated from the following file:

Generated on Sun Dec 7 21:36:13 2008 for Yate by  doxygen 1.5.7.1