This example code demonstrates RTP packet streaming. It uses CRtpFileSender
to send RTP packets and CRtpFileStreamer
to receive RTP packets. The example opens an RTP session using the
pre-connected socket and initialises new send and receive sources
on the RTP session. It registers the callback functions when an RTP
packet is successfully sent by a send source or received by a receive
source, to receive notifications whenever an RTP packet is sent or
received.
The RTPExample
example code
provides the following functionality:
Click on the following link to download the example: RTPExample.zip
Click browse to view the example code.
void CRtpFileStreamer::ConstructL();
Opens an RTP session using the pre-connected socket and initialises new send sources on the RTP session.
void CRtpFileSender::RunL();
Sends the RTP packet. This does the following:
gets a new RTP packet to send from the send source
sets the RTP timestamp of the RTP packet
reads a block of data from the source file
creates an RTP packet using the block of data
sends the RTP packet
closes the source file.
CRtpFileSender::PacketSent()
is called
to notify that the RTP packet has been successfully sent.
void CRtpFileStreamer::NewSource();
When an RTP packet with a new receive source arrives, this callback function is called, which registers the packet. This can be used for different types of RTP packets such as APP, BYE, SDES, SR and RR.
void CRtpFileStreamer::PacketArrived();
Whenever an RTP packet arrives, this callback function is called. The function retrieves the payload from the packet received and writes it to the target file.
The Symbian build process describes how to build an application.
This is a console application, so does not have a GUI. It builds
an executable called RTPExample.exe
in the standard
location (\epoc32\release\winscw\
<build_variant> for CodeWarrior). After launching the executable, depending on the
emulator you are using, you may need to task away from the app launcher/shell
screen to view the console.