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