This topic explains how to send and receive non-RTP data packets on the RTP and RTCP sockets.
Exchanging non-RTP data on an RTP socket is one of the techniques you can use to implement NAT traversal (maintaining client-to-client network connections through Network Address Translation gateways).
The RRtpSession::SendDataL() method does not attach the RTP or RTCP header to the data.
// initialise the data const TInt KNonRtpBufferMaxLength = 100; TBuf8<KNonRtpBufferMaxLength> nonRtpData; nonRtpData.SetLength(KNonRtpBufferMaxLength); nonRtpData.Fill('Z'); TRequestStatus stat; iServer->rtpSession.SendDataL(ETrue,nonRtpData, stat); User::WaitForRequest(stat);
By default, when receiving data identified as non-RTP, the RTP stack discards it.
To receive non-RTP data, you need to register for the ENonRtpDataReceived and ENonRtcpDataReceived events. When you register for one of these events, the RTP stack no longer discards the non-RTP data but does not process the data either. To retrieve the data, call the following functions:
NonRtpDataL() provides the non-RTP data received by the RTP socket.
const TDesC8& des = iServer->rtpSession.NonRtpDataL();
NonRtcpDataL() provides the non-RTP data received by the RTCP socket.
const TDesC8& des = iServer->rtpSession.NonRtcpDataL();
To stop receiving non-RTP data, call the DisableNonRtpData() method. The RTP stack cancels your registration to the non-RTP data events and discards the non-RTP packets.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.