1 /**
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /** \addtogroup  RTP_Stack
18  *  @{
19  */
20 
21 #ifndef __RTCP_REPORT_BLOCK_H__
22 #define __RTCP_REPORT_BLOCK_H__
23 
24 #include <RtpGlobal.h>
25 #include <RtpBuffer.h>
26 
27 /**
28  * @class    rtcp_report_block
29  * @brief    Header file to hold Report block information
30  */
31 class RtcpReportBlock
32 {
33 private:
34     // Synchronization source.
35     RtpDt_UInt32 m_uiSsrc;
36 
37     /**
38      * The fraction of RTP data packets from source SSRC_n lost since the
39      * previous SR or RR packet was sent, expressed as a fixed point
40      * number with the binary point at the left edge of the field.
41      */
42     RtpDt_UChar m_ucFracLost;
43 
44     /**
45      * The total number of RTP data packets from source SSRC_n that have
46      * been lost since the beginning of reception.
47      * The number of packets received includes any that are late or duplicated, and hence may
48      * be greater than the number expected, so the cumulative number of packets lost may
49      * be negative
50      */
51     RtpDt_Int32 m_uiCumNumPktLost;
52 
53     /**
54      * extended highest sequence number received
55      */
56     RtpDt_UInt32 m_uiExtHighSeqRcv;
57 
58     /**
59      * An estimate of the statistical variance of the RTP data packet
60      * interarrival time, measured in timestamp units and expressed as an
61      * unsigned integer.
62      */
63     RtpDt_UInt32 m_uiJitter;
64 
65     /**
66      * last SR timestamp
67      */
68     RtpDt_UInt32 m_uiLastSR;
69 
70     /**
71      * delay since last SR
72      */
73     RtpDt_UInt32 m_uiDelayLastSR;
74 
75 public:
76     RtcpReportBlock();
77     ~RtcpReportBlock();
78 
79     /**
80      * set method for m_uiSsrc
81      */
82     RtpDt_Void setSsrc(IN RtpDt_UInt32 uiSsrc);
83 
84     /**
85      * get method for m_uiSsrc
86      */
87     RtpDt_UInt32 getSsrc();
88 
89     /**
90      * set method for m_ucFracLost
91      */
92     RtpDt_Void setFracLost(IN RtpDt_UChar ucFracLost);
93 
94     /**
95      * get method for m_ucFracLost
96      */
97     RtpDt_UChar getFracLost();
98 
99     /**
100      * set method for m_uiCumNumPktLost
101      */
102     RtpDt_Void setCumNumPktLost(IN RtpDt_Int32 uiCumNumPktLost);
103 
104     /**
105      * get method for m_uiCumNumPktLost
106      */
107     RtpDt_Int32 getCumNumPktLost();
108 
109     /**
110      * set method for m_uiExtHighSeqRcv
111      */
112     RtpDt_Void setExtHighSeqRcv(IN RtpDt_UInt32 uiExtHighSeqRcv);
113 
114     /**
115      * get method for m_uiExtHighSeqRcv
116      */
117     RtpDt_UInt32 getExtHighSeqRcv();
118 
119     /**
120      * set method for m_uiJitter
121      */
122     RtpDt_Void setJitter(IN RtpDt_UInt32 uiJitter);
123 
124     /**
125      * get method for m_uiJitter
126      */
127     RtpDt_UInt32 getJitter();
128 
129     /**
130      * set method for m_uiLastSR
131      */
132     RtpDt_Void setLastSR(IN RtpDt_UInt32 uiLastSR);
133 
134     /**
135      * get method for m_uiLastSR
136      */
137     RtpDt_UInt32 getLastSR();
138 
139     /**
140      * set method for m_uiDelayLastSR
141      */
142     RtpDt_Void setDelayLastSR(IN RtpDt_UInt32 uiDelayLastSR);
143 
144     /**
145      * get method for m_uiDelayLastSR
146      */
147     RtpDt_UInt32 getDelayLastSR();
148 
149     /**
150      * Performs the decoding of RTCP Report Block
151      */
152     eRtp_Bool decodeReportBlock(IN RtpDt_UChar* pcRepBlkBuf);
153 
154     /**
155      * Performs the encoding of RTCP Report Block
156      */
157     eRtp_Bool formReportBlock(OUT RtpBuffer* pobjRtcpPktBuf);
158 
159 };  // end of RtcpReportBlock
160 
161 #endif  //__RTCP_REPORT_BLOCK_H__
162 
163 /** @}*/
164