19 #include <arpa/inet.h> 21 #include <machine/endian.h> 46 #if __BYTE_ORDER == __BIG_ENDIAN 51 #elif __BYTE_ORDER == __LITTLE_ENDIAN 393 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);
422 gboolean rfc4588_pkt, gboolean rfc4588_enabled, gboolean retransmissions_disabled,
423 GHashTable *clock_rates);
int janus_rtcp_sdes_cname(char *packet, int len, const char *cname, int cnamelen)
Method to generate a new RTCP SDES message.
Definition: rtcp.c:1395
RTCP Report Block (http://tools.ietf.org/html/rfc3550#section-6.4.1)
Definition: rtcp.h:73
gboolean janus_rtcp_check_rr(janus_rtcp_header *rtcp, int len)
Method to check if a RTCP packet could contain a Receiver Report.
Definition: rtcp.c:432
uint8_t blocktype
Block type (BT)
Definition: rtcp.h:204
uint32_t seqnr
Sequence number (only the first 8 bits are used, the other 24 are reserved)
Definition: rtcp.h:181
uint32_t tb
Definition: rtcp.h:243
struct rtcp_bye rtcp_bye
RTCP BYE (http://tools.ietf.org/html/rfc3550#section-6.6)
uint32_t ehsnr
Definition: rtcp.h:77
rtcp_header header
Definition: rtcp.h:87
rtcp_fb janus_rtcp_fb
Definition: rtcp.h:198
uint8_t len
Definition: rtcp.h:113
RTCP SDES (http://tools.ietf.org/html/rfc3550#section-6.5)
Definition: rtcp.h:104
uint32_t rtp_last_inorder_ts
Definition: rtcp.h:230
RTCP BYE (http://tools.ietf.org/html/rfc3550#section-6.6)
Definition: rtcp.h:127
uint32_t ssrc
Definition: rtcp.h:98
rtcp_sdes_chunk chunk
Definition: rtcp.h:121
rtcp_fir janus_rtcp_fb_fir
Definition: rtcp.h:183
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.
Definition: rtcp.c:1005
struct sender_info sender_info
RTCP Sender Information (http://tools.ietf.org/html/rfc3550#section-6.4.1)
RTCP Extended Report Block (https://tools.ietf.org/html/rfc3611#section-3)
Definition: rtcp.h:201
RTCP-FB (http://tools.ietf.org/html/rfc4585)
Definition: rtcp.h:187
uint32_t lost_remote
Definition: rtcp.h:261
uint32_t retransmitted_prior
Definition: rtcp.h:264
uint16_t pid
Packet ID.
Definition: rtcp.h:147
rtcp_transport_wide_cc_stats janus_rtcp_transport_wide_cc_stats
Definition: rtcp.h:293
rtcp_sdes janus_rtcp_sdes
Definition: rtcp.h:124
rtcp_header header
Definition: rtcp.h:120
struct rtcp_fir rtcp_fir
RTCP FIR (http://tools.ietf.org/search/rfc5104#section-4.3.1.1)
guint32 janus_rtcp_get_receiver_ssrc(char *packet, int len)
Method to quickly retrieve the received SSRC (needed for demuxing RTCP in BUNDLE) ...
Definition: rtcp.c:109
int64_t rr_last_ts
Definition: rtcp.h:267
uint32_t rtp_ts
Definition: rtcp.h:66
uint16_t blp
bitmask of following lost packets
Definition: rtcp.h:149
uint32_t rr_last_ehsnr
Definition: rtcp.h:268
int64_t lsr_ts
Definition: rtcp.h:248
uint32_t janus_rtcp_context_get_rtt(janus_rtcp_context *ctx)
Method to retrieve the estimated round-trip time from an existing RTCP context.
Definition: rtcp.c:892
uint32_t janus_rtcp_get_remb(char *packet, int len)
Inspect an existing RTCP REMB message to retrieve the reported bitrate.
Definition: rtcp.c:1286
int janus_rtcp_remb(char *packet, int len, uint32_t bitrate)
Method to generate a new RTCP REMB message to cap the reported bitrate.
Definition: rtcp.c:1422
uint32_t ssrc
Sender SSRC.
Definition: rtcp.h:192
uint16_t seq_cycle
Definition: rtcp.h:234
gboolean janus_is_rtcp(char *buf, guint len)
Helper method to demultiplex RTCP from other protocols.
Definition: rtcp.c:45
extended_report_block janus_extended_report_block
Definition: rtcp.h:213
rtcp_rr janus_rtcp_rr
Definition: rtcp.h:101
struct rtcp_sdes_chunk rtcp_sdes_chunk
RTCP SDES (http://tools.ietf.org/html/rfc3550#section-6.5)
struct report_block report_block
RTCP Report Block (http://tools.ietf.org/html/rfc3550#section-6.4.1)
struct rtcp_sdes rtcp_sdes
gboolean janus_rtcp_has_pli(char *packet, int len)
Method to check whether an RTCP message contains a PLI request.
Definition: rtcp.c:1131
rtcp_sr janus_rtcp_sr
Definition: rtcp.h:92
int janus_rtcp_report_block(janus_rtcp_context *ctx, janus_report_block *rb)
Method to fill in a Report Block in a Receiver Report.
Definition: rtcp.c:974
uint32_t bitrate
Num SSRC, Br Exp, Br Mantissa (bit mask)
Definition: rtcp.h:168
guint32 transport_seq_num
Transwport wide sequence number.
Definition: rtcp.h:289
struct rtcp_nack rtcp_nack
RTCP NACK (http://tools.ietf.org/html/rfc4585#section-6.2.1)
rtcp_sdes_item item
Definition: rtcp.h:122
gboolean janus_rtcp_has_fir(char *packet, int len)
Method to check whether an RTCP message contains a FIR request.
Definition: rtcp.c:1103
gboolean janus_rtcp_check_sr(janus_rtcp_header *rtcp, int len)
Method to check if a RTCP packet could contain a Sender Report.
Definition: rtcp.c:418
uint32_t lsr
Definition: rtcp.h:79
uint8_t type
Definition: rtcp.h:112
rtcp_app janus_rtcp_app
Definition: rtcp.h:141
uint32_t retransmitted
Definition: rtcp.h:263
double out_link_quality
Definition: rtcp.h:277
RTCP APP (http://tools.ietf.org/html/rfc3550#section-6.7)
Definition: rtcp.h:135
rtcp_header header
Common header.
Definition: rtcp.h:190
rtcp_header header
Definition: rtcp.h:129
uint16_t seq_no
Sequence number to send again.
Definition: rtcp.h:156
rtcp_type janus_rtcp_type
Definition: rtcp.h:40
uint16_t length
Block length.
Definition: rtcp.h:208
double in_media_link_quality
Definition: rtcp.h:276
RTCP Receiver Report (http://tools.ietf.org/html/rfc3550#section-6.4.2)
Definition: rtcp.h:95
uint32_t ssrc
Definition: rtcp.h:106
guint64 timestamp
Reception time.
Definition: rtcp.h:291
struct rtcp_transport_wide_cc_stats rtcp_transport_wide_cc_stats
Stores transport wide packet reception statistics.
rtcp_context janus_rtcp_context
Definition: rtcp.h:283
int janus_rtcp_nacks(char *packet, int len, GSList *nacks)
Method to generate a new RTCP NACK message to report lost packets.
Definition: rtcp.c:1508
struct rtcp_fb rtcp_fb
RTCP-FB (http://tools.ietf.org/html/rfc4585)
uint32_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.
Definition: rtcp.c:912
RTCP NACK (http://tools.ietf.org/html/rfc4585#section-6.2.1)
Definition: rtcp.h:144
uint32_t received
Definition: rtcp.h:257
uint16_t pt
Definition: rtcp.h:237
uint32_t media
Media source.
Definition: rtcp.h:194
uint32_t janus_rtcp_context_get_in_link_quality(janus_rtcp_context *ctx)
Method to retrieve inbound link quality from an existing RTCP context.
Definition: rtcp.c:896
int64_t rtp_last_inorder_time
Definition: rtcp.h:231
uint8_t typesp
Type-specific.
Definition: rtcp.h:206
struct rtcp_app rtcp_app
RTCP APP (http://tools.ietf.org/html/rfc3550#section-6.7)
double out_media_link_quality
Definition: rtcp.h:278
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)...
Definition: rtcp.c:732
RTCP Extended Report (https://tools.ietf.org/html/rfc3611#section-2)
Definition: rtcp.h:216
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.
Definition: rtcp.c:1330
int64_t transit
Definition: rtcp.h:240
struct rtcp_remb rtcp_remb
RTCP REMB (http://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03)
uint32_t ssrc
Definition: rtcp.h:138
struct rtcp_header rtcp_header
RTCP Header (http://tools.ietf.org/html/rfc3550#section-6.1)
Janus representation (linked list) of sequence numbers to send again.
Definition: rtcp.h:154
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) ...
Definition: rtcp.c:493
rtcp_type
RTCP Packet Types (http://www.networksorcery.com/enp/protocol/rtcp.htm)
Definition: rtcp.h:29
rtcp_bye janus_rtcp_bye
Definition: rtcp.h:132
uint16_t max_seq_nr
Definition: rtcp.h:233
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.
Definition: rtcp.c:900
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.
Definition: rtcp.c:1494
rtcp_sdes_chunk janus_rtcp_sdes_chunk
Definition: rtcp.h:108
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...
Definition: rtcp.c:810
uint32_t s_octets
Definition: rtcp.h:68
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...
Definition: rtcp.c:442
uint16_t base_seq
Definition: rtcp.h:235
uint32_t expected
Definition: rtcp.h:259
gint nack_count
Definition: rtcp.h:272
sender_info si
Definition: rtcp.h:89
RTCP REMB (http://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03)
Definition: rtcp.h:163
uint32_t janus_rtcp_context_get_out_link_quality(janus_rtcp_context *ctx)
Method to retrieve outbound link quality from an existing RTCP context.
Definition: rtcp.c:904
uint32_t s_packets
Definition: rtcp.h:67
struct rtcp_sdes_item rtcp_sdes_item
rtcp_remb janus_rtcp_fb_remb
Definition: rtcp.h:172
int janus_rtcp_fir(char *packet, int len, int *seqnr)
Method to generate a new RTCP FIR message to request a key frame.
Definition: rtcp.c:1472
GSList * janus_rtcp_get_nacks(char *packet, int len)
Method to parse an RTCP NACK message.
Definition: rtcp.c:1163
uint32_t jitter
Definition: rtcp.h:78
uint32_t ntp_ts_msw
Definition: rtcp.h:64
uint32_t rr_last_nack_count
Definition: rtcp.h:270
struct extended_report_block extended_report_block
RTCP Extended Report Block (https://tools.ietf.org/html/rfc3611#section-3)
uint32_t ssrc
SSRC of the media sender that needs to send a key frame.
Definition: rtcp.h:179
uint32_t janus_rtcp_context_get_jitter(janus_rtcp_context *ctx, gboolean remote)
Method to retrieve the jitter from an existing RTCP context.
Definition: rtcp.c:944
uint32_t ntp_ts_lsw
Definition: rtcp.h:65
Stores transport wide packet reception statistics.
Definition: rtcp.h:286
Internal RTCP state context (for RR/SR)
Definition: rtcp.h:226
rtcp_header header
Definition: rtcp.h:97
gboolean janus_rtcp_has_bye(char *packet, int len)
Method to check whether an RTCP message contains a BYE message.
Definition: rtcp.c:1075
uint32_t rtt
Definition: rtcp.h:254
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...
Definition: rtcp.c:157
int janus_rtcp_parse(janus_rtcp_context *ctx, char *packet, int len)
Method to parse/validate an RTCP message.
Definition: rtcp.c:52
struct janus_nack * next
Next element in the linked list.
Definition: rtcp.h:158
uint32_t ssrc
Definition: rtcp.h:88
uint32_t ssrc
Definition: rtcp.h:219
uint32_t delay
Definition: rtcp.h:80
struct rtcp_xr rtcp_xr
RTCP Extended Report (https://tools.ietf.org/html/rfc3611#section-2)
struct rtcp_sr rtcp_sr
RTCP Sender Report (http://tools.ietf.org/html/rfc3550#section-6.4.1)
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...
Definition: rtcp.c:1427
struct janus_nack janus_nack
Janus representation (linked list) of sequence numbers to send again.
int janus_rtcp_remove_nacks(char *packet, int len)
Method to remove an RTCP NACK message.
Definition: rtcp.c:1231
sender_info janus_sender_info
Definition: rtcp.h:70
rtcp_xr janus_rtcp_xr
Definition: rtcp.h:222
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 t...
Definition: rtcp.c:405
int64_t last_sent
Definition: rtcp.h:251
gint sent_packets_since_last_rr
Definition: rtcp.h:271
double jitter_remote
Definition: rtcp.h:241
report_block janus_report_block
Definition: rtcp.h:82
rtcp_nack janus_rtcp_nack
Definition: rtcp.h:151
gboolean janus_rtcp_parse_lost_info(char *packet, int len, uint32_t *lost, int *fraction)
Method to quickly fetch the lost packets info from an RR packet, if present.
rtcp_header header
Definition: rtcp.h:218
guint32 janus_rtcp_get_sender_ssrc(char *packet, int len)
Method to quickly retrieve the sender SSRC (needed for demuxing RTCP in BUNDLE)
Definition: rtcp.c:56
uint32_t flcnpl
Definition: rtcp.h:76
struct rtcp_context rtcp_context
Internal RTCP state context (for RR/SR)
RTCP Sender Report (http://tools.ietf.org/html/rfc3550#section-6.4.1)
Definition: rtcp.h:85
uint32_t expected_prior
Definition: rtcp.h:260
struct rtcp_rr rtcp_rr
RTCP Receiver Report (http://tools.ietf.org/html/rfc3550#section-6.4.2)
uint32_t ssrc
Definition: rtcp.h:75
gboolean janus_rtcp_check_remb(janus_rtcp_header *rtcp, int len)
Method to check if a RTCP packet could contain an AFB REMB Message.
Definition: rtcp.c:475
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.
Definition: rtcp.c:908
rtcp_sdes_item janus_rtcp_sdes_item
Definition: rtcp.h:116
double in_link_quality
Definition: rtcp.h:275
uint32_t rr_last_lost
Definition: rtcp.h:269
rtcp_header janus_rtcp_header
Definition: rtcp.h:59
uint32_t received_prior
Definition: rtcp.h:258
rtcp_header header
Definition: rtcp.h:137
uint32_t lsr
Definition: rtcp.h:246
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.
Definition: rtcp.c:1552
RTCP FIR (http://tools.ietf.org/search/rfc5104#section-4.3.1.1)
Definition: rtcp.h:176
RTCP Sender Information (http://tools.ietf.org/html/rfc3550#section-6.4.1)
Definition: rtcp.h:62