Home Units Hierarchy Routines All identifiers

Unit unaSocks_RTP

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

RTP/RTCP implementation.

version 1.0 first release

version 1.1 RTCP implemented

version 2012.01 some RTCP fixes

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
packed record int24 int24 type
packed record rtcp_APP_packet  
packed record rtcp_BYE_packet  
packed record rtcp_common_hdr  
packed record rtcp_rr_block  
packed record rtcp_RR_packet  
packed record rtcp_sdes_item  
packed record rtcp_SDES_packet  
packed record rtcp_SR_packet  
packed record rtp_hdr  
packed record rtp_hdr_ex  
packed record rtp_site_info  
packed record unaRTCPRTTReq  
Class unaRTCPSourceList List of Sources.
Class unaRTCPstack Basic RTCP stack (UDP only)
Class unaRTPDestination RTP Destiation.
packed record unaRTPMap  
Class unaRTPReceiver Basic RTP receiver (UDP only)
Class unaRTPStreamer Basic RTP receiver (UDP only)
Class unaRTPTransmitter Basic RTP transmitter (UDP only)

Functions and Procedures

function align32(sz: unsigned): unsigned;
function rtpLength(sz: uint16): uint16;
function rtpLength2bytes(rtpLen: uint16): uint16;
function parseRTPMap(const rtp_map, rtp_fmt: string; var map: unaRTPMap): bool;
function mapMediaType2rtpEncoding(const mtype: string): int32;
function mapRtpEncoding2mediaType(const enc: int): string;

Types

u_int8 = uint8;
u_int16 = uint16;
u_int32 = uint32;
prtp_csrc_list = ˆrtp_csrc_list;
rtp_csrc_list = array[0..15] of u_int32;
prtp_hdr = ˆrtp_hdr;
prtp_hdr_ex = ˆrtp_hdr_ex;
prtcp_common_hdr = ˆrtcp_common_hdr;
prtcp_rr_block = ˆrtcp_rr_block;
prtcp_sdes_item = ˆrtcp_sdes_item;
rtcp_rr_list = array[0..31] of rtcp_rr_block;
prtcp_SR_packet = ˆrtcp_SR_packet;
prtcp_RR_packet = ˆrtcp_RR_packet;
prtcp_SDES_packet = ˆrtcp_SDES_packet;
prtcp_BYE_packet = ˆrtcp_BYE_packet;
prtcp_APP_packet = ˆrtcp_APP_packet;
prtp_site_info = ˆrtp_site_info;
punaRTCPRTTReq = ˆunaRTCPRTTReq;
unaRTPOnAddDestination = procedure(sender: tObject; fromHole: boolean; destRTP, destRTCP: PSockAddrIn; var accept: boolean) of object;
punaRTPMap = ˆunaRTPMap;

Constants

c_def_CNresendInterval = 12000;
C_probation_UNINIT = MIN_SEQUENTIAL shl 5;
c_rtcp_appCmd_hello = 'HELO';
c_rtcp_appCmd_needRTPPing = 'NPNG';
c_rtcp_appCmd_RTT = '_RTT';
c_rtcp_appCmd_RTT_stRequest = 1;
c_rtcp_appCmd_RTT_stResponse = 2;
c_rtpPTav_MP2T = 33;
c_rtpPTa_CN = 13;
c_rtpPTa_DVI4_11025 = 16;
c_rtpPTa_DVI4_16000 = 6;
c_rtpPTa_DVI4_22050 = 17;
c_rtpPTa_DVI4_8000 = 5;
c_rtpPTa_G722_ = 9;
c_rtpPTa_G723 = 4;
c_rtpPTa_G728 = 15;
c_rtpPTa_G729 = 18;
c_rtpPTa_GSM = 3;
c_rtpPTa_L16_mono = 11;
c_rtpPTa_L16_stereo = 10;
c_rtpPTa_LPC = 7;
c_rtpPTa_MPA = 14;
c_rtpPTa_PCMA = 8;
c_rtpPTa_PCMU = 0;
c_rtpPTa_QCELP = 12;
c_rtpPTv_CelB = 25;
c_rtpPTv_H261 = 31;
c_rtpPTv_H263 = 34;
c_rtpPTv_JPEG = 26;
c_rtpPTv_MPV = 32;
c_rtpPTv_nv = 28;
c_rtpPT_dynamic = 96;
c_rtp_enc_CELT = 104;
c_rtp_enc_DVI4 = 1;
c_rtp_enc_G722 = 2;
c_rtp_enc_G7221 = 106;
c_rtp_enc_G723 = 3;
c_rtp_enc_G726_16 = 7;
c_rtp_enc_G726_24 = 6;
c_rtp_enc_G726_32 = 5;
c_rtp_enc_G726_40 = 4;
c_rtp_enc_G728 = 8;
c_rtp_enc_G729 = 9;
c_rtp_enc_G729D = 10;
c_rtp_enc_G729E = 11;
c_rtp_enc_GSM = 12;
c_rtp_enc_GSM49 = 105;
c_rtp_enc_GSM_EFR = 13;
c_rtp_enc_L16 = 15;
c_rtp_enc_L8 = 14;
c_rtp_enc_LPC = 16;
c_rtp_enc_MPA = 17;
c_rtp_enc_PCMA = 18;
c_rtp_enc_PCMU = 19;
c_rtp_enc_QCELP = 20;
c_rtp_enc_Speex = 101;
c_rtp_enc_T140 = 103;
c_rtp_enc_VDVI = 21;
c_rtp_enc_Vorbis = 102;
c_RTP_PORT_Default = 5004;
MAX_DROPOUT = 3000;
MAX_MISORDER = 100;
MIN_SEQUENTIAL = 2;
RTCP_APP = 204;
RTCP_BYE = 203;
RTCP_RR = 201;
RTCP_SDES = 202;
RTCP_SDES_CNAME = 1;
RTCP_SDES_EMAIL = 3;
RTCP_SDES_END = 0;
RTCP_SDES_LOC = 5;
RTCP_SDES_NAME = 2;
RTCP_SDES_NOTE = 7;
RTCP_SDES_PHONE = 4;
RTCP_SDES_PRIV = 8;
RTCP_SDES_TOOL = 6;
RTCP_SR = 200;
RTCP_VALID_MASK = $C000 or $2000 or $0FE;
RTCP_VALID_VALUE = RTP_VERSION shl 14 or RTCP_SR;
RTP_MAX_SDES = 255;
RTP_SEQ_MOD = 1 shl 16;
RTP_VERSION = 2;
v_maxSrv_clients: int = 1;

Description

Functions and Procedures

function align32(sz: unsigned): unsigned;

Aligns length to 32-bit words: 0 -> 0 1 -> 4 2 -> 4 3 -> 4 4 -> 4 5 -> 8 6 -> 8

Returns

aligned value

function rtpLength(sz: uint16): uint16;

Computes length of packet in 32-bit words minus one. Returns bytes in network order.

Parameters
sz
size of whole packet, including headers and padding
Returns

value for length header field

function rtpLength2bytes(rtpLen: uint16): uint16;

Computes length of packet in bytes given Length value from header.

Parameters
rtpLen
length field from RTP header (network order)
Returns

size in bytes

function parseRTPMap(const rtp_map, rtp_fmt: string; var map: unaRTPMap): bool;

Parses rtpmap attribute from an SDP response.

function mapMediaType2rtpEncoding(const mtype: string): int32;

Maps known media types to known RTP encodings.

Returns

One of c_rtp_enc_XXX constants or -1 if media type is unknown.

function mapRtpEncoding2mediaType(const enc: int): string;

Maps known RTP encodings into media types.

Returns

String representation of encoding.

Types

u_int8 = uint8;

* The type definitions below are valid for 32-bit architectures and * may have to be adjusted for 16- or 64-bit architectures.

u_int16 = uint16;
 
u_int32 = uint32;
 
prtp_csrc_list = ˆrtp_csrc_list;

– CSRC list: 0 to 15 items, 32 bits each –

rtp_csrc_list = array[0..15] of u_int32;
 
prtp_hdr = ˆrtp_hdr;

– RTP data header –

prtp_hdr_ex = ˆrtp_hdr_ex;

optional CSRC list (see rtp_csrc_list)

– RTP header extension –

prtcp_common_hdr = ˆrtcp_common_hdr;

– RTCP common header word –

prtcp_rr_block = ˆrtcp_rr_block;

– Reception report block –

prtcp_sdes_item = ˆrtcp_sdes_item;

delay since last SR packet – SDES item –

rtcp_rr_list = array[0..31] of rtcp_rr_block;

text, not null-terminated list of sender reports

prtcp_SR_packet = ˆrtcp_SR_packet;

RTCP SR packet header

prtcp_RR_packet = ˆrtcp_RR_packet;

RTCP RR packet header

prtcp_SDES_packet = ˆrtcp_SDES_packet;

RTCP SDES packet header

prtcp_BYE_packet = ˆrtcp_BYE_packet;

RTCP BYE packet header

prtcp_APP_packet = ˆrtcp_APP_packet;

RTCP APP packet header

prtp_site_info = ˆrtp_site_info;

optional data – Per-source state information –

punaRTCPRTTReq = ˆunaRTCPRTTReq;

RTT REQ/RESP data LE order

unaRTPOnAddDestination = procedure(sender: tObject; fromHole: boolean; destRTP, destRTCP: PSockAddrIn; var accept: boolean) of object;

Fired when new destination is added, either manually or from hole

Parameters
sender
transmitter
fromHole
was dest added manually or from "hole" packet
dest
destination
accept
Accept or decline new destination
punaRTPMap = ˆunaRTPMap;

RTP dynamict payload mapping

Constants

c_def_CNresendInterval = 12000;

rtt response

C_probation_UNINIT = MIN_SEQUENTIAL shl 5;
 
c_rtcp_appCmd_hello = 'HELO';

query/reply _RTT

c_rtcp_appCmd_needRTPPing = 'NPNG';

hi from remote side

c_rtcp_appCmd_RTT = '_RTT';

========= LoS specific (non-standard!) ========================

c_rtcp_appCmd_RTT_stRequest = 1;

need RTP pingback

c_rtcp_appCmd_RTT_stResponse = 2;

rtt request

c_rtpPTav_MP2T = 33;

33 MP2T AV 90,000

c_rtpPTa_CN = 13;

13 CN 8,000 1

c_rtpPTa_DVI4_11025 = 16;

16 DVI4 11,025 1

c_rtpPTa_DVI4_16000 = 6;

6 DVI4 16,000 1

c_rtpPTa_DVI4_22050 = 17;

17 DVI4 22,050 1

c_rtpPTa_DVI4_8000 = 5;

5 DVI4 8,000 1

c_rtpPTa_G722_ = 9;

ALaw 9 G722 8,000 1

c_rtpPTa_G723 = 4;

4 G723 8,000 1

c_rtpPTa_G728 = 15;

mpeg audio 15 G728 8,000 1

c_rtpPTa_G729 = 18;

18 G729 8,000 1

c_rtpPTa_GSM = 3;

uLaw 1 reserved 2 reserved 3 GSM 8,000 1

c_rtpPTa_L16_mono = 11;

11 L16 44,100 1

c_rtpPTa_L16_stereo = 10;

10 L16 44,100 2

c_rtpPTa_LPC = 7;

7 LPC 8,000 1

c_rtpPTa_MPA = 14;

14 MPA 90,000 (see text)

c_rtpPTa_PCMA = 8;

8 PCMA 8,000 1

c_rtpPTa_PCMU = 0;

G.722.1 payloads PT encoding clock rate channels name (Hz) ___________________________________________________ 0 PCMU 8,000 1

c_rtpPTa_QCELP = 12;

12 QCELP 8,000 1

c_rtpPTv_CelB = 25;

19 reserved A 20 unassigned A 21 unassigned A 22 unassigned A 23 unassigned A dyn G726-40 A 8,000 1 dyn G726-32 A 8,000 1 dyn G726-24 A 8,000 1 dyn G726-16 A 8,000 1 dyn G729D A 8,000 1 dyn G729E A 8,000 1 dyn GSM-EFR A 8,000 1 dyn L8 A var. var. dyn RED A (see text) dyn VDVI A var. 1

Table 4: Payload types (PT) for audio encodings PT encoding media type clock rate name (Hz) _____________________________________________ 24 unassigned V 25 CelB V 90,000

c_rtpPTv_H261 = 31;

29 unassigned V 30 unassigned V 31 H261 V 90,000

c_rtpPTv_H263 = 34;

34 H263 V 90,000

c_rtpPTv_JPEG = 26;

26 JPEG V 90,000

c_rtpPTv_MPV = 32;

32 MPV V 90,000

c_rtpPTv_nv = 28;

27 unassigned V 28 nv V 90,000

c_rtpPT_dynamic = 96;

35-71 unassigned ? 72-76 reserved N/A N/A 77-95 unassigned ? 96-127 dynamic ? dyn H263-1998 V 90,000

Table 5: Payload types (PT) for video encodings

c_rtp_enc_CELT = 104;

T140 text terminal

c_rtp_enc_DVI4 = 1;

% of lost packets since last update – end of rtp.h – recognized audio encodings NOTE: these are NOT payloads!

c_rtp_enc_G722 = 2;
 
c_rtp_enc_G7221 = 106;

MS GSM

c_rtp_enc_G723 = 3;
 
c_rtp_enc_G726_16 = 7;
 
c_rtp_enc_G726_24 = 6;
 
c_rtp_enc_G726_32 = 5;
 
c_rtp_enc_G726_40 = 4;
 
c_rtp_enc_G728 = 8;
 
c_rtp_enc_G729 = 9;
 
c_rtp_enc_G729D = 10;
 
c_rtp_enc_G729E = 11;
 
c_rtp_enc_GSM = 12;
 
c_rtp_enc_GSM49 = 105;

CELT

c_rtp_enc_GSM_EFR = 13;
 
c_rtp_enc_L16 = 15;
 
c_rtp_enc_L8 = 14;
 
c_rtp_enc_LPC = 16;
 
c_rtp_enc_MPA = 17;
 
c_rtp_enc_PCMA = 18;
 
c_rtp_enc_PCMU = 19;
 
c_rtp_enc_QCELP = 20;
 
c_rtp_enc_Speex = 101;

other encodings (not payloads!)

c_rtp_enc_T140 = 103;

OGG/Vorbis

c_rtp_enc_VDVI = 21;
 
c_rtp_enc_Vorbis = 102;

Speex

c_RTP_PORT_Default = 5004;

first dynamic payload default RTP port

MAX_DROPOUT = 3000;

The dropout parameter MAX_DROPOUT should be a small fraction of the 16-bit sequence number space to give a reasonable probability that new sequence numbers after a restart will not fall in the acceptable range for sequence numbers from before the restart.

MAX_MISORDER = 100;

After a source is considered valid, the sequence number is considered valid if it is no more than MAX_DROPOUT ahead of s->max_seq nor more than MAX_MISORDER behind.

MIN_SEQUENTIAL = 2;

source is declared valid only after MIN_SEQUENTIAL packets have been received in sequence

RTCP_APP = 204;
 
RTCP_BYE = 203;
 
RTCP_RR = 201;
 
RTCP_SDES = 202;
 
RTCP_SDES_CNAME = 1;
 
RTCP_SDES_EMAIL = 3;
 
RTCP_SDES_END = 0;

SDES type

RTCP_SDES_LOC = 5;
 
RTCP_SDES_NAME = 2;
 
RTCP_SDES_NOTE = 7;
 
RTCP_SDES_PHONE = 4;
 
RTCP_SDES_PRIV = 8;
 
RTCP_SDES_TOOL = 6;
 
RTCP_SR = 200;

maximum text length for SDES */ RTCP packet type

RTCP_VALID_MASK = $C000 or $2000 or $0FE;

pkt len in dwords, w/o this dword Big-endian mask for version, padding bit and packet type pair

RTCP_VALID_VALUE = RTP_VERSION shl 14 or RTCP_SR;
 
RTP_MAX_SDES = 255;
 
RTP_SEQ_MOD = 1 shl 16;
 
RTP_VERSION = 2;

in network order

Current protocol version.

v_maxSrv_clients: int = 1;

max number of clients in TCP Server mode

Author

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09