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 | |
kwiberg@webrtc.org | 00b8f6b | 2015-02-26 14:34:55 +0000 | [diff] [blame] | 18 | #include "webrtc/base/scoped_ptr.h" |
pbos@webrtc.org | 38344ed | 2014-09-24 06:05:00 +0000 | [diff] [blame] | 19 | #include "webrtc/base/thread_annotations.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 20 | #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
| 21 | #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 22 | #include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 23 | #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
| 24 | #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 25 | #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 26 | #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 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 | }; |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 70 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 71 | RTCPSender(int32_t id, |
| 72 | bool audio, |
| 73 | Clock* clock, |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 +0000 | [diff] [blame] | 74 | ReceiveStatistics* receive_statistics, |
| 75 | RtcpPacketTypeCounterObserver* packet_type_counter_observer); |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 76 | virtual ~RTCPSender(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 77 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 78 | int32_t RegisterSendTransport(Transport* outgoingTransport); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 79 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 80 | RTCPMethod Status() const; |
| 81 | void SetRTCPStatus(RTCPMethod method); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 82 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 83 | bool Sending() const; |
| 84 | int32_t SetSendingStatus(const FeedbackState& feedback_state, |
| 85 | bool enabled); // combine the functions |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 86 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 87 | int32_t SetNackStatus(bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 88 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 89 | void SetStartTimestamp(uint32_t start_timestamp); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 90 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 91 | void SetLastRtpTime(uint32_t rtp_timestamp, int64_t capture_time_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 92 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 93 | void SetSSRC(uint32_t ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 94 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 95 | void SetRemoteSSRC(uint32_t ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 96 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [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 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [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 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 101 | int32_t RemoveMixedCNAME(uint32_t SSRC); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 102 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 103 | int64_t SendTimeOfSendReport(uint32_t sendReport); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 104 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 105 | bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const; |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 106 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 107 | bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 108 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 109 | int32_t SendRTCP(const FeedbackState& feedback_state, |
| 110 | uint32_t rtcpPacketTypeFlags, |
| 111 | int32_t nackSize = 0, |
| 112 | const uint16_t* nackList = 0, |
| 113 | bool repeat = false, |
| 114 | uint64_t pictureID = 0); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 115 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 116 | int32_t AddExternalReportBlock(uint32_t SSRC, |
| 117 | const RTCPReportBlock* receiveBlock); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 118 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 119 | int32_t RemoveExternalReportBlock(uint32_t SSRC); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 120 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 121 | bool REMB() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 122 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 123 | void SetREMBStatus(bool enable); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 124 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 125 | void SetREMBData(uint32_t bitrate, const std::vector<uint32_t>& ssrcs); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 126 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 127 | bool TMMBR() const; |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 128 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 129 | void SetTMMBRStatus(bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 130 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 131 | int32_t SetTMMBN(const TMMBRSet* boundingSet, uint32_t maxBitrateKbit); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 132 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 133 | // Extended jitter report |
| 134 | bool IJ() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 135 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 136 | void SetIJStatus(bool enable); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 137 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 138 | int32_t SetApplicationSpecificData(uint8_t subType, |
| 139 | uint32_t name, |
| 140 | const uint8_t* data, |
| 141 | uint16_t length); |
| 142 | int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 143 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 144 | void SendRtcpXrReceiverReferenceTime(bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 145 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 146 | bool RtcpXrReceiverReferenceTime() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 147 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 148 | void SetCsrcs(const std::vector<uint32_t>& csrcs); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 149 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 150 | void SetTargetBitrate(unsigned int target_bitrate); |
mflodman@webrtc.org | 117c119 | 2012-01-13 08:52:58 +0000 | [diff] [blame] | 151 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 152 | private: |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 153 | int32_t SendToNetwork(const uint8_t* dataBuffer, size_t length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 154 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 155 | int32_t WriteAllReportBlocksToBuffer(uint8_t* rtcpbuffer, |
| 156 | int pos, |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 157 | uint8_t* numberOfReportBlocks, |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 158 | uint32_t NTPsec, |
| 159 | uint32_t NTPfrac) |
| 160 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 161 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 162 | int32_t WriteReportBlocksToBuffer( |
| 163 | uint8_t* rtcpbuffer, |
| 164 | int32_t position, |
| 165 | const std::map<uint32_t, RTCPReportBlock*>& report_blocks); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 166 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 167 | int32_t AddReportBlock(uint32_t SSRC, |
| 168 | std::map<uint32_t, RTCPReportBlock*>* report_blocks, |
| 169 | const RTCPReportBlock* receiveBlock); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 170 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 171 | bool PrepareReport(const FeedbackState& feedback_state, |
| 172 | StreamStatistician* statistician, |
| 173 | RTCPReportBlock* report_block, |
| 174 | uint32_t* ntp_secs, |
| 175 | uint32_t* ntp_frac); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 176 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 177 | int32_t BuildSR(const FeedbackState& feedback_state, |
| 178 | uint8_t* rtcpbuffer, |
| 179 | int32_t pos, |
| 180 | uint32_t NTPsec, |
| 181 | uint32_t NTPfrac) |
| 182 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 183 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 184 | int32_t BuildRR(uint8_t* rtcpbuffer, |
| 185 | int32_t pos, |
| 186 | uint32_t NTPsec, |
| 187 | uint32_t NTPfrac) |
| 188 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 189 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 190 | int PrepareRTCP(const FeedbackState& feedback_state, |
| 191 | uint32_t packetTypeFlags, |
| 192 | int32_t nackSize, |
| 193 | const uint16_t* nackList, |
| 194 | bool repeat, |
| 195 | uint64_t pictureID, |
| 196 | uint8_t* rtcp_buffer, |
| 197 | int buffer_size); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 198 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 199 | bool ShouldSendReportBlocks(uint32_t rtcp_packet_type) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 200 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 201 | int32_t BuildExtendedJitterReport(uint8_t* rtcpbuffer, |
| 202 | int32_t pos, |
| 203 | uint32_t jitterTransmissionTimeOffset) |
| 204 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 205 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 206 | int32_t BuildSDEC(uint8_t* rtcpbuffer, int32_t pos) |
| 207 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 208 | int32_t BuildPLI(uint8_t* rtcpbuffer, int32_t pos) |
| 209 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 210 | int32_t BuildREMB(uint8_t* rtcpbuffer, int32_t pos) |
| 211 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 212 | int32_t BuildTMMBR(ModuleRtpRtcpImpl* module, uint8_t* rtcpbuffer, int32_t pos) |
| 213 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 214 | int32_t BuildTMMBN(uint8_t* rtcpbuffer, int32_t pos) |
| 215 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 216 | int32_t BuildAPP(uint8_t* rtcpbuffer, int32_t pos) |
| 217 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 218 | int32_t BuildVoIPMetric(uint8_t* rtcpbuffer, int32_t pos) |
| 219 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 220 | int32_t BuildBYE(uint8_t* rtcpbuffer, int32_t pos) |
| 221 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 222 | int32_t BuildFIR(uint8_t* rtcpbuffer, int32_t pos, bool repeat) |
| 223 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 224 | int32_t BuildSLI(uint8_t* rtcpbuffer, int32_t pos, uint8_t pictureID) |
| 225 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 226 | int32_t BuildRPSI(uint8_t* rtcpbuffer, |
| 227 | int32_t pos, |
| 228 | uint64_t pictureID, |
| 229 | uint8_t payloadType) |
| 230 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 231 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 232 | int32_t BuildNACK(uint8_t* rtcpbuffer, |
| 233 | int32_t pos, |
| 234 | int32_t nackSize, |
| 235 | const uint16_t* nackList, |
| 236 | std::string* nackString) |
| 237 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 238 | int32_t BuildReceiverReferenceTime(uint8_t* buffer, |
| 239 | int32_t pos, |
| 240 | uint32_t ntp_sec, |
| 241 | uint32_t ntp_frac) |
| 242 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
| 243 | int32_t BuildDlrr(uint8_t* buffer, |
| 244 | int32_t pos, |
| 245 | const RtcpReceiveTimeInfo& info) |
| 246 | EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 247 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 248 | private: |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 249 | const int32_t _id; |
| 250 | const bool _audio; |
| 251 | Clock* const _clock; |
| 252 | RTCPMethod _method GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 253 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 254 | rtc::scoped_ptr<CriticalSectionWrapper> _criticalSectionTransport; |
| 255 | Transport* _cbTransport GUARDED_BY(_criticalSectionTransport); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 256 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 257 | rtc::scoped_ptr<CriticalSectionWrapper> _criticalSectionRTCPSender; |
| 258 | bool _usingNack GUARDED_BY(_criticalSectionRTCPSender); |
| 259 | bool _sending GUARDED_BY(_criticalSectionRTCPSender); |
| 260 | bool _sendTMMBN GUARDED_BY(_criticalSectionRTCPSender); |
| 261 | bool _REMB GUARDED_BY(_criticalSectionRTCPSender); |
| 262 | bool _sendREMB GUARDED_BY(_criticalSectionRTCPSender); |
| 263 | bool _TMMBR GUARDED_BY(_criticalSectionRTCPSender); |
| 264 | bool _IJ GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 265 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 266 | int64_t _nextTimeToSendRTCP GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 267 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 268 | uint32_t start_timestamp_ GUARDED_BY(_criticalSectionRTCPSender); |
| 269 | uint32_t last_rtp_timestamp_ GUARDED_BY(_criticalSectionRTCPSender); |
| 270 | int64_t last_frame_capture_time_ms_ GUARDED_BY(_criticalSectionRTCPSender); |
| 271 | uint32_t _SSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 272 | // SSRC that we receive on our RTP channel |
| 273 | uint32_t _remoteSSRC GUARDED_BY(_criticalSectionRTCPSender); |
| 274 | char _CNAME[RTCP_CNAME_SIZE] GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 275 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 276 | ReceiveStatistics* receive_statistics_ GUARDED_BY(_criticalSectionRTCPSender); |
| 277 | std::map<uint32_t, RTCPReportBlock*> internal_report_blocks_ |
| 278 | GUARDED_BY(_criticalSectionRTCPSender); |
| 279 | std::map<uint32_t, RTCPReportBlock*> external_report_blocks_ |
| 280 | GUARDED_BY(_criticalSectionRTCPSender); |
| 281 | std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> _csrcCNAMEs |
| 282 | GUARDED_BY(_criticalSectionRTCPSender); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 283 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 284 | // Sent |
| 285 | uint32_t _lastSendReport[RTCP_NUMBER_OF_SR] GUARDED_BY( |
| 286 | _criticalSectionRTCPSender); // allow packet loss and RTT above 1 sec |
| 287 | int64_t _lastRTCPTime[RTCP_NUMBER_OF_SR] GUARDED_BY( |
| 288 | _criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 289 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 290 | // Sent XR receiver reference time report. |
| 291 | // <mid ntp (mid 32 bits of the 64 bits NTP timestamp), send time in ms>. |
| 292 | std::map<uint32_t, int64_t> last_xr_rr_ GUARDED_BY(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 293 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 294 | // send CSRCs |
| 295 | std::vector<uint32_t> csrcs_ GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 296 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 297 | // Full intra request |
| 298 | uint8_t _sequenceNumberFIR GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 299 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 300 | // REMB |
| 301 | uint32_t _rembBitrate GUARDED_BY(_criticalSectionRTCPSender); |
| 302 | std::vector<uint32_t> remb_ssrcs_ GUARDED_BY(_criticalSectionRTCPSender); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 303 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 304 | TMMBRHelp _tmmbrHelp GUARDED_BY(_criticalSectionRTCPSender); |
| 305 | uint32_t _tmmbr_Send GUARDED_BY(_criticalSectionRTCPSender); |
| 306 | uint32_t _packetOH_Send GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 307 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 308 | // APP |
| 309 | bool _appSend GUARDED_BY(_criticalSectionRTCPSender); |
| 310 | uint8_t _appSubType GUARDED_BY(_criticalSectionRTCPSender); |
| 311 | uint32_t _appName GUARDED_BY(_criticalSectionRTCPSender); |
| 312 | rtc::scoped_ptr<uint8_t[]> _appData GUARDED_BY(_criticalSectionRTCPSender); |
| 313 | uint16_t _appLength GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 314 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 315 | // True if sending of XR Receiver reference time report is enabled. |
| 316 | bool xrSendReceiverReferenceTimeEnabled_ |
| 317 | GUARDED_BY(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 318 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 319 | // XR VoIP metric |
| 320 | bool _xrSendVoIPMetric GUARDED_BY(_criticalSectionRTCPSender); |
| 321 | RTCPVoIPMetric _xrVoIPMetric GUARDED_BY(_criticalSectionRTCPSender); |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 322 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 323 | RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; |
| 324 | RtcpPacketTypeCounter packet_type_counter_ |
| 325 | GUARDED_BY(_criticalSectionRTCPSender); |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 +0000 | [diff] [blame] | 326 | |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame^] | 327 | RTCPUtility::NackStats nack_stats_ GUARDED_BY(_criticalSectionRTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 328 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 329 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 330 | |
| 331 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |