Loading...
Searching...
No Matches
rtcp.h File Reference
Core » Protocols

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...
struct | extended_report_block
| RTCP Extended Report Block (https://tools.ietf.org/html/rfc3611#section-3). More...
struct | rtcp_xr
| RTCP Extended Report (https://tools.ietf.org/html/rfc3611#section-2). More...
struct | rtcp_context
| Internal RTCP state context (for RR/SR). More...
struct | rtcp_transport_wide_cc_stats
| Stores transport wide packet reception statistics. More...

## Typedefs

typedef rtcp_type | janus_rtcp_type
typedef struct rtcp_header | rtcp_header
| RTCP Header (http://tools.ietf.org/html/rfc3550#section-6.1).
typedef rtcp_header | janus_rtcp_header
typedef struct sender_info | sender_info
| RTCP Sender Information (http://tools.ietf.org/html/rfc3550#section-6.4.1).
typedef sender_info | janus_sender_info
typedef struct report_block | report_block
| RTCP Report Block (http://tools.ietf.org/html/rfc3550#section-6.4.1).
typedef report_block | janus_report_block
typedef struct rtcp_sr | rtcp_sr
| RTCP Sender Report (http://tools.ietf.org/html/rfc3550#section-6.4.1).
typedef rtcp_sr | janus_rtcp_sr
typedef struct rtcp_rr | rtcp_rr
| RTCP Receiver Report (http://tools.ietf.org/html/rfc3550#section-6.4.2).
typedef rtcp_rr | janus_rtcp_rr
typedef struct rtcp_sdes_chunk | rtcp_sdes_chunk
| RTCP SDES (http://tools.ietf.org/html/rfc3550#section-6.5).
typedef rtcp_sdes_chunk | janus_rtcp_sdes_chunk
typedef struct rtcp_sdes_item | rtcp_sdes_item
typedef rtcp_sdes_item | janus_rtcp_sdes_item
typedef struct rtcp_sdes | rtcp_sdes
typedef rtcp_sdes | janus_rtcp_sdes
typedef struct rtcp_bye | rtcp_bye
| RTCP BYE (http://tools.ietf.org/html/rfc3550#section-6.6).
typedef rtcp_bye | janus_rtcp_bye
typedef struct rtcp_app | rtcp_app
| RTCP APP (http://tools.ietf.org/html/rfc3550#section-6.7).
typedef rtcp_app | janus_rtcp_app
typedef struct rtcp_nack | rtcp_nack
| RTCP NACK (http://tools.ietf.org/html/rfc4585#section-6.2.1).
typedef rtcp_nack | janus_rtcp_nack
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 rtcp_remb | janus_rtcp_fb_remb
typedef struct rtcp_fir | rtcp_fir
| RTCP FIR (http://tools.ietf.org/search/rfc5104#section-4.3.1.1).
typedef rtcp_fir | janus_rtcp_fb_fir
typedef struct rtcp_fb | rtcp_fb
| RTCP-FB (http://tools.ietf.org/html/rfc4585).
typedef rtcp_fb | janus_rtcp_fb
typedef struct extended_report_block | extended_report_block
| RTCP Extended Report Block (https://tools.ietf.org/html/rfc3611#section-3).
typedef extended_report_block | janus_extended_report_block
typedef struct rtcp_xr | rtcp_xr
| RTCP Extended Report (https://tools.ietf.org/html/rfc3611#section-2).
typedef rtcp_xr | janus_rtcp_xr
typedef struct rtcp_context | rtcp_context
| Internal RTCP state context (for RR/SR).
typedef rtcp_context | janus_rtcp_context
typedef struct rtcp_transport_wide_cc_stats | rtcp_transport_wide_cc_stats
| Stores transport wide packet reception statistics.
typedef rtcp_transport_wide_cc_stats | janus_rtcp_transport_wide_cc_stats

## 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_rtt (janus_rtcp_context *ctx)
| Method to retrieve the estimated round-trip time from an existing RTCP context.
int32_t | janus_rtcp_context_get_lost_all (janus_rtcp_context *ctx, gboolean remote)
| Method to retrieve the total number of lost packets from an existing RTCP context.
uint32_t | janus_rtcp_context_get_jitter (janus_rtcp_context *ctx, gboolean remote)
| Method to retrieve the jitter from an existing RTCP context.
uint32_t | janus_rtcp_context_get_in_link_quality (janus_rtcp_context *ctx)
| Method to retrieve inbound link quality from an existing RTCP context.
uint32_t | janus_rtcp_context_get_in_media_link_quality (janus_rtcp_context *ctx)
| Method to retrieve inbound media link quality from an existing RTCP context.
uint32_t | janus_rtcp_context_get_out_link_quality (janus_rtcp_context *ctx)
| Method to retrieve outbound link quality from an existing RTCP context.
uint32_t | janus_rtcp_context_get_out_media_link_quality (janus_rtcp_context *ctx)
| Method to retrieve outbound media link quality from an existing RTCP context.
void | janus_rtcp_swap_report_blocks (char *packet, int len, uint32_t rtx_ssrc)
| Method to swap Report Blocks and move media RB in first position in case rtx SSRC comes first.
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).
gboolean | janus_rtcp_check_len (janus_rtcp_header *rtcp, int len)
| Method to check that a RTCP packet size is at least the minimum necessary (8 bytes) and to validate the length field against the actual size.
gboolean | janus_rtcp_check_rr (janus_rtcp_header *rtcp, int len)
| Method to check if a RTCP packet could contain a Receiver Report.
gboolean | janus_rtcp_check_sr (janus_rtcp_header *rtcp, int len)
| Method to check if a RTCP packet could contain a Sender Report.
gboolean | janus_rtcp_check_fci (janus_rtcp_header *rtcp, int len, int sizeof_fci)
| Method to check if a RTCP packet could contain a Feedback Message with a defined FCI size.
gboolean | janus_rtcp_check_remb (janus_rtcp_header *rtcp, int len)
| Method to check if a RTCP packet could contain an AFB REMB Message.
gboolean | janus_is_rtcp (char *buf, guint len)
| Helper method to demultiplex RTCP from other protocols.
int | janus_rtcp_parse (janus_rtcp_context *ctx, char *packet, int len)
| Method to parse/validate an RTCP message.
int | janus_rtcp_fix_report_data (char *packet, int len, uint32_t base_ts, uint32_t base_ts_prev, uint32_t ssrc_peer, uint32_t ssrc_local, uint32_t ssrc_expected, gboolean video)
| Method to fix incoming RTCP SR and RR data.
int | janus_rtcp_fix_ssrc (janus_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).
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).
int | janus_rtcp_process_incoming_rtp (janus_rtcp_context *ctx, char *packet, int len, gboolean rfc4588_pkt, gboolean rfc4588_enabled, gboolean retransmissions_disabled, GHashTable *clock_rates)
| Method to quickly process the header of an incoming RTP packet to update the associated RTCP context.
int | janus_rtcp_report_block (janus_rtcp_context *ctx, janus_report_block *rb)
| Method to fill in a Report Block in a Receiver Report.
gboolean | janus_rtcp_has_bye (char *packet, int len)
| Method to check whether an RTCP message contains a BYE message.
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.
void | janus_rtcp_get_nacks (char *packet, int len, GQueue *nacks_queue)
| Method to parse an RTCP NACK message.
int | janus_rtcp_remove_nacks (char *packet, int len)
| Method to remove an RTCP NACK message.
uint32_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, uint32_t bitrate)
| Method to modify an existing RTCP REMB message to cap the reported bitrate.
int | janus_rtcp_sdes_cname (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, uint32_t bitrate)
| Method to generate a new RTCP REMB message to cap the reported bitrate.
int | janus_rtcp_remb_ssrcs (char *packet, int len, uint32_t bitrate, uint8_t numssrc)
| Method to generate a new RTCP REMB message to cap the reported bitrate, but for more SSRCs.
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.
int | janus_rtcp_transport_wide_cc_feedback (char *packet, size_t len, guint32 ssrc, guint32 media, guint8 feedback_packet_count, GQueue *transport_wide_cc_stats)
| Method to generate a new RTCP transport wide message to report reception stats.

## Detailed Description

RTCP processing (headers).

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

Copyright
  GNU General Public License v3

Implementation of the RTCP messages. RTCP messages coming through the server 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 server). Methods to generate FIR messages and generate/cap REMB messages are provided as well.

Protocols

## Typedef Documentation

## extended_report_block

typedef struct extended_report_block extended_report_block

RTCP Extended Report Block (https://tools.ietf.org/html/rfc3611#section-3).

## janus_extended_report_block

typedef extended_report_block janus_extended_report_block

## janus_nack

typedef struct janus_nack janus_nack

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

## janus_report_block

typedef report_block janus_report_block

## janus_rtcp_app

typedef rtcp_app janus_rtcp_app

## janus_rtcp_bye

typedef rtcp_bye janus_rtcp_bye

## janus_rtcp_context

typedef rtcp_context janus_rtcp_context

## janus_rtcp_fb

typedef rtcp_fb janus_rtcp_fb

## janus_rtcp_fb_fir

typedef rtcp_fir janus_rtcp_fb_fir

## janus_rtcp_fb_remb

typedef rtcp_remb janus_rtcp_fb_remb

## janus_rtcp_header

typedef rtcp_header janus_rtcp_header

## janus_rtcp_nack

typedef rtcp_nack janus_rtcp_nack

## janus_rtcp_rr

typedef rtcp_rr janus_rtcp_rr

## janus_rtcp_sdes

typedef rtcp_sdes janus_rtcp_sdes

## janus_rtcp_sdes_chunk

typedef rtcp_sdes_chunk janus_rtcp_sdes_chunk

## janus_rtcp_sdes_item

typedef rtcp_sdes_item janus_rtcp_sdes_item

## janus_rtcp_sr

typedef rtcp_sr janus_rtcp_sr

## janus_rtcp_transport_wide_cc_stats

typedef rtcp_transport_wide_cc_stats janus_rtcp_transport_wide_cc_stats

## janus_rtcp_type

typedef rtcp_type janus_rtcp_type

## janus_rtcp_xr

typedef rtcp_xr janus_rtcp_xr

## janus_sender_info

typedef sender_info janus_sender_info

## report_block

typedef struct report_block report_block

RTCP Report Block (http://tools.ietf.org/html/rfc3550#section-6.4.1).

## rtcp_app

typedef struct rtcp_app rtcp_app

RTCP APP (http://tools.ietf.org/html/rfc3550#section-6.7).

## rtcp_bye

typedef struct rtcp_bye rtcp_bye

RTCP BYE (http://tools.ietf.org/html/rfc3550#section-6.6).

## rtcp_context

typedef struct rtcp_context rtcp_context

Internal RTCP state context (for RR/SR).

## rtcp_fb

typedef struct rtcp_fb rtcp_fb

RTCP-FB (http://tools.ietf.org/html/rfc4585).

## rtcp_fir

typedef struct rtcp_fir rtcp_fir

RTCP FIR (http://tools.ietf.org/search/rfc5104#section-4.3.1.1).

## rtcp_header

typedef struct rtcp_header rtcp_header

RTCP Header (http://tools.ietf.org/html/rfc3550#section-6.1).

## rtcp_nack

typedef struct rtcp_nack rtcp_nack

RTCP NACK (http://tools.ietf.org/html/rfc4585#section-6.2.1).

## rtcp_remb

typedef struct rtcp_remb rtcp_remb

RTCP REMB (http://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03).

## rtcp_rr

typedef struct rtcp_rr rtcp_rr

RTCP Receiver Report (http://tools.ietf.org/html/rfc3550#section-6.4.2).

## rtcp_sdes

typedef struct rtcp_sdes rtcp_sdes

## rtcp_sdes_chunk

typedef struct rtcp_sdes_chunk rtcp_sdes_chunk

RTCP SDES (http://tools.ietf.org/html/rfc3550#section-6.5).

## rtcp_sdes_item

typedef struct rtcp_sdes_item rtcp_sdes_item

## rtcp_sr

typedef struct rtcp_sr rtcp_sr

RTCP Sender Report (http://tools.ietf.org/html/rfc3550#section-6.4.1).

## rtcp_transport_wide_cc_stats

typedef struct rtcp_transport_wide_cc_stats rtcp_transport_wide_cc_stats

Stores transport wide packet reception statistics.

## rtcp_xr

typedef struct rtcp_xr rtcp_xr

RTCP Extended Report (https://tools.ietf.org/html/rfc3611#section-2).

## sender_info

typedef struct sender_info sender_info

RTCP Sender Information (http://tools.ietf.org/html/rfc3550#section-6.4.1).

## Enumeration Type Documentation

## rtcp_type

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 |

## Function Documentation

## janus_is_rtcp()

gboolean janus_is_rtcp | ( | char * | buf,
|  | guint | len )

Helper method to demultiplex RTCP from other protocols.

Parameters

  [in] | buf | Buffer to inspect
  [in] | len | Length of the buffer to inspect

## janus_rtcp_cap_remb()

int janus_rtcp_cap_remb | ( | char * | packet,
|  | int | len,
|  | uint32_t | bitrate )

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

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes
  [in] | bitrate | The new bitrate to report (e.g., 128000)

Returns
  0 in case of success, -1 on errors

## janus_rtcp_check_fci()

gboolean janus_rtcp_check_fci | ( | janus_rtcp_header * | rtcp,
|  | int | len,
|  | int | sizeof_fci )

Method to check if a RTCP packet could contain a Feedback Message with a defined FCI size.

Parameters

  [in] | rtcp | The RTCP message
  [in] | len | The message data length in bytes
  [in] | sizeof_fci | The size of a FCI entry

Returns
  TRUE if packet is OK, or FALSE in case of error

## janus_rtcp_check_len()

gboolean janus_rtcp_check_len | ( | janus_rtcp_header * | rtcp,
|  | int | len )

Method to check that a RTCP packet size is at least the minimum necessary (8 bytes) and to validate the length field against the actual size.

Parameters

  [in] | rtcp | The RTCP message
  [in] | len | The message data length in bytes

Returns
  TRUE if packet is OK, or FALSE in case of error

## janus_rtcp_check_remb()

gboolean janus_rtcp_check_remb | ( | janus_rtcp_header * | rtcp,
|  | int | len )

Method to check if a RTCP packet could contain an AFB REMB Message.

Parameters

  [in] | rtcp | The RTCP message
  [in] | len | The message data length in bytes

Returns
  TRUE if packet is OK, or FALSE in case of error

## janus_rtcp_check_rr()

gboolean janus_rtcp_check_rr | ( | janus_rtcp_header * | rtcp,
|  | int | len )

Method to check if a RTCP packet could contain a Receiver Report.

Parameters

  [in] | rtcp | The RTCP message
  [in] | len | The message data length in bytes

Returns
  TRUE if packet is OK, or FALSE in case of error

## janus_rtcp_check_sr()

gboolean janus_rtcp_check_sr | ( | janus_rtcp_header * | rtcp,
|  | int | len )

Method to check if a RTCP packet could contain a Sender Report.

Parameters

  [in] | rtcp | The RTCP message
  [in] | len | The message data length in bytes

Returns
  TRUE if packet is OK, or FALSE in case of error

## janus_rtcp_context_get_in_link_quality()

uint32_t janus_rtcp_context_get_in_link_quality | ( | janus_rtcp_context * | ctx | ) |

Method to retrieve inbound link quality from an existing RTCP context.

Parameters

  [in] | ctx | The RTCP context to query

Returns
  Inbound link quality estimation

## janus_rtcp_context_get_in_media_link_quality()

uint32_t janus_rtcp_context_get_in_media_link_quality | ( | janus_rtcp_context * | ctx | ) |

Method to retrieve inbound media link quality from an existing RTCP context.

Parameters

  [in] | ctx | The RTCP context to query

Returns
  Inbound media link quality estimation

## janus_rtcp_context_get_jitter()

uint32_t janus_rtcp_context_get_jitter | ( | janus_rtcp_context * | ctx,
|  | gboolean | remote )

Method to retrieve the jitter from an existing RTCP context.

Parameters

  [in] | ctx | The RTCP context to query
  [in] | remote | Whether we're querying the remote (provided by peer) or local (computed by Janus) info

Returns
  The computed jitter

## janus_rtcp_context_get_lost_all()

int32_t janus_rtcp_context_get_lost_all | ( | janus_rtcp_context * | ctx,
|  | gboolean | remote )

Method to retrieve the total number of lost packets from an existing RTCP context.

Parameters

  [in] | ctx | The RTCP context to query
  [in] | remote | Whether we're querying the remote (provided by peer) or local (computed by Janus) info

Returns
  The total number of lost packets

## janus_rtcp_context_get_out_link_quality()

uint32_t janus_rtcp_context_get_out_link_quality | ( | janus_rtcp_context * | ctx | ) |

Method to retrieve outbound link quality from an existing RTCP context.

Parameters

  [in] | ctx | The RTCP context to query

Returns
  Outbound link quality estimation

## janus_rtcp_context_get_out_media_link_quality()

uint32_t janus_rtcp_context_get_out_media_link_quality | ( | janus_rtcp_context * | ctx | ) |

Method to retrieve outbound media link quality from an existing RTCP context.

Parameters

  [in] | ctx | The RTCP context to query

Returns
  Outbound media link quality estimation

## janus_rtcp_context_get_rtt()

uint32_t janus_rtcp_context_get_rtt | ( | janus_rtcp_context * | ctx | ) |

Method to retrieve the estimated round-trip time from an existing RTCP context.

Parameters

  [in] | ctx | The RTCP context to query

Returns
  The estimated round-trip time

## janus_rtcp_filter()

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).

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes
  [in,out] | newlen | The data length of the filtered RTCP message

Returns
  A pointer to the new RTCP message data, NULL in case all messages have been filtered out

## janus_rtcp_fir()

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] | 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)

Returns
  The message data length in bytes, if successful, -1 on errors

## janus_rtcp_fir_legacy()

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] | 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)

Returns
  The message data length in bytes, if successful, -1 on errors

## janus_rtcp_fix_report_data()

int janus_rtcp_fix_report_data | ( | char * | packet,
|  | int | len,
|  | uint32_t | base_ts,
|  | uint32_t | base_ts_prev,
|  | uint32_t | ssrc_peer,
|  | uint32_t | ssrc_local,
|  | uint32_t | ssrc_expected,
|  | gboolean | video )

Method to fix incoming RTCP SR and RR data.

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes
  [in] | base_ts | RTP context base timestamp to compute offset
  [in] | base_ts_prev | RTP context base timestamp to compute offset
  [in] | ssrc_peer | The remote SSRC in usage for this stream
  [in] | ssrc_local | The local SSRC in usage for this stream
  [in] | ssrc_expected | The expected SSRC for this RTCP packet
  [in] | video | Whether the RTCP packet contains report for video data

Returns
  The number of fields updated, negative values on errors

## janus_rtcp_fix_ssrc()

int janus_rtcp_fix_ssrc | ( | janus_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).

Parameters

  [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] | newssrcl | The SSRC of the sender to put in the message
  [in] | newssrcr | The SSRC of the receiver to put in the message

Returns
  0 in case of success, -1 on errors

## janus_rtcp_get_nacks()

void janus_rtcp_get_nacks | ( | char * | packet,
|  | int | len,
|  | GQueue * | nacks_queue )

Method to parse an RTCP NACK message.

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes
  [in,out] | nacks_queue | The queue containing the sequence numbers to send again

## janus_rtcp_get_receiver_ssrc()

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] | packet | The message data
  [in] | len | The message data length in bytes

Returns
  The receiver SSRC, or 0 in case of error

## janus_rtcp_get_remb()

uint32_t janus_rtcp_get_remb | ( | char * | packet,
|  | int | len )

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

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes

Returns
  The reported bitrate if successful, 0 if no REMB packet was available

## janus_rtcp_get_sender_ssrc()

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] | packet | The message data
  [in] | len | The message data length in bytes

Returns
  The sender SSRC, or 0 in case of error

## janus_rtcp_has_bye()

gboolean janus_rtcp_has_bye | ( | char * | packet,
|  | int | len )

Method to check whether an RTCP message contains a BYE message.

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes

Returns
  TRUE in case of success, FALSE otherwise

## janus_rtcp_has_fir()

gboolean janus_rtcp_has_fir | ( | char * | packet,
|  | int | len )

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

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes

Returns
  TRUE in case of success, FALSE otherwise

## janus_rtcp_has_pli()

gboolean janus_rtcp_has_pli | ( | char * | packet,
|  | int | len )

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

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes

Returns
  TRUE in case of success, FALSE otherwise

## janus_rtcp_nacks()

int janus_rtcp_nacks | ( | char * | packet,
|  | int | len,
|  | GSList * | nacks )

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

Parameters

  [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

Returns
  The message data length in bytes, if successful, -1 on errors

## janus_rtcp_parse()

int janus_rtcp_parse | ( | janus_rtcp_context * | ctx,
|  | char * | packet,
|  | int | len )

Method to parse/validate an RTCP message.

Parameters

  [in] | ctx | RTCP context to update, if needed (optional)
  [in] | packet | The message data
  [in] | len | The message data length in bytes

Returns
  0 in case of success, -1 on errors

## janus_rtcp_pli()

int janus_rtcp_pli | ( | char * | packet,
|  | int | len )

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

Parameters

  [in] | packet | The buffer data (MUST be at least 12 chars)
  [in] | len | The message data length in bytes (MUST be 12)

Returns
  The message data length in bytes, if successful, -1 on errors

## janus_rtcp_process_incoming_rtp()

int janus_rtcp_process_incoming_rtp | ( | janus_rtcp_context * | ctx,
|  | char * | packet,
|  | int | len,
|  | gboolean | rfc4588_pkt,
|  | gboolean | rfc4588_enabled,
|  | gboolean | retransmissions_disabled,
|  | GHashTable * | clock_rates )

Method to quickly process the header of an incoming RTP packet to update the associated RTCP context.

Parameters

  [in] | ctx | RTCP context to update, if needed (optional)
  [in] | packet | The RTP packet
  [in] | len | The packet data length in bytes
  [in] | rfc4588_pkt | True if this is a RTX packet
  [in] | rfc4588_enabled | True if this packet comes from a RTX enabled stream
  [in] | retransmissions_disabled | True if retransmissions are not supported at all for this stream
  [in] | clock_rates | Mapping between payload types and clock rates, if available

Returns
  0 in case of success, -1 on errors

## janus_rtcp_remb()

int janus_rtcp_remb | ( | char * | packet,
|  | int | len,
|  | uint32_t | bitrate )

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

Parameters

  [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)

Returns
  The message data length in bytes, if successful, -1 on errors

## janus_rtcp_remb_ssrcs()

int janus_rtcp_remb_ssrcs | ( | char * | packet,
|  | int | len,
|  | uint32_t | bitrate,
|  | uint8_t | numssrc )

Method to generate a new RTCP REMB message to cap the reported bitrate, but for more SSRCs.

Parameters

  [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)
  [in] | numssrc | The number of SSRCs to include in the request

Returns
  The message data length in bytes, if successful, -1 on errors

## janus_rtcp_remove_nacks()

int janus_rtcp_remove_nacks | ( | char * | packet,
|  | int | len )

Method to remove an RTCP NACK message.

Parameters

  [in] | packet | The message data
  [in] | len | The 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.

## janus_rtcp_report_block()

int janus_rtcp_report_block | ( | janus_rtcp_context * | ctx,
|  | janus_report_block * | rb )

Method to fill in a Report Block in a Receiver Report.

Parameters

  [in] | ctx | The RTCP context to use for the report
  [in] | rb | Pointer to a valid report_block area of the RTCP data

Returns
  0 in case of success, -1 on errors

## janus_rtcp_sdes_cname()

int janus_rtcp_sdes_cname | ( | char * | packet,
|  | int | len,
|  | const char * | cname,
|  | int | cnamelen )

Method to generate a new RTCP SDES message.

Parameters

  [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

Returns
  The message data length in bytes, if successful, -1 on errors

## janus_rtcp_swap_report_blocks()

void janus_rtcp_swap_report_blocks | ( | char * | packet,
|  | int | len,
|  | uint32_t | rtx_ssrc )

Method to swap Report Blocks and move media RB in first position in case rtx SSRC comes first.

Parameters

  [in] | packet | The message data
  [in] | len | The message data length in bytes
  [in] | rtx_ssrc | The rtx SSRC

## janus_rtcp_transport_wide_cc_feedback()

int janus_rtcp_transport_wide_cc_feedback | ( | char * | packet,
|  | size_t | len,
|  | guint32 | ssrc,
|  | guint32 | media,
|  | guint8 | feedback_packet_count,
|  | GQueue * | transport_wide_cc_stats )

Method to generate a new RTCP transport wide message to report reception stats.

Parameters

  [in] | packet | The buffer data (MUST be at least 16 chars)
  [in] | len | The message data length in bytes
  [in] | ssrc | SSRC of the origin stream
  [in] | media | SSRC of the destination stream
  [in] | feedback_packet_count | Feedback paccket count
  [in] | transport_wide_cc_stats | List of rtp packet reception stats

Returns
  The message data length in bytes, if successful, -1 on errors