Amazon Kinesis Webrtc C SDK
 
Loading...
Searching...
No Matches
RtcpPacket.h
Go to the documentation of this file.
1/*******************************************
2RTCP Packet include file
3*******************************************/
4#ifndef __KINESIS_VIDEO_WEBRTC_CLIENT_RTCP_RTCPPACKET_H
5#define __KINESIS_VIDEO_WEBRTC_CLIENT_RTCP_RTCPPACKET_H
6
7#pragma once
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#define RTCP_PACKET_LEN_OFFSET 2
14#define RTCP_PACKET_TYPE_OFFSET 1
15
16#define RTCP_PACKET_RRC_BITMASK 0x1F
17
18#define RTCP_PACKET_HEADER_LEN 4
19#define RTCP_NACK_LIST_LEN 8
20
21#define RTCP_PACKET_VERSION_VAL 2
22
23#define RTCP_PACKET_LEN_WORD_SIZE 4
24
25#define RTCP_PACKET_REMB_MIN_SIZE 16
26#define RTCP_PACKET_REMB_IDENTIFIER_OFFSET 8
27#define RTCP_PACKET_REMB_MANTISSA_BITMASK 0x3FFFF
28
29// Minimum sender report payload: sender SSRC (4) + NTP timestamp (8) + RTP timestamp (4) +
30// sender's packet count (4) + sender's octet count (4) = 24 bytes (RFC 3550 section 6.4.1).
31// Reception report blocks, when present, follow this fixed-size sender info section.
32#define RTCP_PACKET_SENDER_REPORT_MINLEN 24
33// Each reception report block: source SSRC (4) + fraction lost (1) + cumulative lost (3) +
34// extended highest seq (4) + interarrival jitter (4) + LSR (4) + DLSR (4) = 24 bytes.
35#define RTCP_PACKET_RECEIVER_REPORT_BLOCK_LEN 24
36// No longer used by the SDK: receiver report length is now validated dynamically against the
37// report block count (4 + RC * RTCP_PACKET_RECEIVER_REPORT_BLOCK_LEN in onRtcpReceiverReport).
38// Kept for backward compatibility with any external consumers of this header.
39#define RTCP_PACKET_RECEIVER_REPORT_MINLEN 4 + RTCP_PACKET_RECEIVER_REPORT_BLOCK_LEN
40// Maximum receiver report blocks processed per RR, keyed to the maximum number of media streams
41// a peer connection can negotiate (configurable via -DMAX_SDP_SESSION_MEDIA_COUNT). Report blocks
42// beyond the negotiated stream count cannot reference a known transceiver. The RC header field is
43// 5 bits, so the protocol-level ceiling is 31 regardless.
44#define RTCP_PACKET_RECEIVER_REPORT_MAX_BLOCKS MAX_SDP_SESSION_MEDIA_COUNT
45
46// https://tools.ietf.org/html/rfc3550#section-4
47// If the participant has not yet sent an RTCP packet (the variable
48// initial is true), the constant Tmin is set to 2.5 seconds, else it
49// is set to 5 seconds.
50#define RTCP_FIRST_REPORT_DELAY (3 * HUNDREDS_OF_NANOS_IN_A_SECOND)
51
52typedef enum {
53 RTCP_PACKET_TYPE_FIR = 192, // https://tools.ietf.org/html/rfc2032#section-5.2.1
55 RTCP_PACKET_TYPE_RECEIVER_REPORT = 201, // https://tools.ietf.org/html/rfc3550#section-6.4.2
60
61typedef enum {
63 RTCP_PSFB_PLI = 1, // https://tools.ietf.org/html/rfc4585#section-6.3
64 RTCP_PSFB_SLI = 2, // https://tools.ietf.org/html/rfc4585#section-6.3.2
67
68/*
69 *
70 * 0 1 2 3
71 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
72 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
73 * |V=2|P| Count | PT | length |
74 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
75 */
76
84
91
96
97#define NTP_OFFSET 2208988800ULL
98#define NTP_TIMESCALE 4294967296ULL
99
100// converts 100ns precision time to ntp time
102
103#define DLSR_TIMESCALE 65536
104
105// https://tools.ietf.org/html/rfc3550#section-4
106// In some fields where a more compact representation is
107// appropriate, only the middle 32 bits are used; that is, the low 16
108// bits of the integer part and the high 16 bits of the fractional part.
109#define MID_NTP(ntp_time) (UINT32)((currentTimeNTP >> 16U) & 0xffffffffULL)
110
111#ifdef __cplusplus
112}
113#endif
114
115#endif //__KINESIS_VIDEO_WEBRTC_CLIENT_RTCP_RTCPPACKET_H
STATUS setRtcpPacketFromBytes(PBYTE, UINT32, PRtcpPacket)
Definition RtcpPacket.c:5
UINT64 convertTimestampToNTP(UINT64 time100ns)
Definition RtcpPacket.c:149
STATUS rembValueGet(PBYTE, UINT32, PDOUBLE, PUINT32, PUINT8)
Definition RtcpPacket.c:112
RTCP_FEEDBACK_MESSAGE_TYPE
Definition RtcpPacket.h:61
@ RTCP_PSFB_PLI
Definition RtcpPacket.h:63
@ RTCP_FEEDBACK_MESSAGE_TYPE_NACK
Definition RtcpPacket.h:62
@ RTCP_PSFB_SLI
Definition RtcpPacket.h:64
@ RTCP_FEEDBACK_MESSAGE_TYPE_APPLICATION_LAYER_FEEDBACK
Definition RtcpPacket.h:65
RTCP_PACKET_TYPE
Definition RtcpPacket.h:52
@ RTCP_PACKET_TYPE_SOURCE_DESCRIPTION
Definition RtcpPacket.h:56
@ RTCP_PACKET_TYPE_GENERIC_RTP_FEEDBACK
Definition RtcpPacket.h:57
@ RTCP_PACKET_TYPE_FIR
Definition RtcpPacket.h:53
@ RTCP_PACKET_TYPE_SENDER_REPORT
Definition RtcpPacket.h:54
@ RTCP_PACKET_TYPE_PAYLOAD_SPECIFIC_FEEDBACK
Definition RtcpPacket.h:58
@ RTCP_PACKET_TYPE_RECEIVER_REPORT
Definition RtcpPacket.h:55
struct RtcpPacket * PRtcpPacket
struct RtcpPacketHeader * PRtcpPacketHeader
STATUS rtcpNackListGet(PBYTE, UINT32, PUINT32, PUINT32, PUINT16, PUINT32)
Definition RtcpPacket.c:37
STATUS isRembPacket(PBYTE, UINT32)
Definition RtcpPacket.c:86
@ RTC_RTP_TRANSCEIVER_DIRECTION_UNINITIALIZED
Will use the default "sendrecv" after initialization.
Definition Include.h:1058
Definition RtcpPacket.h:77
UINT8 receptionReportCount
Definition RtcpPacket.h:79
UINT8 version
Definition RtcpPacket.h:78
UINT32 packetLength
Definition RtcpPacket.h:82
RTCP_PACKET_TYPE packetType
Definition RtcpPacket.h:80
Definition RtcpPacket.h:85
RtcpPacketHeader header
Definition RtcpPacket.h:86
UINT32 payloadLength
Definition RtcpPacket.h:89
PBYTE payload
Definition RtcpPacket.h:88