Home Units Hierarchy Routines All identifiers

Class unaRTCPstack

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaRTCPstack = class(unaThread)

Description

Basic RTCP stack (UDP only)

Hierarchy

Overview

Methods

Public constructor create(streamer: unaRTPStreamer; useNTP: bool = false);
Public function copyMember(ssrc: u_int32; var info: rtp_site_info): bool;
Public function getMemberCNAME(ssrc: u_int32; out cname: wString): bool;
Public function getMemberTimeout(ssrc: u_int32): int;
Public function memberByAddrAcq(isRTP: bool; addr: pSockAddrIn; ro: bool; timeout: tTimeout = 100): prtp_site_info;
Public function memberBySSRCAcq(ssrc: u_int32; ro: bool; timeout: tTimeout = 100): prtp_site_info;
Public function memberSSRCbyIndex(index: int; out ssrc: u_int32): bool;
Public function sendAPPto(addr: PSockAddrIn; subtype: byte; const cmd: aString; data: pointer = nil; len: uint = 0; sendCNAMEasWell: bool = false): int;
Public function timeNTPnow(var st: SYSTEMTIME): bool;
Protected function execute(threadID: unsigned): int; override;
Protected function getMemberCount(): int;
Protected function getNextSeq(): unsigned;
Protected function memberByIndexAcq(index: int; ro: bool; timeout: tTimeout = 100): prtp_site_info;
Protected function newMemberAcq(ssrc: u_int32): prtp_site_info;
Protected function sendDataRTCP(addr: pSockAddrIn; data: pointer; len: uint): int;
Protected function update_seq(ssrc: u_int32; seq: u_int16): bool;
Public procedure BeforeDestruction(); override;
Public procedure memberReleaseRO(member: prtp_site_info);
Public procedure memberReleaseWO(member: prtp_site_info);
Protected procedure gotIdle(); virtual;
Protected procedure gotPacket(addr: pSockAddrIn; hdr: prtcp_common_hdr; packetSize: uint; firstOne: bool); virtual;
Protected procedure gotRTPpacket(addr: pSockAddr; hdr: prtp_hdr; packetSize: uint); virtual;
Protected procedure init_seq(si: prtp_site_info; seq: u_int16);
Protected procedure startIn(); override;
Protected procedure startOut(); override;
Protected procedure udapteOnAPP(addr: pSockAddrIn; hdr: prtcp_APP_packet; subtype: int; const cmd: aString; data: pointer; size: int); virtual;
Protected procedure updateOnRR(addr: pSockAddrIn; hdr: prtcp_RR_packet);
Protected procedure updateOnSDES(ssrc: u_int32; item: prtcp_sdes_item); overload;
Protected procedure updateOnSR(addr: pSockAddrIn; hdr: prtcp_SR_packet);
Protected procedure weSentRTP(addr: PSockAddrIn; hdr: prtp_hdr; payloadLen: uint);

Properties

Public property addrChangeAutoResolve: bool read f_acar;
Public property bind2port: string read f_b2portRTCP write f_b2portRTCP;
Public property conferenceMode: bool read f_confMode write f_confMode;
Public property memberCount: int read getMemberCount;
Public property memberTimeoutReports: int read f_memberTR write f_memberTR;
Public property rttEnabled: bool read f_rttEnabled write f_rttEnabled;
Public property seqNum: int read f_seq;
Public property socketError: int read f_socketError;
Protected property socketObjRTCP: unaSocket read getSocket;
Public property streamer: unaRTPStreamer read f_streamer;

Description

Methods

Public constructor create(streamer: unaRTPStreamer; useNTP: bool = false);

Creates RTCP stack

Public function copyMember(ssrc: u_int32; var info: rtp_site_info): bool;

Copies member info.

Parameters
ssrc
SSRC of memeber
info
Buffer to copy to
Returns

True if successfull

Public function getMemberCNAME(ssrc: u_int32; out cname: wString): bool;

Returns member CNAME.

Parameters
ssrc
SSRC of member
Returns

CNAME or ''

Public function getMemberTimeout(ssrc: u_int32): int;

Returns member timeout. If memberTimeoutReports is not 0 and no RR will be received from this member after memberTimeoutReports reports, BYE will be sent to remote side and it will be removed from the members table.

Parameters
ssrc
SSRC of member
Returns

Timeout in ms.

Public function memberByAddrAcq(isRTP: bool; addr: pSockAddrIn; ro: bool; timeout: tTimeout = 100): prtp_site_info;

Returns member info. Always call memberRelease() when done working with member.

Parameters
addr
RTP/RTCP address of member
Returns

Session member or nil.

Public function memberBySSRCAcq(ssrc: u_int32; ro: bool; timeout: tTimeout = 100): prtp_site_info;

Returns member info. Always call memberRelease() when done working with member.

Parameters
ssrc
SSRC of member
Returns

Session member or nil.

Public function memberSSRCbyIndex(index: int; out ssrc: u_int32): bool;

Returns member SSRC by index.

Parameters
index
member index
ssrc
SSRC of member
Returns

True if successfull

Public function sendAPPto(addr: PSockAddrIn; subtype: byte; const cmd: aString; data: pointer = nil; len: uint = 0; sendCNAMEasWell: bool = false): int;

Sends custom APP packet to remote side.

Parameters
addr
send to this addr
subtype
subtype (0..31)
cmd
command (4 ansi chars)
data
data data pointer
len
size of data
sendCNAMEasWell
include SDES packet as well
Returns

0 if data was sent successfully, or specific WSA error otherwise.

Public function timeNTPnow(var st: SYSTEMTIME): bool;

Returns current NTP time if available.

Parameters
st
Time structure to be filled with current date/time
Returns

True if successfull

Protected function execute(threadID: unsigned): int; override;

Runs RTCP receiving socket cycle. Calls gotPacket() each time new chunk of bytes is received.

Protected function getMemberCount(): int;

Returns number of memebers. When active there is always one member - we.

Protected function getNextSeq(): unsigned;

Returns next RTP seq#

Protected function memberByIndexAcq(index: int; ro: bool; timeout: tTimeout = 100): prtp_site_info;

Returns member info. Always call memberRelease() when done working with member.

Parameters
index
Member index from 0 to memberCount - 2
ro
Read-only (True) or write-only (False) acquire
Returns

Session member or nil.

Protected function newMemberAcq(ssrc: u_int32): prtp_site_info;

Creates new session member record. Locks new member with WO access, so it must be released by memberReleaseWO()

Parameters
ssrc
SSRC to assign to new member
Returns

member info

Protected function sendDataRTCP(addr: pSockAddrIn; data: pointer; len: uint): int;

Sends data using RTCP socket

Returns

0 if data was sent successfully, or specific WSA error otherwise.

Protected function update_seq(ssrc: u_int32; seq: u_int16): bool;
 
Public procedure BeforeDestruction(); override;

Cleans the instance.

Public procedure memberReleaseRO(member: prtp_site_info);

Releases member info after RO acquision.. Must always be called after memberGet().

Parameters
member
Member to release.
Public procedure memberReleaseWO(member: prtp_site_info);

Releases member info after WO acquision. Must always be called after successfull memberByXXX().

Parameters
member
Member to release.
Protected procedure gotIdle(); virtual;

Time to send RTCP packets (if needed).

Protected procedure gotPacket(addr: pSockAddrIn; hdr: prtcp_common_hdr; packetSize: uint; firstOne: bool); virtual;

Received new RTCP packet.

Protected procedure gotRTPpacket(addr: pSockAddr; hdr: prtp_hdr; packetSize: uint); virtual;

Received new RTP packet.

Protected procedure init_seq(si: prtp_site_info; seq: u_int16);
 
Protected procedure startIn(); override;
 
Protected procedure startOut(); override;
 
Protected procedure udapteOnAPP(addr: pSockAddrIn; hdr: prtcp_APP_packet; subtype: int; const cmd: aString; data: pointer; size: int); virtual;

Received APP packet.

Protected procedure updateOnRR(addr: pSockAddrIn; hdr: prtcp_RR_packet);

Received new RTCP RR packet.

Protected procedure updateOnSDES(ssrc: u_int32; item: prtcp_sdes_item); overload;

Received new RTCP SDES packet.

Protected procedure updateOnSR(addr: pSockAddrIn; hdr: prtcp_SR_packet);

Received new RTCP SR packet.

Protected procedure weSentRTP(addr: PSockAddrIn; hdr: prtp_hdr; payloadLen: uint);

Should be called to maintain RTCP sanity just after new RTP packet was sent.

Properties

Public property addrChangeAutoResolve: bool read f_acar;

Resolve remote address change automatically. Default is true.

Public property bind2port: string read f_b2portRTCP write f_b2portRTCP;

Port number to receive RTCP payload on.

Public property conferenceMode: bool read f_confMode write f_confMode;

When in conference mode, client should send RTCP packets to conference server only.

Public property memberCount: int read getMemberCount;

Number of session members.

Public property memberTimeoutReports: int read f_memberTR write f_memberTR;

Number of reports for session member to timeout. Default value is 6, means a member will be removed from table if 6 successive reports are missing from it. Set to 0 to disable timeout check.

Public property rttEnabled: bool read f_rttEnabled write f_rttEnabled;

When true (default) will query for and reply on RTT requests.

Public property seqNum: int read f_seq;

Last seq#, mostly for stat display.

Public property socketError: int read f_socketError;
 
Protected property socketObjRTCP: unaSocket read getSocket;

Internal socket object

Public property streamer: unaRTPStreamer read f_streamer;

RTP transport.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09