This page describes how to create a new session with the socket server and how to open the session and set some of the session parameters. It also describes how to use an RTP RSocket interface.
To communicate with RTP, open a session with the socket server . You can open several sessions at the same time.
An active scheduler must be created and started before you open an RTP session.
RRtpSession::OpenL() opens an RTP session and starts it. The method has four overloads. RTCP is enabled for the first three overloads and is disabled for the last overload.
IMPORT_C void OpenL(RSocketServ &aServer, TSockAddr &aLocalAddr, TSockAddr &aRemoteAddr, TInt aMaxRXSize, RConnection &aConnection, TInt aPriority=EPriorityNormal, const TDesC8 &aCNAME=KNullDesC8);
IMPORT_C void OpenL(RSocketServ &aServer, TSockAddr &aLocalAddr, TSockAddr &aRemoteAddr, TInt aMaxRXSize, TInt aPriority=EPriorityNormal, const TDesC8 &aCNAME=KNullDesC8);
IMPORT_C void OpenL(RSocket &aSocket, TInt aMaxRXSize, RSocket &aRtcpSocket, TInt aPriority=EPriorityNormal, const TDesC8 &aCNAME=KNullDesC8);
After creating an RTP session, you need to set the following parameters before sending and receiving RTP packets:
the bandwidth for the RTP stream, by calling the SetBandwidth() method
the conversion rate for the RTCP timestamp, by calling the SetRTPTimeConversion() method
During an active RTP session, you can change the following parameters:
the destination address, by calling the SetRemoteAddress() method
the remote RTCP port, by calling the SetRemoteRtcpPort() method
When specifying a new remote address for the RTP session, the remote RTCP port is set one port higher than the RTP port, as defined by the RTP standard. When specifying a new RTCP port, the RTP port is not modified.
Note : If you need more configuration options for your RTP communications, you can change the settings of the internal sockets. The RtpSocket() and RtcpSocket() methods return the handles of the internal sockets used for RTP and RTCP data.
The following code shows how to create a new session, and set session parameters.
// [...] // Construct a new session object RRtpSession session; session.OpenL(iRtpSocket, 1500, EPriorityNormal); // Set the RTP session parameters session.SetBandwidth(1000); // Set session bandwidth in bps at the start up //SetRTPTimeConversion API is called before receiving an RTP packet session.SetRTPTimeConversion(100, 100); // Set RTP time conversion for generating the RTP timestamps in RTCP packets
The following code shows how to change parameters during the RTP session:
// sample address and port for the RTP socket TSockAddr newAddr; newAddrr.SetAddress(INET_ADDR(192,168,0,1)); newAddr.SetPort(4646); // changing the RTP destination session.SetRemoteAddress(newAddr); // by default, the RTCP port is set to the first port higher than the RTP port session.SetRemoteRtcpPort(4649); // turning IMCP errors onsession. RtpSocket().SetOpt(KSoUdpReceiveICMPError, KSolInetUdp, 1);
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.