Group PJMED_RTCP_XR

group PJMED_RTCP_XR

RTCP XR extension to RTCP session.

PJMEDIA implements subsets of RTCP XR specification (RFC 3611) to monitor the quality of the real-time media (audio/video) transmission.

Defines

PJMEDIA_RTCP_XR_BUF_SIZE

Constant of RTCP-XR content size.

Enums

enum pjmedia_rtcp_xr_type

Enumeration of report types of RTCP XR. Useful for user to enable varying combinations of RTCP XR report blocks.

Values:

enumerator PJMEDIA_RTCP_XR_LOSS_RLE
enumerator PJMEDIA_RTCP_XR_DUP_RLE
enumerator PJMEDIA_RTCP_XR_RCPT_TIMES
enumerator PJMEDIA_RTCP_XR_RR_TIME
enumerator PJMEDIA_RTCP_XR_DLRR
enumerator PJMEDIA_RTCP_XR_STATS
enumerator PJMEDIA_RTCP_XR_VOIP_METRICS
enum pjmedia_rtcp_xr_info

Enumeration of info need to be updated manually to RTCP XR. Most info could be updated automatically each time RTP received.

Values:

enumerator PJMEDIA_RTCP_XR_INFO_SIGNAL_LVL
enumerator PJMEDIA_RTCP_XR_INFO_NOISE_LVL
enumerator PJMEDIA_RTCP_XR_INFO_RERL
enumerator PJMEDIA_RTCP_XR_INFO_R_FACTOR
enumerator PJMEDIA_RTCP_XR_INFO_MOS_LQ
enumerator PJMEDIA_RTCP_XR_INFO_MOS_CQ
enumerator PJMEDIA_RTCP_XR_INFO_CONF_PLC
enumerator PJMEDIA_RTCP_XR_INFO_CONF_JBA
enumerator PJMEDIA_RTCP_XR_INFO_CONF_JBR
enumerator PJMEDIA_RTCP_XR_INFO_JB_NOM
enumerator PJMEDIA_RTCP_XR_INFO_JB_MAX
enumerator PJMEDIA_RTCP_XR_INFO_JB_ABS_MAX
enum pjmedia_rtcp_xr_plc_type

Enumeration of PLC types definitions for RTCP XR report.

Values:

enumerator PJMEDIA_RTCP_XR_PLC_UNK
enumerator PJMEDIA_RTCP_XR_PLC_DIS
enumerator PJMEDIA_RTCP_XR_PLC_ENH
enumerator PJMEDIA_RTCP_XR_PLC_STD
enum pjmedia_rtcp_xr_jb_type

Enumeration of jitter buffer types definitions for RTCP XR report.

Values:

enumerator PJMEDIA_RTCP_XR_JB_UNKNOWN
enumerator PJMEDIA_RTCP_XR_JB_FIXED
enumerator PJMEDIA_RTCP_XR_JB_ADAPTIVE

Functions

void pjmedia_rtcp_build_rtcp_xr(pjmedia_rtcp_xr_session *session, unsigned rpt_types, void **rtcp_pkt, int *len)

Build an RTCP XR packet which contains one or more RTCP XR report blocks. There are seven report types as defined in RFC 3611.

Parameters:
  • session – The RTCP XR session.

  • rpt_types – Report types to be included in the packet, report types are defined in pjmedia_rtcp_xr_type, set this to zero will make this function build all reports appropriately.

  • rtcp_pkt – Upon return, it will contain pointer to the RTCP XR packet.

  • len – Upon return, it will indicate the size of the generated RTCP XR packet.

pj_status_t pjmedia_rtcp_xr_update_info(pjmedia_rtcp_xr_session *session, unsigned info, pj_int32_t val)

Call this function to manually update some info needed by RTCP XR to generate report which could not be populated directly when receiving RTP.

Parameters:
  • session – The RTCP XR session.

  • info – Info type to be updated,

  • val – Value.

void pjmedia_rtcp_xr_init(pjmedia_rtcp_xr_session *session, struct pjmedia_rtcp_session *r_session, pj_uint8_t gmin, unsigned frames_per_packet)

This function is called internally by RTCP session when RTCP XR is enabled to initialize the RTCP XR session.

Parameters:
  • session – RTCP XR session.

  • r_session – RTCP session.

  • gmin – Gmin value (defined in RFC 3611), set to 0 for default (16).

  • frames_per_packet – Number of frames per packet.

void pjmedia_rtcp_xr_fini(pjmedia_rtcp_xr_session *session)

This function is called internally by RTCP session to destroy the RTCP XR session.

Parameters:

session – RTCP XR session.

void pjmedia_rtcp_xr_rx_rtcp_xr(pjmedia_rtcp_xr_session *session, const void *rtcp_pkt, pj_size_t size)

This function is called internally by RTCP session when it receives incoming RTCP XR packets.

Parameters:
  • session – RTCP XR session.

  • rtcp_pkt – The received RTCP XR packet.

  • size – Size of the incoming packet.

void pjmedia_rtcp_xr_rx_rtp(pjmedia_rtcp_xr_session *session, unsigned seq, int lost, int dup, int discarded, int jitter, int toh, pj_bool_t toh_ipv4)

This function is called internally by RTCP session whenever an RTP packet is received or lost to let the RTCP XR session update its statistics. Data passed to this function is a result of analyzation by RTCP and the jitter buffer. Whenever some info is available, the value should be zero or more (no negative info), otherwise if info is not available the info should be -1 so no update will be done for this info in the RTCP XR session.

Parameters:
  • session – RTCP XR session.

  • seq – Sequence number of RTP packet.

  • lost – Info if this packet is lost.

  • dup – Info if this packet is a duplication.

  • discarded – Info if this packet is discarded (not because of duplication).

  • jitter – Info jitter of this packet.

  • toh – Info Time To Live or Hops Limit of this packet.

  • toh_ipv4 – Set PJ_TRUE if packet is transported over IPv4.

void pjmedia_rtcp_xr_tx_rtp(pjmedia_rtcp_xr_session *session, unsigned ptsize)

This function is called internally by RTCP session whenever an RTP packet is sent to let the RTCP XR session do its internal calculations.

Parameters:
  • session – RTCP XR session.

  • ptsize – Size of RTP payload being sent.

struct pjmedia_rtcp_xr_rb_header
#include <rtcp_xr.h>

This type declares RTCP XR Report Header.

Public Members

pj_uint8_t bt

Block type.

pj_uint8_t specific

Block specific data.

pj_uint16_t length

Block length.

struct pjmedia_rtcp_xr_rb_rr_time
#include <rtcp_xr.h>

This type declares RTCP XR Receiver Reference Time Report Block.

Public Members

pjmedia_rtcp_xr_rb_header header

Block header.

pj_uint32_t ntp_sec

NTP time, seconds part.

pj_uint32_t ntp_frac

NTP time, fractions part.

struct pjmedia_rtcp_xr_rb_dlrr_item
#include <rtcp_xr.h>

This type declares RTCP XR DLRR Report Sub-block

Public Members

pj_uint32_t ssrc

receiver SSRC

pj_uint32_t lrr

last receiver report

pj_uint32_t dlrr

delay since last receiver report

struct pjmedia_rtcp_xr_rb_dlrr
#include <rtcp_xr.h>

This type declares RTCP XR DLRR Report Block

Public Members

pjmedia_rtcp_xr_rb_header header

Block header.

pjmedia_rtcp_xr_rb_dlrr_item item

Block contents, variable length list

struct pjmedia_rtcp_xr_rb_stats
#include <rtcp_xr.h>

This type declares RTCP XR Statistics Summary Report Block

Public Members

pjmedia_rtcp_xr_rb_header header

Block header.

pj_uint32_t ssrc

Receiver SSRC

pj_uint16_t begin_seq

Begin RTP sequence reported

pj_uint16_t end_seq

End RTP sequence reported

pj_uint32_t lost

Number of packet lost in this interval

pj_uint32_t dup

Number of duplicated packet in this interval

pj_uint32_t jitter_min

Minimum jitter in this interval

pj_uint32_t jitter_max

Maximum jitter in this interval

pj_uint32_t jitter_mean

Average jitter in this interval

pj_uint32_t jitter_dev

Jitter deviation in this interval

pj_uint32_t toh_min

Minimum ToH in this interval

pj_uint32_t toh_max

Maximum ToH in this interval

pj_uint32_t toh_mean

Average ToH in this interval

pj_uint32_t toh_dev

ToH deviation in this interval

struct pjmedia_rtcp_xr_rb_voip_mtc
#include <rtcp_xr.h>

This type declares RTCP XR VoIP Metrics Report Block

Public Members

pjmedia_rtcp_xr_rb_header header

Block header.

pj_uint32_t ssrc

Receiver SSRC

pj_uint8_t loss_rate

Packet loss rate

pj_uint8_t discard_rate

Packet discarded rate

pj_uint8_t burst_den

Burst density

pj_uint8_t gap_den

Gap density

pj_uint16_t burst_dur

Burst duration

pj_uint16_t gap_dur

Gap duration

pj_uint16_t rnd_trip_delay

Round trip delay

pj_uint16_t end_sys_delay

End system delay

pj_uint8_t signal_lvl

Signal level

pj_uint8_t noise_lvl

Noise level

pj_uint8_t rerl

Residual Echo Return Loss

pj_uint8_t gmin

The gap threshold

pj_uint8_t r_factor

Voice quality metric carried over this RTP session

pj_uint8_t ext_r_factor

Voice quality metric carried outside of this RTP session

pj_uint8_t mos_lq

Mean Opinion Score for Listening Quality

pj_uint8_t mos_cq

Mean Opinion Score for Conversation Quality

pj_uint8_t rx_config

Receiver configuration

pj_uint8_t reserved2

Not used

pj_uint16_t jb_nom

Current delay by jitter buffer

pj_uint16_t jb_max

Maximum delay by jitter buffer

pj_uint16_t jb_abs_max

Maximum possible delay by jitter buffer

struct pjmedia_rtcp_xr_pkt
#include <rtcp_xr.h>

This structure declares RTCP XR (Extended Report) packet.

Public Members

unsigned count

varies by payload type

unsigned p

padding flag

unsigned version

packet type

unsigned pt

payload type

unsigned length

packet length

pj_uint32_t ssrc

SSRC identification

pj_int8_t buf[sizeof(pjmedia_rtcp_xr_rb_rr_time) + sizeof(pjmedia_rtcp_xr_rb_dlrr) + sizeof(pjmedia_rtcp_xr_rb_stats) + sizeof(pjmedia_rtcp_xr_rb_voip_mtc)]

Content buffer

struct pjmedia_rtcp_xr_stream_stat
#include <rtcp_xr.h>

This structure describes RTCP XR statitic.

Public Members

pj_time_val update

Time of last update.

pj_uint32_t begin_seq

Begin # seq of this interval.

pj_uint32_t end_seq

End # seq of this interval.

unsigned count

Number of packets.

unsigned l

Flags represent whether the such report is valid/updated Lost flag

unsigned d

Duplicated flag

unsigned j

Jitter flag

unsigned t

TTL or Hop Limit, 0=none, 1=TTL, 2=HL

unsigned lost

Number of packets lost

unsigned dup

Number of duplicated packets

pj_math_stat jitter

Jitter statistics (in usec)

pj_math_stat toh

TTL of hop limit statistics.

pj_uint8_t loss_rate

Packet loss rate

pj_uint8_t discard_rate

Packet discarded rate

pj_uint8_t burst_den

Burst density

pj_uint8_t gap_den

Gap density

pj_uint16_t burst_dur

Burst duration

pj_uint16_t gap_dur

Gap duration

pj_uint16_t rnd_trip_delay

Round trip delay

pj_uint16_t end_sys_delay

End system delay

pj_int8_t signal_lvl

Signal level

pj_int8_t noise_lvl

Noise level

pj_uint8_t rerl

Residual Echo Return Loss

pj_uint8_t gmin

The gap threshold

pj_uint8_t r_factor

Voice quality metric carried over this RTP session

pj_uint8_t ext_r_factor

Voice quality metric carried outside of this RTP session

pj_uint8_t mos_lq

Mean Opinion Score for Listening Quality

pj_uint8_t mos_cq

Mean Opinion Score for Conversation Quality

pj_uint8_t rx_config

Receiver configuration

pj_uint16_t jb_nom

Current delay by jitter buffer

pj_uint16_t jb_max

Maximum delay by jitter buffer

pj_uint16_t jb_abs_max

Maximum possible delay by jitter buffer

struct pjmedia_rtcp_xr_stat

Public Members

pjmedia_rtcp_xr_stream_stat rx

Decoding direction statistics.

pjmedia_rtcp_xr_stream_stat tx

Encoding direction statistics.

pj_math_stat rtt

Round-trip delay stat (in usec) the value is calculated from receiver side.

struct pjmedia_rtcp_xr_session
#include <rtcp_xr.h>

RTCP session is used to monitor the RTP session of one endpoint. There should only be one RTCP session for a bidirectional RTP streams.

Public Members

char *name

Name identification.

pjmedia_rtcp_xr_pkt pkt

Cached RTCP XR packet.

pj_uint32_t rx_lrr

NTP ts in last RR received.

pj_timestamp rx_lrr_time

Time when last RR is received.

pj_uint32_t rx_last_rr

pkt received since last

sending RR time.

pjmedia_rtcp_xr_stat stat

RTCP XR statistics.

unsigned ptime

Packet time.

unsigned frames_per_packet

frames per packet.

struct pjmedia_rtcp_session *rtcp_session

Parent/RTCP session.