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; |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 59 | size_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, |
pbos@webrtc.org | 49ff40e | 2014-11-13 14:42:37 +0000 | [diff] [blame] | 136 | const std::vector<uint32_t>& ssrcs); |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 137 | |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 138 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 139 | * TMMBR |
| 140 | */ |
| 141 | bool TMMBR() const; |
| 142 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 143 | int32_t SetTMMBRStatus(const bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 144 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 145 | int32_t SetTMMBN(const TMMBRSet* boundingSet, |
| 146 | const uint32_t maxBitrateKbit); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 147 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 148 | /* |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 149 | * Extended jitter report |
| 150 | */ |
| 151 | bool IJ() const; |
| 152 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 153 | int32_t SetIJStatus(const bool enable); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 154 | |
| 155 | /* |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 156 | * |
| 157 | */ |
| 158 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 159 | int32_t SetApplicationSpecificData(const uint8_t subType, |
| 160 | const uint32_t name, |
| 161 | const uint8_t* data, |
| 162 | const uint16_t length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 163 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 164 | int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 165 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 166 | void SendRtcpXrReceiverReferenceTime(bool enable); |
| 167 | |
asapersson@webrtc.org | 8d02f5d | 2013-11-21 08:57:04 +0000 | [diff] [blame] | 168 | bool RtcpXrReceiverReferenceTime() const; |
| 169 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 170 | int32_t SetCSRCs(const uint32_t arrOfCSRC[kRtpCsrcSize], |
| 171 | const uint8_t arrLength); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 172 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 173 | int32_t SetCSRCStatus(const bool include); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 174 | |
stefan@webrtc.org | 9354cc9 | 2012-06-07 08:10:14 +0000 | [diff] [blame] | 175 | void SetTargetBitrate(unsigned int target_bitrate); |
mflodman@webrtc.org | 117c119 | 2012-01-13 08:52:58 +0000 | [diff] [blame] | 176 | |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 177 | void GetPacketTypeCounter(RtcpPacketTypeCounter* packet_counter) const; |
| 178 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 179 | private: |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 180 | int32_t SendToNetwork(const uint8_t* dataBuffer, const size_t length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 181 | |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 182 | int32_t WriteAllReportBlocksToBuffer(uint8_t* rtcpbuffer, |
| 183 | int pos, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 184 | uint8_t& numberOfReportBlocks, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 185 | const uint32_t NTPsec, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 186 | const uint32_t NTPfrac) |
| 187 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 188 | |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 189 | int32_t WriteReportBlocksToBuffer( |
| 190 | uint8_t* rtcpbuffer, |
| 191 | int32_t position, |
| 192 | const std::map<uint32_t, RTCPReportBlock*>& report_blocks); |
| 193 | |
| 194 | int32_t AddReportBlock( |
| 195 | uint32_t SSRC, |
| 196 | std::map<uint32_t, RTCPReportBlock*>* report_blocks, |
| 197 | const RTCPReportBlock* receiveBlock); |
| 198 | |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 199 | bool PrepareReport(const FeedbackState& feedback_state, |
| 200 | StreamStatistician* statistician, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 201 | RTCPReportBlock* report_block, |
| 202 | uint32_t* ntp_secs, uint32_t* ntp_frac); |
| 203 | |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 204 | int32_t BuildSR(const FeedbackState& feedback_state, |
| 205 | uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 206 | int& pos, |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 207 | uint32_t NTPsec, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 208 | uint32_t NTPfrac) |
| 209 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 210 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 211 | int32_t BuildRR(uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 212 | int& pos, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 213 | const uint32_t NTPsec, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 214 | const uint32_t NTPfrac) |
| 215 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 216 | |
| 217 | int PrepareRTCP( |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 218 | const FeedbackState& feedback_state, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 219 | uint32_t packetTypeFlags, |
| 220 | int32_t nackSize, |
| 221 | const uint16_t* nackList, |
| 222 | bool repeat, |
| 223 | uint64_t pictureID, |
| 224 | uint8_t* rtcp_buffer, |
| 225 | int buffer_size); |
| 226 | |
| 227 | bool ShouldSendReportBlocks(uint32_t rtcp_packet_type) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 228 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 229 | int32_t BuildExtendedJitterReport( |
| 230 | uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 231 | int& pos, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 232 | const uint32_t jitterTransmissionTimeOffset) |
| 233 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 234 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 235 | int32_t BuildSDEC(uint8_t* rtcpbuffer, int& pos) |
| 236 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 237 | int32_t BuildPLI(uint8_t* rtcpbuffer, int& pos) |
| 238 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 239 | int32_t BuildREMB(uint8_t* rtcpbuffer, int& pos) |
| 240 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 241 | int32_t BuildTMMBR(ModuleRtpRtcpImpl* module, uint8_t* rtcpbuffer, int& pos) |
| 242 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 243 | int32_t BuildTMMBN(uint8_t* rtcpbuffer, int& pos) |
| 244 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 245 | int32_t BuildAPP(uint8_t* rtcpbuffer, int& pos) |
| 246 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 247 | int32_t BuildVoIPMetric(uint8_t* rtcpbuffer, int& pos) |
| 248 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 249 | int32_t BuildBYE(uint8_t* rtcpbuffer, int& pos) |
| 250 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 251 | int32_t BuildFIR(uint8_t* rtcpbuffer, int& pos, bool repeat) |
| 252 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 253 | int32_t BuildSLI(uint8_t* rtcpbuffer, int& pos, const uint8_t pictureID) |
| 254 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 255 | int32_t BuildRPSI(uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 256 | int& pos, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 257 | const uint64_t pictureID, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 258 | const uint8_t payloadType) |
| 259 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 260 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 261 | int32_t BuildNACK(uint8_t* rtcpbuffer, |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 262 | int& pos, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 263 | const int32_t nackSize, |
| 264 | const uint16_t* nackList, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 265 | std::string* nackString) |
| 266 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 267 | int32_t BuildReceiverReferenceTime(uint8_t* buffer, |
| 268 | int& pos, |
| 269 | uint32_t ntp_sec, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 270 | uint32_t ntp_frac) |
| 271 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 272 | int32_t BuildDlrr(uint8_t* buffer, |
| 273 | int& pos, |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 274 | const RtcpReceiveTimeInfo& info) |
| 275 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 276 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 277 | private: |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 278 | const int32_t _id; |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 279 | const bool _audio; |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 280 | Clock* const _clock; |
| 281 | RTCPMethod _method GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 282 | |
henrike@webrtc.org | 65573f2 | 2011-12-13 19:17:27 +0000 | [diff] [blame] | 283 | CriticalSectionWrapper* _criticalSectionTransport; |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 284 | Transport* _cbTransport GUARDED_BY(_criticalSectionTransport); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 285 | |
henrike@webrtc.org | 65573f2 | 2011-12-13 19:17:27 +0000 | [diff] [blame] | 286 | CriticalSectionWrapper* _criticalSectionRTCPSender; |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 287 | bool _usingNack GUARDED_BY(_criticalSectionRTCPSender); |
| 288 | bool _sending GUARDED_BY(_criticalSectionRTCPSender); |
| 289 | bool _sendTMMBN GUARDED_BY(_criticalSectionRTCPSender); |
| 290 | bool _REMB GUARDED_BY(_criticalSectionRTCPSender); |
| 291 | bool _sendREMB GUARDED_BY(_criticalSectionRTCPSender); |
| 292 | bool _TMMBR GUARDED_BY(_criticalSectionRTCPSender); |
| 293 | bool _IJ GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 294 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 295 | int64_t _nextTimeToSendRTCP GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 296 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 297 | uint32_t start_timestamp_ GUARDED_BY(_criticalSectionRTCPSender); |
| 298 | uint32_t last_rtp_timestamp_ GUARDED_BY(_criticalSectionRTCPSender); |
| 299 | int64_t last_frame_capture_time_ms_ GUARDED_BY(_criticalSectionRTCPSender); |
| 300 | uint32_t _SSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 301 | // SSRC that we receive on our RTP channel |
| 302 | uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 303 | char _CNAME[RTCP_CNAME_SIZE] GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 304 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 305 | ReceiveStatistics* receive_statistics_ |
| 306 | GUARDED_BY(_criticalSectionRTCPSender); |
| 307 | std::map<uint32_t, RTCPReportBlock*> internal_report_blocks_ |
| 308 | GUARDED_BY(_criticalSectionRTCPSender); |
| 309 | std::map<uint32_t, RTCPReportBlock*> external_report_blocks_ |
| 310 | GUARDED_BY(_criticalSectionRTCPSender); |
| 311 | std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> _csrcCNAMEs |
| 312 | GUARDED_BY(_criticalSectionRTCPSender); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 313 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 314 | int32_t _cameraDelayMS GUARDED_BY(_criticalSectionRTCPSender); |
stefan@webrtc.org | 7da3459 | 2013-04-09 14:56:29 +0000 | [diff] [blame] | 315 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 316 | // Sent |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 317 | uint32_t _lastSendReport[RTCP_NUMBER_OF_SR] GUARDED_BY( |
| 318 | _criticalSectionRTCPSender); // allow packet loss and RTT above 1 sec |
| 319 | uint32_t _lastRTCPTime[RTCP_NUMBER_OF_SR] GUARDED_BY( |
| 320 | _criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 321 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 322 | // Sent XR receiver reference time report. |
| 323 | // <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] | 324 | std::map<uint32_t, int64_t> last_xr_rr_ |
| 325 | GUARDED_BY(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 326 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 327 | // send CSRCs |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 328 | uint8_t _CSRCs GUARDED_BY(_criticalSectionRTCPSender); |
| 329 | uint32_t _CSRC[kRtpCsrcSize] GUARDED_BY(_criticalSectionRTCPSender); |
| 330 | bool _includeCSRCs GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 331 | |
| 332 | // Full intra request |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 333 | uint8_t _sequenceNumberFIR GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 334 | |
stefan@webrtc.org | 4ef438e | 2014-07-11 09:55:30 +0000 | [diff] [blame] | 335 | // REMB |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 336 | uint32_t _rembBitrate GUARDED_BY(_criticalSectionRTCPSender); |
pbos@webrtc.org | 49ff40e | 2014-11-13 14:42:37 +0000 | [diff] [blame] | 337 | std::vector<uint32_t> remb_ssrcs_ GUARDED_BY(_criticalSectionRTCPSender); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 338 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 339 | TMMBRHelp _tmmbrHelp GUARDED_BY(_criticalSectionRTCPSender); |
| 340 | uint32_t _tmmbr_Send GUARDED_BY(_criticalSectionRTCPSender); |
| 341 | uint32_t _packetOH_Send GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 342 | |
| 343 | // APP |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 344 | bool _appSend GUARDED_BY(_criticalSectionRTCPSender); |
| 345 | uint8_t _appSubType GUARDED_BY(_criticalSectionRTCPSender); |
| 346 | uint32_t _appName GUARDED_BY(_criticalSectionRTCPSender); |
| 347 | uint8_t* _appData GUARDED_BY(_criticalSectionRTCPSender); |
| 348 | uint16_t _appLength GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 349 | |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 350 | // True if sending of XR Receiver reference time report is enabled. |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 351 | bool xrSendReceiverReferenceTimeEnabled_ |
| 352 | GUARDED_BY(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 353 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 354 | // XR VoIP metric |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 355 | bool _xrSendVoIPMetric GUARDED_BY(_criticalSectionRTCPSender); |
| 356 | RTCPVoIPMetric _xrVoIPMetric GUARDED_BY(_criticalSectionRTCPSender); |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 357 | |
pbos@webrtc.org | 180e516 | 2014-07-11 15:36:26 +0000 | [diff] [blame] | 358 | RtcpPacketTypeCounter packet_type_counter_ |
| 359 | GUARDED_BY(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 +0000 | [diff] [blame] | 360 | |
| 361 | RTCPUtility::NackStats nack_stats_ GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 362 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 363 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 364 | |
| 365 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |