|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-5287A403-1094-5682-A443-A6C2A04A1F23" xml:lang="en"><title>Creating |
|
13 and Managing an RTP session</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>This page describes how to create a new session with the socket server |
|
15 and how to open the session and set some of the session parameters. It also |
|
16 describes how to use an RTP <xref href="GUID-97FC8566-E4AD-3881-8669-134798A88779.dita"><apiname>RSocket</apiname></xref> interface. </p> |
|
17 <p>To communicate with RTP, open a session with the <xref href="GUID-61E0CD76-A2E3-5066-84A8-146EECA8ADCD.dita">socket |
|
18 server</xref>. You can open several sessions at the same time. </p> |
|
19 <p>An <xref href="GUID-2C5D53A3-0211-5C14-BD7F-E89EB27BAD2A.dita">active scheduler</xref> must |
|
20 be created and started before you open an RTP session. </p> |
|
21 <section><title>Opening a session</title> <p> <xref href="GUID-97FC8566-E4AD-3881-8669-134798A88779.dita"><apiname>RRtpSession::OpenL()</apiname></xref> opens |
|
22 an RTP session and starts it. The method has four overloads. RTCP is enabled |
|
23 for the first three overloads and is disabled for the last overload. </p> <codeblock id="GUID-AFB0BF5E-DE8C-5AAE-B693-B3F6721B5321" xml:space="preserve">IMPORT_C void OpenL(RSocketServ &aServer, TSockAddr &aLocalAddr, TSockAddr &aRemoteAddr, TInt aMaxRXSize, RConnection &aConnection, TInt aPriority=EPriorityNormal, const TDesC8 &aCNAME=KNullDesC8);</codeblock> <codeblock id="GUID-DEF6E5F9-BC04-5092-B444-08EB85268431" xml:space="preserve">IMPORT_C void OpenL(RSocketServ &aServer, TSockAddr &aLocalAddr, TSockAddr &aRemoteAddr, TInt aMaxRXSize, TInt aPriority=EPriorityNormal, const TDesC8 &aCNAME=KNullDesC8);</codeblock> <codeblock id="GUID-53661685-AA43-5EBB-B3A3-EC3EE143CC0E" xml:space="preserve">IMPORT_C void OpenL(RSocket &aSocket, TInt aMaxRXSize, RSocket &aRtcpSocket, TInt aPriority=EPriorityNormal, const TDesC8 &aCNAME=KNullDesC8);</codeblock> <codeblock id="GUID-5283B661-0617-5656-B004-8A70B04E5DD9" xml:space="preserve">IMPORT_C void OpenL(RSocket &aSocket, TInt aMaxRXSize, TInt aPriority=EPriorityNormal);</codeblock> </section> |
|
24 <section> <title>Setting session parameters</title> <p>After |
|
25 creating an RTP session, you need to set the following parameters before sending |
|
26 and receiving RTP packets: </p> <ul> |
|
27 <li id="GUID-E68D70C1-99D6-59E3-81F7-D022F0FEF545"><p>the bandwidth for the |
|
28 RTP stream, by calling the <xref href="GUID-97FC8566-E4AD-3881-8669-134798A88779.dita"><apiname>SetBandwidth()</apiname></xref> method </p> </li> |
|
29 <li id="GUID-9D89740D-74C2-5CDC-846E-9E10EFAFEBBC"><p>the conversion rate |
|
30 for the RTCP timestamp, by calling the <xref href="GUID-97FC8566-E4AD-3881-8669-134798A88779.dita"><apiname>SetRTPTimeConversion()</apiname></xref> method </p> </li> |
|
31 </ul> <p>During an active RTP session, you can change the following parameters: </p> <ul> |
|
32 <li id="GUID-1A5C1270-11D3-5557-94BE-AAF74ADD2AEC"><p>the destination address, |
|
33 by calling the <xref href="GUID-97FC8566-E4AD-3881-8669-134798A88779.dita"><apiname>SetRemoteAddress()</apiname></xref> method </p> </li> |
|
34 <li id="GUID-9E2B4415-4D5A-5FB1-96E8-83F9E60944D9"><p>the remote RTCP port, |
|
35 by calling the <xref href="GUID-97FC8566-E4AD-3881-8669-134798A88779.dita"><apiname>SetRemoteRtcpPort()</apiname></xref> method </p> </li> |
|
36 </ul> <p>When specifying a new remote address for the RTP session, the remote |
|
37 RTCP port is set one port higher than the RTP port, as defined by the RTP |
|
38 standard. When specifying a new RTCP port, the RTP port is not modified. </p> <p> <b>Note</b>: |
|
39 If you need more configuration options for your RTP communications, you can |
|
40 change the settings of the internal sockets. The <xref href="GUID-97FC8566-E4AD-3881-8669-134798A88779.dita"><apiname>RtpSocket()</apiname></xref> and <xref href="GUID-97FC8566-E4AD-3881-8669-134798A88779.dita"><apiname>RtcpSocket()</apiname></xref> methods return the handles of |
|
41 the internal sockets used for RTP and RTCP data. </p> </section> |
|
42 <section><title>Example</title> <p>The following code shows how to create |
|
43 a new session, and set session parameters. </p> <codeblock id="GUID-8AA5C199-15D4-5259-92DC-4389C3F40C2E" xml:space="preserve">// [...] |
|
44 |
|
45 // Construct a new session object |
|
46 RRtpSession session; |
|
47 session.OpenL(iRtpSocket, 1500, EPriorityNormal); |
|
48 |
|
49 // Set the RTP session parameters |
|
50 session.SetBandwidth(1000); // Set session bandwidth in bps at the start up |
|
51 |
|
52 //SetRTPTimeConversion API is called before receiving an RTP packet |
|
53 session.SetRTPTimeConversion(100, 100); // Set RTP time conversion for generating the RTP timestamps in RTCP packets |
|
54 </codeblock> <p>The following code shows how to change parameters during the |
|
55 RTP session: </p> <codeblock id="GUID-745688FD-A148-5668-A962-64985A952EB1" xml:space="preserve"> |
|
56 // sample address and port for the RTP socket |
|
57 TSockAddr newAddr; |
|
58 newAddrr.SetAddress(INET_ADDR(192,168,0,1)); |
|
59 newAddr.SetPort(4646); |
|
60 |
|
61 // changing the RTP destination |
|
62 session.SetRemoteAddress(newAddr); |
|
63 |
|
64 // by default, the RTCP port is set to the first port higher than the RTP port |
|
65 session.SetRemoteRtcpPort(4649); |
|
66 |
|
67 // turning IMCP errors onsession. |
|
68 RtpSocket().SetOpt(KSoUdpReceiveICMPError, KSolInetUdp, 1); |
|
69 </codeblock> </section> |
|
70 </conbody></concept> |