Join Now
Quality Rating:
  • Currently 3.0 / 5
(3.0 / 5 - 2 votes cast)
Expertise Level:
  • Currently 2.3 / 5
(2.3 / 5 - 3 votes cast)

This page was last modified 18:44, 24 June 2008.

S60 RTP/RTC API

From Forum Nokia Wiki

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


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.

Example Application

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.

3) Call SetIPaddress in one device and give the IP of the other and vice versa.

4) 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)
	{
 
	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);
	}
Related Discussions
Thread Thread Starter Forum Replies Last Post
RTP Stack and VoIP fcobsb General Symbian C++ 0 2006-02-14 22:49
rtp support chrisosmak Mobile Java General 3 2006-12-01 01:15
RTP Streaming on Series 60 (specifically the 6600) uvbp Mobile Java Media (Graphics & Sounds) 1 2005-01-29 05:02
Datagram on nokia 6630 prakash_chowdary Mobile Java Networking & Messaging & Security 1 2005-07-11 07:50
Receive a RTP Packet from network? coolzero Symbian Networking & Messaging 3 2006-11-28 10:27
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZconnectivityQ
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtopicQUqfnTopicZwlanQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX