Symbian RTP/RTCP API
Article Metadata
Code Example
Article
APIPurpose
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: File:RTPexample.zip
The steps to test this application in full duplex mode are:
- Install the application in two devices supporting WLAN.
- Follow the steps below in both the devices.
- 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.
- Call Establish connection. Choose the WLAN network. It gives the IP address assigned to the devices.
- Call SetIPaddress in one device and give the IP of the other and vice versa.
- Call start streaming on both phones.
Header Files:
#include <rtpapi.h>
#include <rtpheader.h>
Link against:
LIBRARY rtpservice.libcode snippets:
// ----------------------------------------------------------------------------
// CRTPEngine::StartRTPConnection
// Initializes the RTP streams.
// ----------------------------------------------------------------------------
//
void CRTPEngine::StartRTPConnectionL(TUint aAddr)
{
iErrorNotify=0;
TUint localPort = 5000;
TUint remotePort = 5000;
TInetAddr addr1;
addr1.SetAddress(aAddr);
addr1.SetPort(remotePort);
iRtpSession = CRtpAPI::NewL(*this);
iParam.iCName.Set(KName);
iParam.iUserName.Set(KName);
iParam.iEmail.Set(KName);
iParam.iPhoneNumber.Set(KName);
iParam.iLocation.Set(KName);
iParam.iSwToolName.Set(KName);
iParam.iNoticeStatus.Set(KName);
iParam.iPrivate.Set(KName);
TInetAddr localAddr;
localAddr.SetPort(localPort);
// Open RTP session
TInt error = iRtpSession->OpenL( iParam, NULL,
&iSocketServer,&iConnection);
iTimeStamp = 1;
// Create new RTP session
TCreateSessionParams sessionParam = TCreateSessionParams();
sessionParam.iPriority = TCreateSessionParams::EPriorityStandard;
iRtpId = iRtpSession->CreateSessionL( sessionParam, localPort, EFalse,
NULL );
// 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 )
{
iAPSObserver.PacketReceived(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,
aBuffer);
}


Devnull - Title update would be best
Proposing the "S60 RTP/RTC API" to be changed as "S60 RTP/RTCP API"
As no RTC API is described in this page.Devnull 12:19, 19 July 2012 (EEST)
Devnull - Update on the API in connection with Belle would be nice
RTSP FAQ link would be nice to add: http://www.cs.columbia.edu/~hgs/rtsp/faq.html
along with the relevant RFCs: RTSP: http://www.ietf.org/rfc/rfc2326.txt RTP: http://www.ietf.org/rfc/rfc3550.txt
wikis: http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol http://en.wikipedia.org/wiki/RTCP ...
http://library.developer.nokia.com/topic/S60_5th_Edition_Cpp_Developers_Library/GUID-795ED4C0-7C82-41DE-AD5B-AC69A426E2A5.html?resultof=%22RTSP%22%20%22rtsp%22%20¨ http://library.developer.nokia.com/topic/S60_3rd_Edition_Cpp_Developers_Library/GUID-35228542-8C95-4849-A73F-2B4F082F0C44/html/SDL_93/doc_source/guide/Multimedia-Protocols-subsystem-guide/RTP/RTPOverview.html?resultof=%22RTP%22%20%22rtp%22%20
and book(s):
http://www.amazon.com/Computer-Networks-Edition-Andrew-Tanenbaum/dp/0132126958/ref=la_B000AQ1UBW_1_1?ie=UTF8&qid=1342690238&sr=1-1Devnull 12:37, 19 July 2012 (EEST)
Hamishwillee - Devnull - good suggestions, why not do yourself?
Hi Devnull
I've moved the page - with Symbian prefix since I'm slowly moving the Symbian as platform name in wiki. You can do this yourself using "Move" option under the little eye in the top right of the page.
With respect to the new documentation links, they all look great. Why not incorporate these yourself?
Regards
Hamishhamishwillee 04:47, 6 August 2012 (EEST)