RTCP processing (headers) More...
#include <arpa/inet.h>
#include <endian.h>
#include <inttypes.h>
#include <string.h>
Go to the source code of this file.
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_XR = 207 } |
RTCP Packet Types (http://www.networksorcery.com/enp/protocol/rtcp.htm) More... | |
Functions | |
uint32_t | janus_rtcp_context_get_lsr (rtcp_context *ctx) |
Method to retrieve the LSR from an existing RTCP context. More... | |
uint32_t | janus_rtcp_context_get_lost_all (rtcp_context *ctx, gboolean remote) |
Method to retrieve the total number of lost packets from an existing RTCP context. More... | |
uint32_t | janus_rtcp_context_get_jitter (rtcp_context *ctx, gboolean remote) |
Method to retrieve the jitter from an existing RTCP context. More... | |
guint32 | janus_rtcp_get_sender_ssrc (char *packet, int len) |
Method to quickly retrieve the sender SSRC (needed for demuxing RTCP in BUNDLE) More... | |
guint32 | janus_rtcp_get_receiver_ssrc (char *packet, int len) |
Method to quickly retrieve the received SSRC (needed for demuxing RTCP in BUNDLE) More... | |
int | janus_rtcp_parse (rtcp_context *ctx, char *packet, int len) |
Method to parse/validate an RTCP message. More... | |
int | janus_rtcp_fix_ssrc (rtcp_context *ctx, 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) More... | |
char * | janus_rtcp_filter (char *packet, int len, int *newlen) |
Method to filter an outgoing RTCP message (http://tools.ietf.org/html/draft-ietf-straw-b2bua-rtcp-00) More... | |
int | janus_rtcp_process_incoming_rtp (rtcp_context *ctx, char *packet, int len) |
Method to quickly process the header of an incoming RTP packet to update the associated RTCP context. More... | |
int | janus_rtcp_report_block (rtcp_context *ctx, report_block *rb) |
Method to fill in a Report Block in a Receiver Report. More... | |
gboolean | janus_rtcp_has_fir (char *packet, int len) |
Method to check whether an RTCP message contains a FIR request. More... | |
gboolean | janus_rtcp_has_pli (char *packet, int len) |
Method to check whether an RTCP message contains a PLI request. More... | |
GSList * | janus_rtcp_get_nacks (char *packet, int len) |
Method to parse an RTCP NACK message. More... | |
int | janus_rtcp_remove_nacks (char *packet, int len) |
Method to remove an RTCP NACK message. More... | |
uint64_t | janus_rtcp_get_remb (char *packet, int len) |
Inspect an existing RTCP REMB message to retrieve the reported bitrate. More... | |
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. More... | |
int | janus_rtcp_sdes (char *packet, int len, const char *cname, int cnamelen) |
Method to generate a new RTCP SDES message. More... | |
int | janus_rtcp_remb (char *packet, int len, uint64_t bitrate) |
Method to generate a new RTCP REMB message to cap the reported bitrate. More... | |
int | janus_rtcp_fir (char *packet, int len, int *seqnr) |
Method to generate a new RTCP FIR message to request a key frame. More... | |
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. More... | |
int | janus_rtcp_pli (char *packet, int len) |
Method to generate a new RTCP PLI message to request a key frame. More... | |
int | janus_rtcp_nacks (char *packet, int len, GSList *nacks) |
Method to generate a new RTCP NACK message to report lost packets. More... | |
RTCP processing (headers)
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.
typedef struct extended_report_block extended_report_block |
RTCP Extended Report Block (https://tools.ietf.org/html/rfc3611#section-3)
typedef struct janus_nack janus_nack |
Janus representation (linked list) of sequence numbers to send again.
typedef struct report_block report_block |
RTCP Report Block (http://tools.ietf.org/html/rfc3550#section-6.4.1)
typedef struct rtcp_app rtcp_app_t |
typedef struct rtcp_bye rtcp_bye_t |
typedef struct rtcp_context rtcp_context |
Internal RTCP state context (for RR/SR)
RTCP-FB (http://tools.ietf.org/html/rfc4585)
typedef struct rtcp_header rtcp_header |
RTCP Header (http://tools.ietf.org/html/rfc3550#section-6.1)
RTCP NACK (http://tools.ietf.org/html/rfc4585#section-6.2.1)
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 |
RTCP Sender Report (http://tools.ietf.org/html/rfc3550#section-6.4.1)
RTCP Extended Report (https://tools.ietf.org/html/rfc3611#section-2)
typedef struct sender_info sender_info |
RTCP Sender Information (http://tools.ietf.org/html/rfc3550#section-6.4.1)
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 | |
RTCP_XR |
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.
[in] | packet | The message data |
[in] | len | The message data length in bytes |
[in] | bitrate | The new bitrate to report (e.g., 128000) |
uint32_t janus_rtcp_context_get_jitter | ( | rtcp_context * | ctx, |
gboolean | remote | ||
) |
Method to retrieve the jitter from an existing RTCP context.
[in] | ctx | The RTCP context to query |
[in] | remote | Whether we're quering the remote (provided by peer) or local (computed by Janus) info |
uint32_t janus_rtcp_context_get_lost_all | ( | rtcp_context * | ctx, |
gboolean | remote | ||
) |
Method to retrieve the total number of lost packets from an existing RTCP context.
[in] | ctx | The RTCP context to query |
[in] | remote | Whether we're quering the remote (provided by peer) or local (computed by Janus) info |
uint32_t janus_rtcp_context_get_lsr | ( | rtcp_context * | ctx | ) |
Method to retrieve the LSR from an existing RTCP context.
[in] | ctx | The RTCP context to query |
char* janus_rtcp_filter | ( | char * | packet, |
int | len, | ||
int * | newlen | ||
) |
Method to filter an outgoing RTCP message (http://tools.ietf.org/html/draft-ietf-straw-b2bua-rtcp-00)
[in] | packet | The message data |
[in] | len | The message data length in bytes |
[in,out] | newlen | The data length of the filtered RTCP message |
int janus_rtcp_fir | ( | char * | packet, |
int | len, | ||
int * | seqnr | ||
) |
Method to generate a new RTCP FIR message to request a key frame.
[in] | packet | The buffer data (MUST be at least 20 chars) |
[in] | len | The message data length in bytes (MUST be 20) |
[in,out] | seqnr | The current FIR sequence number (will be incremented by the method) |
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.
[in] | packet | The buffer data (MUST be at least 20 chars) |
[in] | len | The message data length in bytes (MUST be 20) |
[in,out] | seqnr | The current FIR sequence number (will be incremented by the method) |
int janus_rtcp_fix_ssrc | ( | rtcp_context * | ctx, |
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)
[in] | ctx | RTCP context to update, if needed (optional) |
[in] | packet | The message data |
[in] | len | The message data length in bytes |
[in] | fixssrc | Whether the method needs to fix the message or just parse it |
[in] | fixssrc | Whether the method needs to fix the message or just parse it |
[in] | newssrcl | The SSRC of the sender to put in the message |
[in] | newssrcr | The SSRC of the receiver to put in the message |
GSList* janus_rtcp_get_nacks | ( | char * | packet, |
int | len | ||
) |
Method to parse an RTCP NACK message.
[in] | packet | The message data |
[in] | len | The message data length in bytes |
guint32 janus_rtcp_get_receiver_ssrc | ( | char * | packet, |
int | len | ||
) |
Method to quickly retrieve the received SSRC (needed for demuxing RTCP in BUNDLE)
[in] | packet | The message data |
[in] | len | The message data length in bytes |
uint64_t janus_rtcp_get_remb | ( | char * | packet, |
int | len | ||
) |
Inspect an existing RTCP REMB message to retrieve the reported bitrate.
[in] | packet | The message data |
[in] | len | The message data length in bytes |
guint32 janus_rtcp_get_sender_ssrc | ( | char * | packet, |
int | len | ||
) |
Method to quickly retrieve the sender SSRC (needed for demuxing RTCP in BUNDLE)
[in] | packet | The message data |
[in] | len | The message data length in bytes |
gboolean janus_rtcp_has_fir | ( | char * | packet, |
int | len | ||
) |
Method to check whether an RTCP message contains a FIR request.
[in] | packet | The message data |
[in] | len | The message data length in bytes |
gboolean janus_rtcp_has_pli | ( | char * | packet, |
int | len | ||
) |
Method to check whether an RTCP message contains a PLI request.
[in] | packet | The message data |
[in] | len | The message data length in bytes |
int janus_rtcp_nacks | ( | char * | packet, |
int | len, | ||
GSList * | nacks | ||
) |
Method to generate a new RTCP NACK message to report lost packets.
[in] | packet | The buffer data (MUST be at least 16 chars) |
[in] | len | The message data length in bytes (MUST be 16) |
[in] | nacks | List of packets to NACK |
int janus_rtcp_parse | ( | rtcp_context * | ctx, |
char * | packet, | ||
int | len | ||
) |
Method to parse/validate an RTCP message.
[in] | ctx | RTCP context to update, if needed (optional) |
[in] | packet | The message data |
[in] | len | The message data length in bytes |
int janus_rtcp_pli | ( | char * | packet, |
int | len | ||
) |
Method to generate a new RTCP PLI message to request a key frame.
[in] | packet | The buffer data (MUST be at least 12 chars) |
[in] | len | The message data length in bytes (MUST be 12) |
int janus_rtcp_process_incoming_rtp | ( | rtcp_context * | ctx, |
char * | packet, | ||
int | len | ||
) |
Method to quickly process the header of an incoming RTP packet to update the associated RTCP context.
[in] | ctx | RTCP context to update, if needed (optional) |
[in] | packet | The RTP packet |
[in] | len | The packet data length in bytes |
int janus_rtcp_remb | ( | char * | packet, |
int | len, | ||
uint64_t | bitrate | ||
) |
Method to generate a new RTCP REMB message to cap the reported bitrate.
[in] | packet | The buffer data (MUST be at least 24 chars) |
[in] | len | The message data length in bytes (MUST be 24) |
[in] | bitrate | The bitrate to report (e.g., 128000) |
int janus_rtcp_remove_nacks | ( | char * | packet, |
int | len | ||
) |
Method to remove an RTCP NACK message.
[in] | packet | The message data |
[in] | len | The message data length in bytes |
int janus_rtcp_report_block | ( | rtcp_context * | ctx, |
report_block * | rb | ||
) |
Method to fill in a Report Block in a Receiver Report.
[in] | ctx | The RTCP context to use for the report |
[in] | rb | Pointer to a valid report_block area of the RTCP data |
int janus_rtcp_sdes | ( | char * | packet, |
int | len, | ||
const char * | cname, | ||
int | cnamelen | ||
) |
Method to generate a new RTCP SDES message.
[in] | packet | The buffer data |
[in] | len | The buffer data length in bytes |
[in] | cname | The CNAME to write |
[in] | cnamelen | The CNAME data length in bytes |