niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 14 | #include <map> |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 15 | #include <sstream> |
| 16 | #include <string> |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 17 | |
pbos@webrtc.org | 38344ed | 2014-09-24 06:05:00 +0000 | [diff] [blame^] | 18 | #include "webrtc/base/thread_annotations.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 19 | #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
| 20 | #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 21 | #include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 22 | #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
| 23 | #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 24 | #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 25 | #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
| 26 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
| 27 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 28 | |
| 29 | namespace webrtc { |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 30 | |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 31 | class ModuleRtpRtcpImpl; |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 32 | class RTCPReceiver; |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 33 | |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 34 | class NACKStringBuilder |
| 35 | { |
| 36 | public: |
| 37 | NACKStringBuilder(); |
pbos@webrtc.org | f3e4cee | 2013-07-31 15:17:19 +0000 | [diff] [blame] | 38 | ~NACKStringBuilder(); |
| 39 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 40 | void PushNACK(uint16_t nack); |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 41 | std::string GetResult(); |
| 42 | |
| 43 | private: |
| 44 | std::ostringstream _stream; |
| 45 | int _count; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 46 | uint16_t _prevNack; |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 47 | bool _consecutive; |
| 48 | }; |
| 49 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 50 | class RTCPSender |
| 51 | { |
| 52 | public: |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 53 | struct FeedbackState { |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 54 | FeedbackState(); |
| 55 | |
| 56 | uint8_t send_payload_type; |
| 57 | uint32_t frequency_hz; |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 58 | uint32_t packets_sent; |
| 59 | uint32_t media_bytes_sent; |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 60 | uint32_t send_bitrate; |
| 61 | |
| 62 | uint32_t last_rr_ntp_secs; |
| 63 | uint32_t last_rr_ntp_frac; |
| 64 | uint32_t remote_sr; |
| 65 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 66 | bool has_last_xr_rr; |
| 67 | RtcpReceiveTimeInfo last_xr_rr; |
| 68 | |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 69 | // Used when generating TMMBR. |
| 70 | ModuleRtpRtcpImpl* module; |
| 71 | }; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 72 | RTCPSender(const int32_t id, const bool audio, |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 73 | Clock* clock, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 74 | ReceiveStatistics* receive_statistics); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 75 | virtual ~RTCPSender(); |
| 76 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 77 | int32_t RegisterSendTransport(Transport* outgoingTransport); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | |
| 79 | RTCPMethod Status() const; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 80 | int32_t SetRTCPStatus(const RTCPMethod method); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 81 | |
| 82 | bool Sending() const; |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 83 | int32_t SetSendingStatus(const FeedbackState& feedback_state, |
| 84 | bool enabled); // combine the functions |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 85 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 86 | int32_t SetNackStatus(const bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 87 | |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 88 | void SetStartTimestamp(uint32_t start_timestamp); |
| 89 | |
| 90 | void SetLastRtpTime(uint32_t rtp_timestamp, |
| 91 | int64_t capture_time_ms); |
| 92 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 93 | void SetSSRC( const uint32_t ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 94 | |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 95 | void SetRemoteSSRC(uint32_t ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 96 | |
stefan@webrtc.org | 7da3459 | 2013-04-09 14:56:29 +0000 | [diff] [blame] | 97 | int32_t SetCameraDelay(const int32_t delayMS); |
| 98 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 99 | int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 100 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 101 | int32_t AddMixedCNAME(const uint32_t SSRC, |
| 102 | const char cName[RTCP_CNAME_SIZE]); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 103 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 104 | int32_t RemoveMixedCNAME(const uint32_t SSRC); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 105 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 106 | uint32_t SendTimeOfSendReport(const uint32_t sendReport); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 108 | bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const; |
| 109 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 110 | bool TimeToSendRTCPReport(const bool sendKeyframeBeforeRTP = false) const; |
| 111 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 112 | uint32_t LastSendReport(uint32_t& lastRTCPTime); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 113 | |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 114 | int32_t SendRTCP( |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 115 | const FeedbackState& feedback_state, |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 116 | uint32_t rtcpPacketTypeFlags, |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 117 | int32_t nackSize = 0, |
| 118 | const uint16_t* nackList = 0, |
| 119 | bool repeat = false, |
| 120 | uint64_t pictureID = 0); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 121 | |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 122 | int32_t AddExternalReportBlock( |
| 123 | uint32_t SSRC, |
| 124 | const RTCPReportBlock* receiveBlock); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 125 | |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 126 | int32_t RemoveExternalReportBlock(uint32_t SSRC); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 127 | |
| 128 | /* |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 129 | * REMB |
| 130 | */ |
| 131 | bool REMB() const; |
| 132 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 133 | int32_t SetREMBStatus(const bool enable); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 134 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 135 | int32_t SetREMBData(const uint32_t bitrate, |
| 136 | const uint8_t numberOfSSRC, |
| 137 | const uint32_t* SSRC); |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 138 | |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 139 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 140 | * TMMBR |
| 141 | */ |
| 142 | bool TMMBR() const; |
| 143 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 144 | int32_t SetTMMBRStatus(const bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 145 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 146 | int32_t SetTMMBN(const TMMBRSet* boundingSet, |
| 147 | const uint32_t maxBitrateKbit); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 148 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 149 | /* |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 150 | * Extended jitter report |
| 151 | */ |
| 152 | bool IJ() const; |
| 153 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 154 | int32_t SetIJStatus(const bool enable); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 155 | |
| 156 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 157 | * |
| 158 | */ |
| 159 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 160 | int32_t SetApplicationSpecificData(const uint8_t subType, |
| 161 | const uint32_t name, |
| 162 | const uint8_t* data, |
| 163 | const uint16_t length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 164 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 165 | int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 166 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 167 | void SendRtcpXrReceiverReferenceTime(bool enable); |
| 168 | |
asapersson@webrtc.org | 8d02f5d | 2013-11-21 08:57:04 +0000 | [diff] [blame] | 169 | bool RtcpXrReceiverReferenceTime() const; |
| 170 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 171 | int32_t SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize], |
| 172 | const uint8_t arrLength); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 173 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 174 | int32_t SetCSRCStatus(const bool include); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 175 | |
stefan@webrtc.org | 9354cc9 | 2012-06-07 08:10:14 +0000 | [diff] [blame] | 176 | void SetTargetBitrate(unsigned int target_bitrate); |
mflodman@webrtc.org | 117c119 | 2012-01-13 08:52:58 +0000 | [diff] [blame] | 177 | |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 178 | void GetPacketTypeCounter(RtcpPacketTypeCounter* packet_counter) const; |
| 179 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 180 | private: |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 181 | int32_t SendToNetwork(const uint8_t* dataBuffer, const uint16_t length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 182 | |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 183 | int32_t WriteAllReportBlocksToBuffer(uint8_t* rtcpbuffer, |
| 184 | int pos, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 185 | uint8_t& numberOfReportBlocks, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 186 | const uint32_t NTPsec, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 187 | const uint32_t NTPfrac) |
| 188 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 189 | |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 190 | int32_t WriteReportBlocksToBuffer( |
| 191 | uint8_t* rtcpbuffer, |
| 192 | int32_t position, |
| 193 | const std::map<uint32_t, RTCPReportBlock*>& report_blocks); |
| 194 | |
| 195 | int32_t AddReportBlock( |
| 196 | uint32_t SSRC, |
| 197 | std::map<uint32_t, RTCPReportBlock*>* report_blocks, |
| 198 | const RTCPReportBlock* receiveBlock); |
| 199 | |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 200 | bool PrepareReport(const FeedbackState& feedback_state, |
| 201 | StreamStatistician* statistician, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 202 | RTCPReportBlock* report_block, |
| 203 | uint32_t* ntp_secs, uint32_t* ntp_frac); |
| 204 | |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 205 | int32_t BuildSR(const FeedbackState& feedback_state, |
| 206 | uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 207 | int& pos, |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 208 | uint32_t NTPsec, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 209 | uint32_t NTPfrac) |
| 210 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 211 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 212 | int32_t BuildRR(uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 213 | int& pos, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 214 | const uint32_t NTPsec, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 215 | const uint32_t NTPfrac) |
| 216 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 217 | |
| 218 | int PrepareRTCP( |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 219 | const FeedbackState& feedback_state, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 220 | uint32_t packetTypeFlags, |
| 221 | int32_t nackSize, |
| 222 | const uint16_t* nackList, |
| 223 | bool repeat, |
| 224 | uint64_t pictureID, |
| 225 | uint8_t* rtcp_buffer, |
| 226 | int buffer_size); |
| 227 | |
| 228 | bool ShouldSendReportBlocks(uint32_t rtcp_packet_type) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 229 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 230 | int32_t BuildExtendedJitterReport( |
| 231 | uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 232 | int& pos, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 233 | const uint32_t jitterTransmissionTimeOffset) |
| 234 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 235 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 236 | int32_t BuildSDEC(uint8_t* rtcpbuffer, int& pos) |
| 237 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 238 | int32_t BuildPLI(uint8_t* rtcpbuffer, int& pos) |
| 239 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 240 | int32_t BuildREMB(uint8_t* rtcpbuffer, int& pos) |
| 241 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 242 | int32_t BuildTMMBR(ModuleRtpRtcpImpl* module, uint8_t* rtcpbuffer, int& pos) |
| 243 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 244 | int32_t BuildTMMBN(uint8_t* rtcpbuffer, int& pos) |
| 245 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 246 | int32_t BuildAPP(uint8_t* rtcpbuffer, int& pos) |
| 247 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 248 | int32_t BuildVoIPMetric(uint8_t* rtcpbuffer, int& pos) |
| 249 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 250 | int32_t BuildBYE(uint8_t* rtcpbuffer, int& pos) |
| 251 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 252 | int32_t BuildFIR(uint8_t* rtcpbuffer, int& pos, bool repeat) |
| 253 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 254 | int32_t BuildSLI(uint8_t* rtcpbuffer, int& pos, const uint8_t pictureID) |
| 255 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 256 | int32_t BuildRPSI(uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 257 | int& pos, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 258 | const uint64_t pictureID, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 259 | const uint8_t payloadType) |
| 260 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 261 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 262 | int32_t BuildNACK(uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 263 | int& pos, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 264 | const int32_t nackSize, |
| 265 | const uint16_t* nackList, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 266 | std::string* nackString) |
| 267 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 268 | int32_t BuildReceiverReferenceTime(uint8_t* buffer, |
| 269 | int& pos, |
| 270 | uint32_t ntp_sec, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 271 | uint32_t ntp_frac) |
| 272 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 273 | int32_t BuildDlrr(uint8_t* buffer, |
| 274 | int& pos, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 275 | const RtcpReceiveTimeInfo& info) |
| 276 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 277 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 278 | private: |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 279 | const int32_t _id; |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 280 | const bool _audio; |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 281 | Clock* const _clock; |
| 282 | RTCPMethod _method GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 283 | |
henrike@webrtc.org | 65573f2 | 2011-12-13 19:17:27 +0000 | [diff] [blame] | 284 | CriticalSectionWrapper* _criticalSectionTransport; |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 285 | Transport* _cbTransport GUARDED_BY(_criticalSectionTransport); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 286 | |
henrike@webrtc.org | 65573f2 | 2011-12-13 19:17:27 +0000 | [diff] [blame] | 287 | CriticalSectionWrapper* _criticalSectionRTCPSender; |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 288 | bool _usingNack GUARDED_BY(_criticalSectionRTCPSender); |
| 289 | bool _sending GUARDED_BY(_criticalSectionRTCPSender); |
| 290 | bool _sendTMMBN GUARDED_BY(_criticalSectionRTCPSender); |
| 291 | bool _REMB GUARDED_BY(_criticalSectionRTCPSender); |
| 292 | bool _sendREMB GUARDED_BY(_criticalSectionRTCPSender); |
| 293 | bool _TMMBR GUARDED_BY(_criticalSectionRTCPSender); |
| 294 | bool _IJ GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 295 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 296 | int64_t _nextTimeToSendRTCP GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 297 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 298 | uint32_t start_timestamp_ GUARDED_BY(_criticalSectionRTCPSender); |
| 299 | uint32_t last_rtp_timestamp_ GUARDED_BY(_criticalSectionRTCPSender); |
| 300 | int64_t last_frame_capture_time_ms_ GUARDED_BY(_criticalSectionRTCPSender); |
| 301 | uint32_t _SSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 302 | // SSRC that we receive on our RTP channel |
| 303 | uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 304 | char _CNAME[RTCP_CNAME_SIZE] GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 305 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 306 | ReceiveStatistics* receive_statistics_ |
| 307 | GUARDED_BY(_criticalSectionRTCPSender); |
| 308 | std::map<uint32_t, RTCPReportBlock*> internal_report_blocks_ |
| 309 | GUARDED_BY(_criticalSectionRTCPSender); |
| 310 | std::map<uint32_t, RTCPReportBlock*> external_report_blocks_ |
| 311 | GUARDED_BY(_criticalSectionRTCPSender); |
| 312 | std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> _csrcCNAMEs |
| 313 | GUARDED_BY(_criticalSectionRTCPSender); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 314 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 315 | int32_t _cameraDelayMS GUARDED_BY(_criticalSectionRTCPSender); |
stefan@webrtc.org | 7da3459 | 2013-04-09 14:56:29 +0000 | [diff] [blame] | 316 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 317 | // Sent |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 318 | uint32_t _lastSendReport[RTCP_NUMBER_OF_SR] GUARDED_BY( |
| 319 | _criticalSectionRTCPSender); // allow packet loss and RTT above 1 sec |
| 320 | uint32_t _lastRTCPTime[RTCP_NUMBER_OF_SR] GUARDED_BY( |
| 321 | _criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 322 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 323 | // Sent XR receiver reference time report. |
| 324 | // <mid ntp (mid 32 bits of the 64 bits NTP timestamp), send time in ms>. |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 325 | std::map<uint32_t, int64_t> last_xr_rr_ |
| 326 | GUARDED_BY(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 327 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 328 | // send CSRCs |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 329 | uint8_t _CSRCs GUARDED_BY(_criticalSectionRTCPSender); |
| 330 | uint32_t _CSRC[kRtpCsrcSize] GUARDED_BY(_criticalSectionRTCPSender); |
| 331 | bool _includeCSRCs GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 332 | |
| 333 | // Full intra request |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 334 | uint8_t _sequenceNumberFIR GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 335 | |
stefan@webrtc.org | 4ef438e | 2014-07-11 09:55:30 +0000 | [diff] [blame] | 336 | // REMB |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 337 | uint8_t _lengthRembSSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 338 | uint8_t _sizeRembSSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 339 | uint32_t* _rembSSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 340 | uint32_t _rembBitrate GUARDED_BY(_criticalSectionRTCPSender); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 341 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 342 | TMMBRHelp _tmmbrHelp GUARDED_BY(_criticalSectionRTCPSender); |
| 343 | uint32_t _tmmbr_Send GUARDED_BY(_criticalSectionRTCPSender); |
| 344 | uint32_t _packetOH_Send GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 345 | |
| 346 | // APP |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 347 | bool _appSend GUARDED_BY(_criticalSectionRTCPSender); |
| 348 | uint8_t _appSubType GUARDED_BY(_criticalSectionRTCPSender); |
| 349 | uint32_t _appName GUARDED_BY(_criticalSectionRTCPSender); |
| 350 | uint8_t* _appData GUARDED_BY(_criticalSectionRTCPSender); |
| 351 | uint16_t _appLength GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 352 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 353 | // True if sending of XR Receiver reference time report is enabled. |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 354 | bool xrSendReceiverReferenceTimeEnabled_ |
| 355 | GUARDED_BY(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 356 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 357 | // XR VoIP metric |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 358 | bool _xrSendVoIPMetric GUARDED_BY(_criticalSectionRTCPSender); |
| 359 | RTCPVoIPMetric _xrVoIPMetric GUARDED_BY(_criticalSectionRTCPSender); |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 360 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 361 | RtcpPacketTypeCounter packet_type_counter_ |
| 362 | GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 363 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 364 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 365 | |
| 366 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |