Fork me on GitHub
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Enumerations | Functions
rtcp.h File Reference

RTCP processing (headers) More...

#include <arpa/inet.h>
#include <endian.h>
#include <inttypes.h>
#include <string.h>
Include dependency graph for rtcp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rtcp_header
 RTCP Header (http://tools.ietf.org/html/rfc3550#section-6.1) More...
struct  sender_info
 RTCP Sender Information (http://tools.ietf.org/html/rfc3550#section-6.4.1) More...
struct  report_block
 RTCP Report Block (http://tools.ietf.org/html/rfc3550#section-6.4.1) More...
struct  rtcp_sr
 RTCP Sender Report (http://tools.ietf.org/html/rfc3550#section-6.4.1) More...
struct  rtcp_rr
 RTCP Receiver Report (http://tools.ietf.org/html/rfc3550#section-6.4.2) More...
struct  rtcp_sdes_chunk
 RTCP SDES (http://tools.ietf.org/html/rfc3550#section-6.5) More...
struct  rtcp_sdes_item
struct  rtcp_sdes
struct  rtcp_bye
 RTCP BYE (http://tools.ietf.org/html/rfc3550#section-6.6) More...
struct  rtcp_app
 RTCP APP (http://tools.ietf.org/html/rfc3550#section-6.7) More...
struct  rtcp_nack
 RTCP NACK (http://tools.ietf.org/html/rfc4585#section-6.2.1) More...
struct  janus_nack
 Janus representation (linked list) of sequence numbers to send again. More...
struct  rtcp_remb
 RTCP REMB (http://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03) More...
struct  rtcp_fir
 RTCP FIR (http://tools.ietf.org/search/rfc5104#section-4.3.1.1) More...
struct  rtcp_fb
 RTCP-FB (http://tools.ietf.org/html/rfc4585) More...

Typedefs

typedef struct rtcp_header rtcp_header
 RTCP Header (http://tools.ietf.org/html/rfc3550#section-6.1)
typedef struct sender_info sender_info
 RTCP Sender Information (http://tools.ietf.org/html/rfc3550#section-6.4.1)
typedef struct report_block report_block
 RTCP Report Block (http://tools.ietf.org/html/rfc3550#section-6.4.1)
typedef struct rtcp_sr rtcp_sr
 RTCP Sender Report (http://tools.ietf.org/html/rfc3550#section-6.4.1)
typedef struct rtcp_rr rtcp_rr
 RTCP Receiver Report (http://tools.ietf.org/html/rfc3550#section-6.4.2)
typedef struct rtcp_sdes_chunk rtcp_sdes_chunk
 RTCP SDES (http://tools.ietf.org/html/rfc3550#section-6.5)
typedef struct rtcp_sdes_item rtcp_sdes_item
typedef struct rtcp_sdes rtcp_sdes
typedef struct rtcp_bye rtcp_bye_t
 RTCP BYE (http://tools.ietf.org/html/rfc3550#section-6.6)
typedef struct rtcp_app rtcp_app_t
 RTCP APP (http://tools.ietf.org/html/rfc3550#section-6.7)
typedef struct rtcp_nack rtcp_nack
 RTCP NACK (http://tools.ietf.org/html/rfc4585#section-6.2.1)
typedef struct janus_nack janus_nack
 Janus representation (linked list) of sequence numbers to send again.
typedef struct rtcp_remb rtcp_remb
 RTCP REMB (http://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03)
typedef struct rtcp_fir rtcp_fir
 RTCP FIR (http://tools.ietf.org/search/rfc5104#section-4.3.1.1)
typedef struct rtcp_fb rtcp_fb
 RTCP-FB (http://tools.ietf.org/html/rfc4585)

Enumerations

enum  rtcp_type {
  RTCP_FIR = 192, RTCP_SR = 200, RTCP_RR = 201, RTCP_SDES = 202,
  RTCP_BYE = 203, RTCP_APP = 204, RTCP_RTPFB = 205, RTCP_PSFB = 206
}
 RTCP Packet Types (http://www.networksorcery.com/enp/protocol/rtcp.htm) More...

Functions

guint32 janus_rtcp_get_sender_ssrc (char *packet, int len)
 Method to quickly retrieve the sender SSRC (needed for demuxing RTCP in BUNDLE)
guint32 janus_rtcp_get_receiver_ssrc (char *packet, int len)
 Method to quickly retrieve the received SSRC (needed for demuxing RTCP in BUNDLE)
int janus_rtcp_parse (char *packet, int len)
 Method to parse/validate an RTCP message.
int janus_rtcp_fix_ssrc (char *packet, int len, int fixssrc, uint32_t newssrcl, uint32_t newssrcr)
 Method to fix an RTCP message (http://tools.ietf.org/html/draft-ietf-straw-b2bua-rtcp-00)
gboolean janus_rtcp_has_fir (char *packet, int len)
 Method to check whether an RTCP message contains a FIR request.
gboolean janus_rtcp_has_pli (char *packet, int len)
 Method to check whether an RTCP message contains a PLI request.
GSList * janus_rtcp_get_nacks (char *packet, int len)
 Method to parse an RTCP NACK message.
int janus_rtcp_remove_nacks (char *packet, int len)
 Method to remove an RTCP NACK message.
uint64_t janus_rtcp_get_remb (char *packet, int len)
 Inspect an existing RTCP REMB message to retrieve the reported bitrate.
int janus_rtcp_cap_remb (char *packet, int len, uint64_t bitrate)
 Method to modify an existing RTCP REMB message to cap the reported bitrate.
int janus_rtcp_sdes (char *packet, int len, const char *cname, int cnamelen)
 Method to generate a new RTCP SDES message.
int janus_rtcp_remb (char *packet, int len, uint64_t bitrate)
 Method to generate a new RTCP REMB message to cap the reported bitrate.
int janus_rtcp_fir (char *packet, int len, int *seqnr)
 Method to generate a new RTCP FIR message to request a key frame.
int janus_rtcp_fir_legacy (char *packet, int len, int *seqnr)
 Method to generate a new legacy RTCP FIR (RFC2032) message to request a key frame.
int janus_rtcp_pli (char *packet, int len)
 Method to generate a new RTCP PLI message to request a key frame.
int janus_rtcp_nacks (char *packet, int len, GSList *nacks)
 Method to generate a new RTCP NACK message to report lost packets.

Detailed Description

RTCP processing (headers)

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Implementation of the RTCP messages. RTCP messages coming through the gateway are parsed and, if needed (according to http://tools.ietf.org/html/draft-ietf-straw-b2bua-rtcp-00), fixed before they are sent to the peers (e.g., to fix SSRCs that may have been changed by the gateway). Methods to generate FIR messages and generate/cap REMB messages are provided as well.

Protocols

Typedef Documentation

typedef struct janus_nack janus_nack

Janus representation (linked list) of sequence numbers to send again.

typedef struct report_block report_block
typedef struct rtcp_app rtcp_app_t
typedef struct rtcp_bye rtcp_bye_t
typedef struct rtcp_fb rtcp_fb
typedef struct rtcp_fir rtcp_fir
typedef struct rtcp_header rtcp_header
typedef struct rtcp_nack rtcp_nack
typedef struct rtcp_remb rtcp_remb
typedef struct rtcp_rr rtcp_rr
typedef struct rtcp_sdes rtcp_sdes
typedef struct rtcp_sr rtcp_sr
typedef struct sender_info sender_info

Enumeration Type Documentation

enum rtcp_type

RTCP Packet Types (http://www.networksorcery.com/enp/protocol/rtcp.htm)

Enumerator:
RTCP_FIR 
RTCP_SR 
RTCP_RR 
RTCP_SDES 
RTCP_BYE 
RTCP_APP 
RTCP_RTPFB 
RTCP_PSFB 

Function Documentation

int janus_rtcp_cap_remb ( char *  packet,
int  len,
uint64_t  bitrate 
)

Method to modify an existing RTCP REMB message to cap the reported bitrate.

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
[in]bitrateThe new bitrate to report (e.g., 128000)
Returns
0 in case of success, -1 on errors
int janus_rtcp_fir ( char *  packet,
int  len,
int *  seqnr 
)

Method to generate a new RTCP FIR message to request a key frame.

Parameters
[in]packetThe buffer data (MUST be at least 20 chars)
[in]lenThe message data length in bytes (MUST be 20)
[in,out]seqnrThe current FIR sequence number (will be incremented by the method)
Returns
The message data length in bytes, if successful, -1 on errors
int janus_rtcp_fir_legacy ( char *  packet,
int  len,
int *  seqnr 
)

Method to generate a new legacy RTCP FIR (RFC2032) message to request a key frame.

Note
This is actually identical to janus_rtcp_fir(), with the difference that we set 192 as packet type
Parameters
[in]packetThe buffer data (MUST be at least 20 chars)
[in]lenThe message data length in bytes (MUST be 20)
[in,out]seqnrThe current FIR sequence number (will be incremented by the method)
Returns
The message data length in bytes, if successful, -1 on errors
int janus_rtcp_fix_ssrc ( char *  packet,
int  len,
int  fixssrc,
uint32_t  newssrcl,
uint32_t  newssrcr 
)

Method to fix an RTCP message (http://tools.ietf.org/html/draft-ietf-straw-b2bua-rtcp-00)

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
[in]fixssrcWhether the method needs to fix the message or just parse it
[in]newssrclThe SSRC of the sender to put in the message
[in]newssrcrThe SSRC of the receiver to put in the message
Returns
0 in case of success, -1 on errors
GSList* janus_rtcp_get_nacks ( char *  packet,
int  len 
)

Method to parse an RTCP NACK message.

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
Returns
A list of janus_nack elements containing the sequence numbers to send again
guint32 janus_rtcp_get_receiver_ssrc ( char *  packet,
int  len 
)

Method to quickly retrieve the received SSRC (needed for demuxing RTCP in BUNDLE)

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
Returns
The receiver SSRC, or 0 in case of error
uint64_t janus_rtcp_get_remb ( char *  packet,
int  len 
)

Inspect an existing RTCP REMB message to retrieve the reported bitrate.

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
Returns
The reported bitrate if successful, 0 if no REMB packet was available
guint32 janus_rtcp_get_sender_ssrc ( char *  packet,
int  len 
)

Method to quickly retrieve the sender SSRC (needed for demuxing RTCP in BUNDLE)

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
Returns
The sender SSRC, or 0 in case of error
gboolean janus_rtcp_has_fir ( char *  packet,
int  len 
)

Method to check whether an RTCP message contains a FIR request.

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
Returns
TRUE in case of success, FALSE otherwise
gboolean janus_rtcp_has_pli ( char *  packet,
int  len 
)

Method to check whether an RTCP message contains a PLI request.

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
Returns
TRUE in case of success, FALSE otherwise
int janus_rtcp_nacks ( char *  packet,
int  len,
GSList *  nacks 
)

Method to generate a new RTCP NACK message to report lost packets.

Parameters
[in]packetThe buffer data (MUST be at least 16 chars)
[in]lenThe message data length in bytes (MUST be 16)
[in]nacksList of packets to NACK
Returns
The message data length in bytes, if successful, -1 on errors
int janus_rtcp_parse ( char *  packet,
int  len 
)

Method to parse/validate an RTCP message.

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
Returns
0 in case of success, -1 on errors
int janus_rtcp_pli ( char *  packet,
int  len 
)

Method to generate a new RTCP PLI message to request a key frame.

Parameters
[in]packetThe buffer data (MUST be at least 12 chars)
[in]lenThe message data length in bytes (MUST be 12)
Returns
The message data length in bytes, if successful, -1 on errors
int janus_rtcp_remb ( char *  packet,
int  len,
uint64_t  bitrate 
)

Method to generate a new RTCP REMB message to cap the reported bitrate.

Parameters
[in]packetThe buffer data (MUST be at least 24 chars)
[in]lenThe message data length in bytes (MUST be 24)
[in]bitrateThe bitrate to report (e.g., 128000)
Returns
The message data length in bytes, if successful, -1 on errors
int janus_rtcp_remove_nacks ( char *  packet,
int  len 
)

Method to remove an RTCP NACK message.

Parameters
[in]packetThe message data
[in]lenThe message data length in bytes
Returns
The new message data length in bytes
Note
This is mostly a placeholder: for the sake of simplicity, whenever we handle some sequence numbers in a NACK, we remove the NACK as a whole before forwarding the RTCP message. Future versions will only selectively remove the sequence numbers that have been handled.
int janus_rtcp_sdes ( char *  packet,
int  len,
const char *  cname,
int  cnamelen 
)

Method to generate a new RTCP SDES message.

Parameters
[in]packetThe buffer data
[in]lenThe buffer data length in bytes
[in]cnameThe CNAME to write
[in]cnamelenThe CNAME data length in bytes
Returns
The message data length in bytes, if successful, -1 on errors