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> |
Erik Språng | 242e22b | 2015-05-11 10:17:43 +0200 | [diff] [blame] | 15 | #include <set> |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 16 | #include <sstream> |
| 17 | #include <string> |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 18 | #include <vector> |
pwestin@webrtc.org | 26f8d9c | 2012-01-19 15:53:09 +0000 | [diff] [blame] | 19 | |
danilchap | 47a740b | 2015-12-15 00:30:07 -0800 | [diff] [blame] | 20 | #include "webrtc/base/random.h" |
kwiberg@webrtc.org | 00b8f6b | 2015-02-26 14:34:55 +0000 | [diff] [blame] | 21 | #include "webrtc/base/scoped_ptr.h" |
pbos@webrtc.org | 38344ed | 2014-09-24 06:05:00 +0000 | [diff] [blame] | 22 | #include "webrtc/base/thread_annotations.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 23 | #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
| 24 | #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 25 | #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
| 26 | #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
Erik Språng | bdc0b0d | 2015-06-22 15:21:24 +0200 | [diff] [blame] | 27 | #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
danilchap | 34ed2b9 | 2016-01-18 02:43:32 -0800 | [diff] [blame] | 28 | #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 29 | #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 30 | #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 31 | #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
pbos | 2d56668 | 2015-09-28 09:59:31 -0700 | [diff] [blame] | 32 | #include "webrtc/transport.h" |
pbos@webrtc.org | a048d7c | 2013-05-29 14:27:38 +0000 | [diff] [blame] | 33 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | |
| 35 | namespace webrtc { |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 36 | |
wu@webrtc.org | 822fbd8 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 37 | class ModuleRtpRtcpImpl; |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 38 | class RTCPReceiver; |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame^] | 39 | class RtcEventLog; |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 40 | |
asapersson@webrtc.org | 9ffd8fe | 2015-01-21 08:22:50 +0000 | [diff] [blame] | 41 | class NACKStringBuilder { |
| 42 | public: |
| 43 | NACKStringBuilder(); |
| 44 | ~NACKStringBuilder(); |
pbos@webrtc.org | f3e4cee | 2013-07-31 15:17:19 +0000 | [diff] [blame] | 45 | |
asapersson@webrtc.org | 9ffd8fe | 2015-01-21 08:22:50 +0000 | [diff] [blame] | 46 | void PushNACK(uint16_t nack); |
| 47 | std::string GetResult(); |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 48 | |
asapersson@webrtc.org | 9ffd8fe | 2015-01-21 08:22:50 +0000 | [diff] [blame] | 49 | private: |
Erik Språng | 242e22b | 2015-05-11 10:17:43 +0200 | [diff] [blame] | 50 | std::ostringstream stream_; |
| 51 | int count_; |
| 52 | uint16_t prevNack_; |
| 53 | bool consecutive_; |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
asapersson@webrtc.org | 9ffd8fe | 2015-01-21 08:22:50 +0000 | [diff] [blame] | 56 | class RTCPSender { |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 57 | public: |
| 58 | struct FeedbackState { |
| 59 | FeedbackState(); |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 60 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 61 | uint8_t send_payload_type; |
| 62 | uint32_t frequency_hz; |
| 63 | uint32_t packets_sent; |
| 64 | size_t media_bytes_sent; |
| 65 | uint32_t send_bitrate; |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 66 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 67 | uint32_t last_rr_ntp_secs; |
| 68 | uint32_t last_rr_ntp_frac; |
| 69 | uint32_t remote_sr; |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 70 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 71 | bool has_last_xr_rr; |
| 72 | RtcpReceiveTimeInfo last_xr_rr; |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 73 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 74 | // Used when generating TMMBR. |
| 75 | ModuleRtpRtcpImpl* module; |
| 76 | }; |
Erik Språng | 61be2a4 | 2015-04-27 13:32:52 +0200 | [diff] [blame] | 77 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 78 | RTCPSender(bool audio, |
| 79 | Clock* clock, |
| 80 | ReceiveStatistics* receive_statistics, |
| 81 | RtcpPacketTypeCounterObserver* packet_type_counter_observer, |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame^] | 82 | RtcEventLog* event_log, |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 83 | Transport* outgoing_transport); |
| 84 | virtual ~RTCPSender(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 85 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 86 | RtcpMode Status() const; |
| 87 | void SetRTCPStatus(RtcpMode method); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 88 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 89 | bool Sending() const; |
| 90 | int32_t SetSendingStatus(const FeedbackState& feedback_state, |
| 91 | bool enabled); // combine the functions |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 92 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 93 | int32_t SetNackStatus(bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 94 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 95 | void SetStartTimestamp(uint32_t start_timestamp); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 96 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 97 | void SetLastRtpTime(uint32_t rtp_timestamp, int64_t capture_time_ms); |
stefan@webrtc.org | 7c3523c | 2012-09-11 07:00:42 +0000 | [diff] [blame] | 98 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 99 | void SetSSRC(uint32_t ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 100 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 101 | void SetRemoteSSRC(uint32_t ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 102 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 103 | int32_t SetCNAME(const char* cName); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 104 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 105 | int32_t AddMixedCNAME(uint32_t SSRC, const char* c_name); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 106 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 107 | int32_t RemoveMixedCNAME(uint32_t SSRC); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 108 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 109 | int64_t SendTimeOfSendReport(uint32_t sendReport); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 110 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 111 | bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const; |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 112 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 113 | bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 114 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 115 | int32_t SendRTCP(const FeedbackState& feedback_state, |
| 116 | RTCPPacketType packetType, |
| 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 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 122 | int32_t SendCompoundRTCP(const FeedbackState& feedback_state, |
| 123 | const std::set<RTCPPacketType>& packetTypes, |
| 124 | int32_t nackSize = 0, |
| 125 | const uint16_t* nackList = 0, |
| 126 | bool repeat = false, |
| 127 | uint64_t pictureID = 0); |
Erik Språng | 242e22b | 2015-05-11 10:17:43 +0200 | [diff] [blame] | 128 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 129 | bool REMB() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 130 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 131 | void SetREMBStatus(bool enable); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 132 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 133 | void SetREMBData(uint32_t bitrate, const std::vector<uint32_t>& ssrcs); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 134 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 135 | bool TMMBR() const; |
mflodman@webrtc.org | 84dc3d1 | 2011-12-22 10:26:13 +0000 | [diff] [blame] | 136 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 137 | void SetTMMBRStatus(bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 138 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 139 | int32_t SetTMMBN(const TMMBRSet* boundingSet, uint32_t maxBitrateKbit); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 140 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 141 | int32_t SetApplicationSpecificData(uint8_t subType, |
| 142 | uint32_t name, |
| 143 | const uint8_t* data, |
| 144 | uint16_t length); |
| 145 | int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 146 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 147 | void SendRtcpXrReceiverReferenceTime(bool enable); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 148 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 149 | bool RtcpXrReceiverReferenceTime() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 150 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 151 | void SetCsrcs(const std::vector<uint32_t>& csrcs); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 152 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 153 | void SetTargetBitrate(unsigned int target_bitrate); |
| 154 | bool SendFeedbackPacket(const rtcp::TransportFeedback& packet); |
mflodman@webrtc.org | 117c119 | 2012-01-13 08:52:58 +0000 | [diff] [blame] | 155 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 156 | private: |
| 157 | class RtcpContext; |
Erik Språng | 242e22b | 2015-05-11 10:17:43 +0200 | [diff] [blame] | 158 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 159 | // Determine which RTCP messages should be sent and setup flags. |
| 160 | void PrepareReport(const std::set<RTCPPacketType>& packetTypes, |
| 161 | const FeedbackState& feedback_state) |
| 162 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 163 | |
danilchap | a72e734 | 2015-12-22 08:07:45 -0800 | [diff] [blame] | 164 | bool AddReportBlock(const FeedbackState& feedback_state, |
| 165 | uint32_t ssrc, |
| 166 | StreamStatistician* statistician) |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 167 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 168 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 169 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildSR(const RtcpContext& context) |
| 170 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 171 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildRR(const RtcpContext& context) |
| 172 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 173 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildSDES(const RtcpContext& context) |
| 174 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 175 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildPLI(const RtcpContext& context) |
| 176 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 177 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildREMB(const RtcpContext& context) |
| 178 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 179 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildTMMBR(const RtcpContext& context) |
| 180 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 181 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildTMMBN(const RtcpContext& context) |
| 182 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 183 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildAPP(const RtcpContext& context) |
| 184 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 185 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildVoIPMetric(const RtcpContext& context) |
| 186 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 187 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildBYE(const RtcpContext& context) |
| 188 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 189 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildFIR(const RtcpContext& context) |
| 190 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 191 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildSLI(const RtcpContext& context) |
| 192 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 193 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildRPSI(const RtcpContext& context) |
| 194 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 195 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildNACK(const RtcpContext& context) |
| 196 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 197 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildReceiverReferenceTime( |
| 198 | const RtcpContext& context) |
| 199 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 200 | rtc::scoped_ptr<rtcp::RtcpPacket> BuildDlrr(const RtcpContext& context) |
| 201 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 202 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 203 | private: |
| 204 | const bool audio_; |
| 205 | Clock* const clock_; |
danilchap | 47a740b | 2015-12-15 00:30:07 -0800 | [diff] [blame] | 206 | Random random_ GUARDED_BY(critical_section_rtcp_sender_); |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 207 | RtcpMode method_ GUARDED_BY(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 208 | |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame^] | 209 | RtcEventLog* const event_log_; |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 210 | Transport* const transport_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 211 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 212 | rtc::scoped_ptr<CriticalSectionWrapper> critical_section_rtcp_sender_; |
| 213 | bool using_nack_ GUARDED_BY(critical_section_rtcp_sender_); |
| 214 | bool sending_ GUARDED_BY(critical_section_rtcp_sender_); |
| 215 | bool remb_enabled_ GUARDED_BY(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 216 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 217 | int64_t next_time_to_send_rtcp_ GUARDED_BY(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 218 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 219 | uint32_t start_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); |
| 220 | uint32_t last_rtp_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); |
| 221 | int64_t last_frame_capture_time_ms_ GUARDED_BY(critical_section_rtcp_sender_); |
| 222 | uint32_t ssrc_ GUARDED_BY(critical_section_rtcp_sender_); |
| 223 | // SSRC that we receive on our RTP channel |
| 224 | uint32_t remote_ssrc_ GUARDED_BY(critical_section_rtcp_sender_); |
| 225 | std::string cname_ GUARDED_BY(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 226 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 227 | ReceiveStatistics* receive_statistics_ |
| 228 | GUARDED_BY(critical_section_rtcp_sender_); |
| 229 | std::map<uint32_t, rtcp::ReportBlock> report_blocks_ |
| 230 | GUARDED_BY(critical_section_rtcp_sender_); |
| 231 | std::map<uint32_t, std::string> csrc_cnames_ |
| 232 | GUARDED_BY(critical_section_rtcp_sender_); |
stefan@webrtc.org | 286fe0b | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 233 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 234 | // Sent |
| 235 | uint32_t last_send_report_[RTCP_NUMBER_OF_SR] GUARDED_BY( |
| 236 | critical_section_rtcp_sender_); // allow packet loss and RTT above 1 sec |
| 237 | int64_t last_rtcp_time_[RTCP_NUMBER_OF_SR] GUARDED_BY( |
| 238 | critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 239 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 240 | // Sent XR receiver reference time report. |
| 241 | // <mid ntp (mid 32 bits of the 64 bits NTP timestamp), send time in ms>. |
| 242 | std::map<uint32_t, int64_t> last_xr_rr_ |
| 243 | GUARDED_BY(critical_section_rtcp_sender_); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 244 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 245 | // send CSRCs |
| 246 | std::vector<uint32_t> csrcs_ GUARDED_BY(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 247 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 248 | // Full intra request |
| 249 | uint8_t sequence_number_fir_ GUARDED_BY(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 250 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 251 | // REMB |
| 252 | uint32_t remb_bitrate_ GUARDED_BY(critical_section_rtcp_sender_); |
| 253 | std::vector<uint32_t> remb_ssrcs_ GUARDED_BY(critical_section_rtcp_sender_); |
pwestin@webrtc.org | 741da94 | 2011-09-20 13:52:04 +0000 | [diff] [blame] | 254 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 255 | TMMBRHelp tmmbr_help_ GUARDED_BY(critical_section_rtcp_sender_); |
| 256 | uint32_t tmmbr_send_ GUARDED_BY(critical_section_rtcp_sender_); |
| 257 | uint32_t packet_oh_send_ GUARDED_BY(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 258 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 259 | // APP |
| 260 | uint8_t app_sub_type_ GUARDED_BY(critical_section_rtcp_sender_); |
| 261 | uint32_t app_name_ GUARDED_BY(critical_section_rtcp_sender_); |
| 262 | rtc::scoped_ptr<uint8_t[]> app_data_ |
| 263 | GUARDED_BY(critical_section_rtcp_sender_); |
| 264 | uint16_t app_length_ GUARDED_BY(critical_section_rtcp_sender_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 265 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 266 | // True if sending of XR Receiver reference time report is enabled. |
| 267 | bool xr_send_receiver_reference_time_enabled_ |
| 268 | GUARDED_BY(critical_section_rtcp_sender_); |
asapersson@webrtc.org | 8469f7b | 2013-10-02 13:15:34 +0000 | [diff] [blame] | 269 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 270 | // XR VoIP metric |
| 271 | RTCPVoIPMetric xr_voip_metric_ GUARDED_BY(critical_section_rtcp_sender_); |
edjee@google.com | 79b0289 | 2013-04-04 19:43:34 +0000 | [diff] [blame] | 272 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 273 | RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; |
| 274 | RtcpPacketTypeCounter packet_type_counter_ |
| 275 | GUARDED_BY(critical_section_rtcp_sender_); |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 +0000 | [diff] [blame] | 276 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 277 | RTCPUtility::NackStats nack_stats_ GUARDED_BY(critical_section_rtcp_sender_); |
Erik Språng | 242e22b | 2015-05-11 10:17:43 +0200 | [diff] [blame] | 278 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 279 | void SetFlag(RTCPPacketType type, bool is_volatile) |
| 280 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 281 | void SetFlags(const std::set<RTCPPacketType>& types, bool is_volatile) |
| 282 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 283 | bool IsFlagPresent(RTCPPacketType type) const |
| 284 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 285 | bool ConsumeFlag(RTCPPacketType type, bool forced = false) |
| 286 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 287 | bool AllVolatileFlagsConsumed() const |
| 288 | EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
| 289 | struct ReportFlag { |
| 290 | ReportFlag(RTCPPacketType type, bool is_volatile) |
| 291 | : type(type), is_volatile(is_volatile) {} |
| 292 | bool operator<(const ReportFlag& flag) const { return type < flag.type; } |
| 293 | bool operator==(const ReportFlag& flag) const { return type == flag.type; } |
| 294 | const RTCPPacketType type; |
| 295 | const bool is_volatile; |
| 296 | }; |
Erik Språng | 242e22b | 2015-05-11 10:17:43 +0200 | [diff] [blame] | 297 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 298 | std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); |
Erik Språng | 242e22b | 2015-05-11 10:17:43 +0200 | [diff] [blame] | 299 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 300 | typedef rtc::scoped_ptr<rtcp::RtcpPacket> (RTCPSender::*BuilderFunc)( |
| 301 | const RtcpContext&); |
| 302 | std::map<RTCPPacketType, BuilderFunc> builders_; |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame^] | 303 | |
| 304 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTCPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 305 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 306 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 307 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 308 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |