This page describes how to prepare, create and send an RTP packet.
RRtpSendPacket
allows you to set the following fields for an RTP packet.
SetMarker()
: Sets or unsets the marker bit.
SetPayloadType()
: Sets the default payload type this is usually set befor e creating a new packet.
SetTimeStamp()
: Sets the sampling instant of first octet in the RTP data packet (also RTCP packet).
SetFlags()
: Sets the first 32 bits of the packet header.
You can retrieve the following from an RTP packet:
WritePayload()
: Gets the descriptor to which the data can be written.
RRtpSendSource
allows you to create a new RTP packet. NewSendPacketL
and NewSendPacketLC
create a new send RTP packet. These functions return a handle to an RRtpSendPacket
object.
RRtpSendPacket NewSendPacketL(TInt aPayloadSize=0, TInt aHeaderExtensionSize=KRtpNoExtension);
Set the default payload type and payload size before you create the new send packet using SetPayloadType()
and SetDefaultPayloadSize()
respectively.
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 KRtpNoExtension
. 0 is an acceptable value.
RRtpSendSource
allows you to set any of the following for an RTP packet to be sent:
SetAlignment
: 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.
SetDefaultPayloadSize
: Sets the default payload size for the RTP packet that is to be sent. This is usually set before creating a new packet.
SetPayloadType
: Sets the default payload type for the RTP packet that is to be sent. This is usually set before creating a new packet.
Call ByeL
to send the BYE packet to indicate that one or more sources are no longer active (example when a participant wants to leave).
You can stop sending a packet even after making a send request. Call RRtpSendSource::Cancel()
to cancel the outstanding send request on the send stream.
Call RRtpSendPacket::Send()
to send the RTP packet. The packet is considered to be sent only when an ERtpSendSucceeded
event is received from the send stream. If a failure occurs, an ERtpSendFailed
event is received.
Note: 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.
IMPORT_C void SetBandwidth(TUint aBandwidth)
Once the packet has been sent, call RRtpSendPacket::Close()
to close the RTP packet.
Call RRtpSendSource::Close()
to close the send stream. The send stream cannot be closed if an event is currently being handled by a call back function.