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