blob: fad3b5e3329da66841f0d533f8b66ba66892c12c [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_
12#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_
13
pwestin@webrtc.org26f8d9c2012-01-19 15:53:09 +000014#include <map>
edjee@google.com79b02892013-04-04 19:43:34 +000015#include <sstream>
16#include <string>
pwestin@webrtc.org26f8d9c2012-01-19 15:53:09 +000017
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000018#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
19#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
wu@webrtc.org822fbd82013-08-15 23:38:54 +000020#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000021#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
22#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
23#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
24#include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h"
25#include "webrtc/system_wrappers/interface/scoped_ptr.h"
pbos@webrtc.org180e5162014-07-11 15:36:26 +000026#include "webrtc/system_wrappers/interface/thread_annotations.h"
pbos@webrtc.orga048d7c2013-05-29 14:27:38 +000027#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000028
29namespace webrtc {
pwestin@webrtc.org741da942011-09-20 13:52:04 +000030
wu@webrtc.org822fbd82013-08-15 23:38:54 +000031class ModuleRtpRtcpImpl;
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000032class RTCPReceiver;
pwestin@webrtc.org741da942011-09-20 13:52:04 +000033
edjee@google.com79b02892013-04-04 19:43:34 +000034class NACKStringBuilder
35{
36public:
37 NACKStringBuilder();
pbos@webrtc.orgf3e4cee2013-07-31 15:17:19 +000038 ~NACKStringBuilder();
39
pbos@webrtc.org2f446732013-04-08 11:08:41 +000040 void PushNACK(uint16_t nack);
edjee@google.com79b02892013-04-04 19:43:34 +000041 std::string GetResult();
42
43private:
44 std::ostringstream _stream;
45 int _count;
pbos@webrtc.org2f446732013-04-08 11:08:41 +000046 uint16_t _prevNack;
edjee@google.com79b02892013-04-04 19:43:34 +000047 bool _consecutive;
48};
49
niklase@google.com470e71d2011-07-07 08:21:25 +000050class RTCPSender
51{
52public:
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000053 struct FeedbackState {
54 explicit FeedbackState(ModuleRtpRtcpImpl* module);
55 FeedbackState();
56
57 uint8_t send_payload_type;
58 uint32_t frequency_hz;
59 uint32_t packet_count_sent;
60 uint32_t byte_count_sent;
61 uint32_t send_bitrate;
62
63 uint32_t last_rr_ntp_secs;
64 uint32_t last_rr_ntp_frac;
65 uint32_t remote_sr;
66
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +000067 bool has_last_xr_rr;
68 RtcpReceiveTimeInfo last_xr_rr;
69
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000070 // Used when generating TMMBR.
71 ModuleRtpRtcpImpl* module;
72 };
pbos@webrtc.org2f446732013-04-08 11:08:41 +000073 RTCPSender(const int32_t id, const bool audio,
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000074 Clock* clock,
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +000075 ReceiveStatistics* receive_statistics);
niklase@google.com470e71d2011-07-07 08:21:25 +000076 virtual ~RTCPSender();
77
pbos@webrtc.org2f446732013-04-08 11:08:41 +000078 int32_t RegisterSendTransport(Transport* outgoingTransport);
niklase@google.com470e71d2011-07-07 08:21:25 +000079
80 RTCPMethod Status() const;
pbos@webrtc.org2f446732013-04-08 11:08:41 +000081 int32_t SetRTCPStatus(const RTCPMethod method);
niklase@google.com470e71d2011-07-07 08:21:25 +000082
83 bool Sending() const;
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +000084 int32_t SetSendingStatus(const FeedbackState& feedback_state,
85 bool enabled); // combine the functions
niklase@google.com470e71d2011-07-07 08:21:25 +000086
pbos@webrtc.org2f446732013-04-08 11:08:41 +000087 int32_t SetNackStatus(const bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +000088
stefan@webrtc.org7c3523c2012-09-11 07:00:42 +000089 void SetStartTimestamp(uint32_t start_timestamp);
90
91 void SetLastRtpTime(uint32_t rtp_timestamp,
92 int64_t capture_time_ms);
93
pbos@webrtc.org2f446732013-04-08 11:08:41 +000094 void SetSSRC( const uint32_t ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000095
wu@webrtc.org822fbd82013-08-15 23:38:54 +000096 void SetRemoteSSRC(uint32_t ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000097
stefan@webrtc.org7da34592013-04-09 14:56:29 +000098 int32_t SetCameraDelay(const int32_t delayMS);
99
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000100 int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]);
niklase@google.com470e71d2011-07-07 08:21:25 +0000101
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000102 int32_t AddMixedCNAME(const uint32_t SSRC,
103 const char cName[RTCP_CNAME_SIZE]);
niklase@google.com470e71d2011-07-07 08:21:25 +0000104
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000105 int32_t RemoveMixedCNAME(const uint32_t SSRC);
niklase@google.com470e71d2011-07-07 08:21:25 +0000106
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000107 uint32_t SendTimeOfSendReport(const uint32_t sendReport);
niklase@google.com470e71d2011-07-07 08:21:25 +0000108
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000109 bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const;
110
niklase@google.com470e71d2011-07-07 08:21:25 +0000111 bool TimeToSendRTCPReport(const bool sendKeyframeBeforeRTP = false) const;
112
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000113 uint32_t LastSendReport(uint32_t& lastRTCPTime);
niklase@google.com470e71d2011-07-07 08:21:25 +0000114
wu@webrtc.org822fbd82013-08-15 23:38:54 +0000115 int32_t SendRTCP(
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +0000116 const FeedbackState& feedback_state,
wu@webrtc.org822fbd82013-08-15 23:38:54 +0000117 uint32_t rtcpPacketTypeFlags,
wu@webrtc.org822fbd82013-08-15 23:38:54 +0000118 int32_t nackSize = 0,
119 const uint16_t* nackList = 0,
120 bool repeat = false,
121 uint64_t pictureID = 0);
niklase@google.com470e71d2011-07-07 08:21:25 +0000122
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000123 int32_t AddExternalReportBlock(
124 uint32_t SSRC,
125 const RTCPReportBlock* receiveBlock);
niklase@google.com470e71d2011-07-07 08:21:25 +0000126
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000127 int32_t RemoveExternalReportBlock(uint32_t SSRC);
niklase@google.com470e71d2011-07-07 08:21:25 +0000128
129 /*
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000130 * REMB
131 */
132 bool REMB() const;
133
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000134 int32_t SetREMBStatus(const bool enable);
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000135
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000136 int32_t SetREMBData(const uint32_t bitrate,
137 const uint8_t numberOfSSRC,
138 const uint32_t* SSRC);
mflodman@webrtc.org84dc3d12011-12-22 10:26:13 +0000139
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000140 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000141 * TMMBR
142 */
143 bool TMMBR() const;
144
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000145 int32_t SetTMMBRStatus(const bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +0000146
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000147 int32_t SetTMMBN(const TMMBRSet* boundingSet,
148 const uint32_t maxBitrateKbit);
niklase@google.com470e71d2011-07-07 08:21:25 +0000149
niklase@google.com470e71d2011-07-07 08:21:25 +0000150 /*
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000151 * Extended jitter report
152 */
153 bool IJ() const;
154
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000155 int32_t SetIJStatus(const bool enable);
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000156
157 /*
niklase@google.com470e71d2011-07-07 08:21:25 +0000158 *
159 */
160
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000161 int32_t SetApplicationSpecificData(const uint8_t subType,
162 const uint32_t name,
163 const uint8_t* data,
164 const uint16_t length);
niklase@google.com470e71d2011-07-07 08:21:25 +0000165
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000166 int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
niklase@google.com470e71d2011-07-07 08:21:25 +0000167
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000168 void SendRtcpXrReceiverReferenceTime(bool enable);
169
asapersson@webrtc.org8d02f5d2013-11-21 08:57:04 +0000170 bool RtcpXrReceiverReferenceTime() const;
171
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000172 int32_t SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize],
173 const uint8_t arrLength);
niklase@google.com470e71d2011-07-07 08:21:25 +0000174
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000175 int32_t SetCSRCStatus(const bool include);
niklase@google.com470e71d2011-07-07 08:21:25 +0000176
stefan@webrtc.org9354cc92012-06-07 08:10:14 +0000177 void SetTargetBitrate(unsigned int target_bitrate);
mflodman@webrtc.org117c1192012-01-13 08:52:58 +0000178
asapersson@webrtc.org8098e072014-02-19 11:59:02 +0000179 void GetPacketTypeCounter(RtcpPacketTypeCounter* packet_counter) const;
180
niklase@google.com470e71d2011-07-07 08:21:25 +0000181private:
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000182 int32_t SendToNetwork(const uint8_t* dataBuffer, const uint16_t length);
niklase@google.com470e71d2011-07-07 08:21:25 +0000183
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000184 int32_t WriteAllReportBlocksToBuffer(uint8_t* rtcpbuffer,
185 int pos,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000186 uint8_t& numberOfReportBlocks,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000187 const uint32_t NTPsec,
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000188 const uint32_t NTPfrac)
189 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000190
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000191 int32_t WriteReportBlocksToBuffer(
192 uint8_t* rtcpbuffer,
193 int32_t position,
194 const std::map<uint32_t, RTCPReportBlock*>& report_blocks);
195
196 int32_t AddReportBlock(
197 uint32_t SSRC,
198 std::map<uint32_t, RTCPReportBlock*>* report_blocks,
199 const RTCPReportBlock* receiveBlock);
200
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +0000201 bool PrepareReport(const FeedbackState& feedback_state,
202 StreamStatistician* statistician,
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000203 RTCPReportBlock* report_block,
204 uint32_t* ntp_secs, uint32_t* ntp_frac);
205
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +0000206 int32_t BuildSR(const FeedbackState& feedback_state,
207 uint8_t* rtcpbuffer,
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000208 int& pos,
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +0000209 uint32_t NTPsec,
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000210 uint32_t NTPfrac)
211 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000212
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000213 int32_t BuildRR(uint8_t* rtcpbuffer,
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000214 int& pos,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000215 const uint32_t NTPsec,
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000216 const uint32_t NTPfrac)
217 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000218
219 int PrepareRTCP(
pbos@webrtc.org59f20bb2013-09-09 16:02:19 +0000220 const FeedbackState& feedback_state,
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000221 uint32_t packetTypeFlags,
222 int32_t nackSize,
223 const uint16_t* nackList,
224 bool repeat,
225 uint64_t pictureID,
226 uint8_t* rtcp_buffer,
227 int buffer_size);
228
229 bool ShouldSendReportBlocks(uint32_t rtcp_packet_type) const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000230
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000231 int32_t BuildExtendedJitterReport(
232 uint8_t* rtcpbuffer,
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000233 int& pos,
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000234 const uint32_t jitterTransmissionTimeOffset)
235 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000236
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000237 int32_t BuildSDEC(uint8_t* rtcpbuffer, int& pos)
238 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
239 int32_t BuildPLI(uint8_t* rtcpbuffer, int& pos)
240 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
241 int32_t BuildREMB(uint8_t* rtcpbuffer, int& pos)
242 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
243 int32_t BuildTMMBR(ModuleRtpRtcpImpl* module, uint8_t* rtcpbuffer, int& pos)
244 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
245 int32_t BuildTMMBN(uint8_t* rtcpbuffer, int& pos)
246 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
247 int32_t BuildAPP(uint8_t* rtcpbuffer, int& pos)
248 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
249 int32_t BuildVoIPMetric(uint8_t* rtcpbuffer, int& pos)
250 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
251 int32_t BuildBYE(uint8_t* rtcpbuffer, int& pos)
252 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
253 int32_t BuildFIR(uint8_t* rtcpbuffer, int& pos, bool repeat)
254 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
255 int32_t BuildSLI(uint8_t* rtcpbuffer, int& pos, const uint8_t pictureID)
256 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000257 int32_t BuildRPSI(uint8_t* rtcpbuffer,
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000258 int& pos,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000259 const uint64_t pictureID,
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000260 const uint8_t payloadType)
261 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000262
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000263 int32_t BuildNACK(uint8_t* rtcpbuffer,
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000264 int& pos,
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000265 const int32_t nackSize,
266 const uint16_t* nackList,
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000267 std::string* nackString)
268 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000269 int32_t BuildReceiverReferenceTime(uint8_t* buffer,
270 int& pos,
271 uint32_t ntp_sec,
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000272 uint32_t ntp_frac)
273 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000274 int32_t BuildDlrr(uint8_t* buffer,
275 int& pos,
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000276 const RtcpReceiveTimeInfo& info)
277 EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000278
niklase@google.com470e71d2011-07-07 08:21:25 +0000279private:
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000280 const int32_t _id;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000281 const bool _audio;
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000282 Clock* const _clock;
283 RTCPMethod _method GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000284
henrike@webrtc.org65573f22011-12-13 19:17:27 +0000285 CriticalSectionWrapper* _criticalSectionTransport;
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000286 Transport* _cbTransport GUARDED_BY(_criticalSectionTransport);
niklase@google.com470e71d2011-07-07 08:21:25 +0000287
henrike@webrtc.org65573f22011-12-13 19:17:27 +0000288 CriticalSectionWrapper* _criticalSectionRTCPSender;
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000289 bool _usingNack GUARDED_BY(_criticalSectionRTCPSender);
290 bool _sending GUARDED_BY(_criticalSectionRTCPSender);
291 bool _sendTMMBN GUARDED_BY(_criticalSectionRTCPSender);
292 bool _REMB GUARDED_BY(_criticalSectionRTCPSender);
293 bool _sendREMB GUARDED_BY(_criticalSectionRTCPSender);
294 bool _TMMBR GUARDED_BY(_criticalSectionRTCPSender);
295 bool _IJ GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000296
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000297 int64_t _nextTimeToSendRTCP GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000298
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000299 uint32_t start_timestamp_ GUARDED_BY(_criticalSectionRTCPSender);
300 uint32_t last_rtp_timestamp_ GUARDED_BY(_criticalSectionRTCPSender);
301 int64_t last_frame_capture_time_ms_ GUARDED_BY(_criticalSectionRTCPSender);
302 uint32_t _SSRC GUARDED_BY(_criticalSectionRTCPSender);
303 // SSRC that we receive on our RTP channel
304 uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPSender);
305 char _CNAME[RTCP_CNAME_SIZE] GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000306
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000307 ReceiveStatistics* receive_statistics_
308 GUARDED_BY(_criticalSectionRTCPSender);
309 std::map<uint32_t, RTCPReportBlock*> internal_report_blocks_
310 GUARDED_BY(_criticalSectionRTCPSender);
311 std::map<uint32_t, RTCPReportBlock*> external_report_blocks_
312 GUARDED_BY(_criticalSectionRTCPSender);
313 std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> _csrcCNAMEs
314 GUARDED_BY(_criticalSectionRTCPSender);
stefan@webrtc.org286fe0b2013-08-21 20:58:21 +0000315
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000316 int32_t _cameraDelayMS GUARDED_BY(_criticalSectionRTCPSender);
stefan@webrtc.org7da34592013-04-09 14:56:29 +0000317
niklase@google.com470e71d2011-07-07 08:21:25 +0000318 // Sent
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000319 uint32_t _lastSendReport[RTCP_NUMBER_OF_SR] GUARDED_BY(
320 _criticalSectionRTCPSender); // allow packet loss and RTT above 1 sec
321 uint32_t _lastRTCPTime[RTCP_NUMBER_OF_SR] GUARDED_BY(
322 _criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000323
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000324 // Sent XR receiver reference time report.
325 // <mid ntp (mid 32 bits of the 64 bits NTP timestamp), send time in ms>.
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000326 std::map<uint32_t, int64_t> last_xr_rr_
327 GUARDED_BY(_criticalSectionRTCPSender);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000328
niklase@google.com470e71d2011-07-07 08:21:25 +0000329 // send CSRCs
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000330 uint8_t _CSRCs GUARDED_BY(_criticalSectionRTCPSender);
331 uint32_t _CSRC[kRtpCsrcSize] GUARDED_BY(_criticalSectionRTCPSender);
332 bool _includeCSRCs GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000333
334 // Full intra request
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000335 uint8_t _sequenceNumberFIR GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000336
stefan@webrtc.org4ef438e2014-07-11 09:55:30 +0000337 // REMB
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000338 uint8_t _lengthRembSSRC GUARDED_BY(_criticalSectionRTCPSender);
339 uint8_t _sizeRembSSRC GUARDED_BY(_criticalSectionRTCPSender);
340 uint32_t* _rembSSRC GUARDED_BY(_criticalSectionRTCPSender);
341 uint32_t _rembBitrate GUARDED_BY(_criticalSectionRTCPSender);
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000342
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000343 TMMBRHelp _tmmbrHelp GUARDED_BY(_criticalSectionRTCPSender);
344 uint32_t _tmmbr_Send GUARDED_BY(_criticalSectionRTCPSender);
345 uint32_t _packetOH_Send GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000346
347 // APP
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000348 bool _appSend GUARDED_BY(_criticalSectionRTCPSender);
349 uint8_t _appSubType GUARDED_BY(_criticalSectionRTCPSender);
350 uint32_t _appName GUARDED_BY(_criticalSectionRTCPSender);
351 uint8_t* _appData GUARDED_BY(_criticalSectionRTCPSender);
352 uint16_t _appLength GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000353
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000354 // True if sending of XR Receiver reference time report is enabled.
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000355 bool xrSendReceiverReferenceTimeEnabled_
356 GUARDED_BY(_criticalSectionRTCPSender);
asapersson@webrtc.org8469f7b2013-10-02 13:15:34 +0000357
niklase@google.com470e71d2011-07-07 08:21:25 +0000358 // XR VoIP metric
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000359 bool _xrSendVoIPMetric GUARDED_BY(_criticalSectionRTCPSender);
360 RTCPVoIPMetric _xrVoIPMetric GUARDED_BY(_criticalSectionRTCPSender);
edjee@google.com79b02892013-04-04 19:43:34 +0000361
pbos@webrtc.org180e5162014-07-11 15:36:26 +0000362 RtcpPacketTypeCounter packet_type_counter_
363 GUARDED_BY(_criticalSectionRTCPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000364};
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +0000365} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +0000366
367#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_