Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

(Redirected from S60 RTP/RTC API)


From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: ltomuta (17 Jun 2007)
Last edited: hamishwillee (30 May 2013)

Note.pngNote: This API is not part of the public SDK. It can be found in the SDK API Plug-in.


The Real-time Transport Protocol (or RTP) defines a standardized packet format for delivering audio and video over the Internet. The RTP as such is agnostic to the payload and can be used to transfer any type of data.

Use cases

It was originally designed as a multicast protocol, but has since been applied in many unicast applications. It is frequently used in streaming media systems (in conjunction with RTSP) as well as videoconferencing and push to talk systems (in conjunction with H.323 or SIP), making it the technical foundation of the Voice over IP industry. It goes along with the RTCP and it's built on top of the User Datagram Protocol (UDP). Applications using RTP are less sensitive to packet loss, but typically very sensitive to delays, so UDP is a better choice than TCP for such applications.

Example code

Attached is the example application which sends APS buffer over WLAN using the RTP protocol and establishes a full duplex communication:

The steps to test this application in full duplex mode are:

  1. Install the application in two devices supporting WLAN.
    Follow the steps below in both the devices.
  2. Call initialize device from the application menu which by default sets the codec to G711. You can also select different codecs before calling initialize device.
  3. Call Establish connection. Choose the WLAN network. It gives the IP address assigned to the devices.
  4. Call SetIPaddress in one device and give the IP of the other and vice versa.
  5. Call start streaming on both phones.

Header Files:

#include <rtpapi.h> 
#include <rtpheader.h>

Link against:

LIBRARY rtpservice.lib

code snippets:

// ----------------------------------------------------------------------------
// CRTPEngine::StartRTPConnection
// Initializes the RTP streams.
// ----------------------------------------------------------------------------
void CRTPEngine::StartRTPConnectionL(TUint aAddr)
TUint localPort = 5000;
TUint remotePort = 5000;
TInetAddr addr1;
iRtpSession = CRtpAPI::NewL(*this);
TInetAddr localAddr;
// Open RTP session
TInt error = iRtpSession->OpenL( iParam, NULL,
iTimeStamp = 1;
// Create new RTP session
TCreateSessionParams sessionParam = TCreateSessionParams();
sessionParam.iPriority = TCreateSessionParams::EPriorityStandard;
iRtpId = iRtpSession->CreateSessionL( sessionParam, localPort, EFalse,
// Set remote address
TInt err1 = iRtpSession->SetRemoteAddress(iRtpId, addr1 );
// Register for RTP callback
err1 = iRtpSession->RegisterRtpObserver(iRtpId, *this);
TRcvStreamParams aRcvParams;
// Create RTP receive stream
iReceivedStreamId = iRtpSession->CreateReceiveStreamL(iRtpId,RcvParams);
// Start RTP send stream
TTranStreamParams aTransmitParams;
aTransmitParams.iPayloadType = NULL;
iTransmitStreamId = iRtpSession->CreateTransmitStreamL(iRtpId,
aTransmitParams, iSsrcId);
iSendHeader = TRtpSendHeader();
// Start RTP session
err1 = iRtpSession->StartSession(iRtpId);
// ----------------------------------------------------------------------------
// CRTPEngine::RtpPacketReceived
// Receives the incoming RTP packets and sends it to the queue handler.
// ----------------------------------------------------------------------------
void CRTPEngine::RtpPacketReceived( TRtpId aStreamId,
const TRtpRecvHeader & aHeaderInfo, const TDesC8 & aPayloadData )

// ----------------------------------------------------------------------------
// CRTPEngine::SendRtpPacketL
// Sends the RTP packets to the remote destination
// ----------------------------------------------------------------------------
void CRTPEngine::SendRtpPacketL(TDesC8& aBuffer)
iTimeStamp = iTimeStamp + 160;
iSendHeader.iTimestamp = iTimeStamp;
TInt error = iRtpSession->SendRtpPacket(iTransmitStreamId, iSendHeader,
This page was last modified on 30 May 2013, at 23:34.
53 page views in the last 30 days.