WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJMEDIA Reference

RTCP Session and Encapsulation (RFC 3550)

RTCP format and session management. More...

Data Structures

struct  pjmedia_rtcp_sr
 
struct  pjmedia_rtcp_rr
 
struct  pjmedia_rtcp_common
 
struct  pjmedia_rtcp_fb_common
 
struct  pjmedia_rtcp_sr_pkt
 
struct  pjmedia_rtcp_rr_pkt
 
struct  pjmedia_rtcp_sdes
 
struct  pjmedia_rtcp_ntp_rec
 
struct  pjmedia_rtcp_stream_stat
 
struct  pjmedia_rtcp_stat
 
struct  pjmedia_rtcp_session
 
struct  pjmedia_rtcp_session_setting
 

Functions

void pjmedia_rtcp_session_setting_default (pjmedia_rtcp_session_setting *settings)
 
void pjmedia_rtcp_init_stat (pjmedia_rtcp_stat *stat)
 
void pjmedia_rtcp_init (pjmedia_rtcp_session *session, char *name, unsigned clock_rate, unsigned samples_per_frame, pj_uint32_t ssrc)
 
void pjmedia_rtcp_init2 (pjmedia_rtcp_session *session, const pjmedia_rtcp_session_setting *settings)
 
pj_status_t pjmedia_rtcp_get_ntp_time (const pjmedia_rtcp_session *sess, pjmedia_rtcp_ntp_rec *ntp)
 
void pjmedia_rtcp_fini (pjmedia_rtcp_session *session)
 
void pjmedia_rtcp_rx_rtp (pjmedia_rtcp_session *session, unsigned seq, unsigned ts, unsigned payload)
 
void pjmedia_rtcp_rx_rtp2 (pjmedia_rtcp_session *session, unsigned seq, unsigned ts, unsigned payload, pj_bool_t discarded)
 
void pjmedia_rtcp_tx_rtp (pjmedia_rtcp_session *session, unsigned ptsize)
 
void pjmedia_rtcp_rx_rtcp (pjmedia_rtcp_session *session, const void *rtcp_pkt, pj_size_t size)
 
void pjmedia_rtcp_build_rtcp (pjmedia_rtcp_session *session, void **rtcp_pkt, int *len)
 
pj_status_t pjmedia_rtcp_build_rtcp_sdes (pjmedia_rtcp_session *session, void *buf, pj_size_t *length, const pjmedia_rtcp_sdes *sdes)
 
pj_status_t pjmedia_rtcp_build_rtcp_bye (pjmedia_rtcp_session *session, void *buf, pj_size_t *length, const pj_str_t *reason)
 
pj_status_t pjmedia_rtcp_enable_xr (pjmedia_rtcp_session *session, pj_bool_t enable)
 

Detailed Description

PJMEDIA implements subsets of RTCP specification (RFC 3550) to monitor the quality of the real-time media (audio/video) transmission. In addition to the standard quality monitoring and reporting with RTCP SR and RR types, PJMEDIA's RTCP implementation is able to report extended statistics for incoming streams, such as packet duplications, reorder, discarded, and loss period (to distinguish between random and burst loss).

The bidirectional media quality statistic is represented with pjmedia_rtcp_stat structure.

When application uses the stream interface (see Streams), application may retrieve the RTCP statistic by calling pjmedia_stream_get_stat() function.

Function Documentation

◆ pjmedia_rtcp_session_setting_default()

void pjmedia_rtcp_session_setting_default ( pjmedia_rtcp_session_setting settings)

Initialize RTCP session setting.

Parameters
settingsThe RTCP session setting to be initialized.

◆ pjmedia_rtcp_init_stat()

void pjmedia_rtcp_init_stat ( pjmedia_rtcp_stat stat)

Initialize bidirectional RTCP statistics.

Parameters
statThe bidirectional RTCP statistics.

◆ pjmedia_rtcp_init()

void pjmedia_rtcp_init ( pjmedia_rtcp_session session,
char *  name,
unsigned  clock_rate,
unsigned  samples_per_frame,
pj_uint32_t  ssrc 
)

Initialize RTCP session.

Parameters
sessionThe session
nameOptional name to identify the session (for logging purpose).
clock_rateCodec clock rate in samples per second.
samples_per_frameAverage number of samples per frame.
ssrcThe SSRC used in to identify the session.

◆ pjmedia_rtcp_init2()

void pjmedia_rtcp_init2 ( pjmedia_rtcp_session session,
const pjmedia_rtcp_session_setting settings 
)

Initialize RTCP session.

Parameters
sessionThe session
settingsThe RTCP session settings.

◆ pjmedia_rtcp_get_ntp_time()

pj_status_t pjmedia_rtcp_get_ntp_time ( const pjmedia_rtcp_session sess,
pjmedia_rtcp_ntp_rec ntp 
)

Utility function to retrieve current NTP timestamp.

Parameters
sessRTCP session.
ntpNTP record.
Returns
PJ_SUCCESS on success.

◆ pjmedia_rtcp_fini()

void pjmedia_rtcp_fini ( pjmedia_rtcp_session session)

Deinitialize RTCP session.

Parameters
sessionThe session.

◆ pjmedia_rtcp_rx_rtp()

void pjmedia_rtcp_rx_rtp ( pjmedia_rtcp_session session,
unsigned  seq,
unsigned  ts,
unsigned  payload 
)

Call this function everytime an RTP packet is received to let the RTCP session do its internal calculations.

Parameters
sessionThe session.
seqThe RTP packet sequence number, in host byte order.
tsThe RTP packet timestamp, in host byte order.
payloadSize of the payload.

◆ pjmedia_rtcp_rx_rtp2()

void pjmedia_rtcp_rx_rtp2 ( pjmedia_rtcp_session session,
unsigned  seq,
unsigned  ts,
unsigned  payload,
pj_bool_t  discarded 
)

Call this function everytime an RTP packet is received to let the RTCP session do its internal calculations.

Parameters
sessionThe session.
seqThe RTP packet sequence number, in host byte order.
tsThe RTP packet timestamp, in host byte order.
payloadSize of the payload.
discardedFlag to specify whether the packet is discarded.

◆ pjmedia_rtcp_tx_rtp()

void pjmedia_rtcp_tx_rtp ( pjmedia_rtcp_session session,
unsigned  ptsize 
)

Call this function everytime an RTP packet is sent to let the RTCP session do its internal calculations.

Parameters
sessionThe session.
ptsizeThe payload size of the RTP packet (ie packet minus RTP header) in bytes.

◆ pjmedia_rtcp_rx_rtcp()

void pjmedia_rtcp_rx_rtcp ( pjmedia_rtcp_session session,
const void *  rtcp_pkt,
pj_size_t  size 
)

Call this function when an RTCP packet is received from remote peer. This RTCP packet received from remote is used to calculate the end-to- end delay of the network.

Parameters
sessionRTCP session.
rtcp_pktThe received RTCP packet.
sizeSize of the incoming packet.

◆ pjmedia_rtcp_build_rtcp()

void pjmedia_rtcp_build_rtcp ( pjmedia_rtcp_session session,
void **  rtcp_pkt,
int *  len 
)

Build a RTCP packet to be transmitted to remote RTP peer. This will create RTCP Sender Report (SR) or Receiver Report (RR) depending on whether the endpoint has been transmitting RTP since the last interval. Note that this function will reset the interval counters (such as the ones to calculate fraction lost) in the session.

Parameters
sessionThe RTCP session.
rtcp_pktUpon return, it will contain pointer to the RTCP packet, which can be RTCP SR or RR.
lenUpon return, it will indicate the size of the RTCP packet.

◆ pjmedia_rtcp_build_rtcp_sdes()

pj_status_t pjmedia_rtcp_build_rtcp_sdes ( pjmedia_rtcp_session session,
void *  buf,
pj_size_t length,
const pjmedia_rtcp_sdes sdes 
)

Build an RTCP SDES (source description) packet. This packet can be appended to other RTCP packets, e.g: RTCP RR/SR, to compose a compound RTCP packet.

Parameters
sessionThe RTCP session.
bufThe buffer to receive RTCP SDES packet.
lengthOn input, it will contain the buffer length. On output, it will contain the generated RTCP SDES packet length.
sdesThe source description, see pjmedia_rtcp_sdes.
Returns
PJ_SUCCESS on success.

◆ pjmedia_rtcp_build_rtcp_bye()

pj_status_t pjmedia_rtcp_build_rtcp_bye ( pjmedia_rtcp_session session,
void *  buf,
pj_size_t length,
const pj_str_t reason 
)

Build an RTCP BYE packet. This packet can be appended to other RTCP packets, e.g: RTCP RR/SR, to compose a compound RTCP packet.

Parameters
sessionThe RTCP session.
bufThe buffer to receive RTCP BYE packet.
lengthOn input, it will contain the buffer length. On output, it will contain the generated RTCP BYE packet length.
reasonOptional, the BYE reason.
Returns
PJ_SUCCESS on success.

◆ pjmedia_rtcp_enable_xr()

pj_status_t pjmedia_rtcp_enable_xr ( pjmedia_rtcp_session session,
pj_bool_t  enable 
)

Call this function if RTCP XR needs to be enabled/disabled in the RTCP session.

Parameters
sessionThe RTCP session.
enableEnable/disable RTCP XR.
Returns
PJ_SUCCESS on success.

References PJ_END_DECL.

 


PJMEDIA small footprint Open Source media stack
Copyright (C) 2006-2008 Teluu Inc.