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