Symbian3/SDK/Source/GUID-46047253-4471-502D-B48E-E1990E7F7962.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-46047253-4471-502D-B48E-E1990E7F7962"><title>Sending an RTP packet</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This page describes how to prepare, create and send an RTP packet. </p> <section id="GUID-9E7AAB77-6F14-51AE-8008-B2F1C49667A5"><title>Preparing the packet</title> <p> <codeph>RRtpSendPacket</codeph> allows you to set the following fields for an RTP packet. </p> <p> <codeph>SetMarker()</codeph>: Sets or unsets the marker bit. </p> <p> <codeph>SetPayloadType()</codeph>: Sets the default payload type this is usually set befor e creating a new packet. </p> <p> <codeph>SetTimeStamp()</codeph>: Sets the sampling instant of first octet in the RTP data packet (also RTCP packet). </p> <p> <codeph>SetFlags()</codeph>: Sets the first 32 bits of the packet header. </p> <p>You can retrieve the following from an RTP packet: </p> <p> <codeph>WritePayload()</codeph>: Gets the descriptor to which the data can be written. </p> </section> <section><title>Creating a send packet</title> <p> <codeph>RRtpSendSource</codeph> allows you to create a new RTP packet. <codeph>NewSendPacketL</codeph> and <codeph>NewSendPacketLC</codeph> create a new send RTP packet. These functions return a handle to an <codeph>RRtpSendPacket</codeph> object. </p> <codeblock id="GUID-1A5771D1-9794-5307-AEE1-6398BE5DFBB2" xml:space="preserve">RRtpSendPacket NewSendPacketL(TInt aPayloadSize=0, TInt aHeaderExtensionSize=KRtpNoExtension);</codeblock> <p>Set the default payload type and payload size before you create the new send packet using <codeph>SetPayloadType()</codeph> and <codeph>SetDefaultPayloadSize()</codeph> respectively. </p> <p>Set the header extension size to multiples of 4-byte words this means the fixed header must be followed by exactly one header extension. The default value is <codeph>KRtpNoExtension</codeph>. 0 is an acceptable value. </p> <p> <codeph>RRtpSendSource</codeph> allows you to set any of the following for an RTP packet to be sent: </p> <p> <codeph>SetAlignment</codeph>: Aligns the header data to multiples of the set padding value. The values can range within 1-255. 1 is the default value, which means not padded. </p> <p> <codeph>SetDefaultPayloadSize</codeph>: Sets the default payload size for the RTP packet that is to be sent. This is usually set before creating a new packet. </p> <p> <codeph>SetPayloadType</codeph>: Sets the default payload type for the RTP packet that is to be sent. This is usually set before creating a new packet. </p> <p>Call <codeph>ByeL</codeph> to send the BYE packet to indicate that one or more sources are no longer active (example when a participant wants to leave). </p> <p>You can stop sending a packet even after making a send request. Call <codeph>RRtpSendSource::Cancel()</codeph> to cancel the outstanding send request on the send stream. </p> </section> <section><title>Sending the packet</title> <p>Call <codeph>RRtpSendPacket::Send()</codeph> to send the RTP packet. The packet is considered to be sent only when an <codeph>ERtpSendSucceeded</codeph> event is received from the send stream. If a failure occurs, an <codeph>ERtpSendFailed</codeph> event is received. </p> <p> <b>Note</b>: Before sending an RTP packet you must set the bandwidth for the RTP session. The following code snippet shows how to set the bandwidth for an RTP session. </p> <codeblock id="GUID-6E2043B8-8354-5DAA-B174-9CF54A806EE1" xml:space="preserve">IMPORT_C void SetBandwidth(TUint aBandwidth) </codeblock> </section> <section><title>Closing the packet</title> <p>Once the packet has been sent, call <codeph>RRtpSendPacket::Close()</codeph> to close the RTP packet. </p> </section> <section><title>Closing the send stream</title> <p>Call <codeph>RRtpSendSource::Close()</codeph> to close the send stream. The send stream cannot be closed if an event is currently being handled by a call back function. </p> </section> <section><title>See also</title> <p> <xref href="GUID-5287A403-1094-5682-A443-A6C2A04A1F23.dita">Creating and Managing an RTP session</xref>  </p> </section> </conbody></concept>