Next: , Previous: ccRTP Overview, Up: Top

4 Using ccRTP

When using ccRTP, both sending and receiving of data transported over RTP sessions is done through reception and transmission queues handled by the RTP stack. In the most common case, a separate execution thread for each RTP session handles the queues. This case is the threading model that we will generally assume throughout this document. Note however that ccRTP supports other threading models, particularly ccRTP supports the use of a single execution thread to serve a set of RTP sessions. It is also possible to not associate any separate thread with any RTP session, manually calling the main data and control service methods from whatever other thread.

The basic idea for packet reception with ccRTP is that the application does not directly read packets from sockets but gets them from a reception queue. The stack is responsible for inserting received packets in the reception queue and handling this queue. In general, a packet reception and insertion in the reception queue does not occur at the same time the application gets it from the queue.

Conversely, the basic idea for packet transmission with ccRTP is that packets are not directly written to sockets but inserted in a transmission queue handled by the stack. In general, packet insertion and transmission occur at different times, though it is not necessary.

In order to use ccRTP, you must include the main header (#include <ccrtp/rtp.h>. Two additional headers are provided by ccRTP:

#include <ccrtp/rtppool.h
Classes for pools of RTP service threads.
#include <ccrtp/rtpext.h>
Classes for RTP extensions which are not mature yet.

You must also link in the library, currently ccrtp1.

As presented in the last examples, before starting to send or receive data, RTP sessions must be created, the payload format to use must be set and the stack must be signaled to start running. The following sections describe the use of ccRTP during the different phases of RTP sessions and RTP applications in general.