OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <set> | 15 #include <set> |
16 #include <sstream> | 16 #include <sstream> |
17 #include <string> | 17 #include <string> |
18 | 18 |
19 #include "webrtc/base/scoped_ptr.h" | 19 #include "webrtc/base/scoped_ptr.h" |
20 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
21 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
23 #include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h" | 23 #include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h" |
24 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" | 24 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
| 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
26 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
27 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" | 28 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
28 #include "webrtc/typedefs.h" | 29 #include "webrtc/typedefs.h" |
29 | 30 |
30 namespace webrtc { | 31 namespace webrtc { |
31 | 32 |
32 class ModuleRtpRtcpImpl; | 33 class ModuleRtpRtcpImpl; |
33 class RTCPReceiver; | 34 class RTCPReceiver; |
34 | 35 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // (IP packet is full). Proceed to the next packet type, and call this | 170 // (IP packet is full). Proceed to the next packet type, and call this |
170 // method again when a new buffer has been allocated. | 171 // method again when a new buffer has been allocated. |
171 // TODO(sprang): Actually allocate multiple packets if needed. | 172 // TODO(sprang): Actually allocate multiple packets if needed. |
172 // kSuccess | 173 // kSuccess |
173 // Data has been successfully placed in the buffer. | 174 // Data has been successfully placed in the buffer. |
174 | 175 |
175 enum class BuildResult { kError, kAborted, kTruncated, kSuccess }; | 176 enum class BuildResult { kError, kAborted, kTruncated, kSuccess }; |
176 | 177 |
177 int32_t SendToNetwork(const uint8_t* dataBuffer, size_t length); | 178 int32_t SendToNetwork(const uint8_t* dataBuffer, size_t length); |
178 | 179 |
179 RTCPSender::BuildResult WriteAllReportBlocksToBuffer( | 180 int32_t AddReportBlock(const RTCPReportBlock& report_block) |
180 RtcpContext* context, | |
181 uint8_t* numberOfReportBlocks) | |
182 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); | 181 EXCLUSIVE_LOCKS_REQUIRED(critical_section_rtcp_sender_); |
183 | 182 |
184 void WriteReportBlocksToBuffer( | |
185 RtcpContext* context, | |
186 const std::map<uint32_t, RTCPReportBlock*>& report_blocks); | |
187 | |
188 int32_t AddReportBlock(uint32_t SSRC, | |
189 std::map<uint32_t, RTCPReportBlock*>* report_blocks, | |
190 const RTCPReportBlock* receiveBlock); | |
191 | |
192 bool PrepareReport(const FeedbackState& feedback_state, | 183 bool PrepareReport(const FeedbackState& feedback_state, |
| 184 uint32_t ssrc, |
193 StreamStatistician* statistician, | 185 StreamStatistician* statistician, |
194 RTCPReportBlock* report_block, | 186 RTCPReportBlock* report_block); |
195 uint32_t* ntp_secs, | |
196 uint32_t* ntp_frac); | |
197 | 187 |
198 int PrepareRTCP(const FeedbackState& feedback_state, | 188 int PrepareRTCP(const FeedbackState& feedback_state, |
199 const std::set<RTCPPacketType>& packetTypes, | 189 const std::set<RTCPPacketType>& packetTypes, |
200 int32_t nackSize, | 190 int32_t nackSize, |
201 const uint16_t* nackList, | 191 const uint16_t* nackList, |
202 bool repeat, | 192 bool repeat, |
203 uint64_t pictureID, | 193 uint64_t pictureID, |
204 uint8_t* rtcp_buffer, | 194 uint8_t* rtcp_buffer, |
205 int buffer_size); | 195 int buffer_size); |
206 | 196 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 uint32_t start_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); | 249 uint32_t start_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); |
260 uint32_t last_rtp_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); | 250 uint32_t last_rtp_timestamp_ GUARDED_BY(critical_section_rtcp_sender_); |
261 int64_t last_frame_capture_time_ms_ GUARDED_BY(critical_section_rtcp_sender_); | 251 int64_t last_frame_capture_time_ms_ GUARDED_BY(critical_section_rtcp_sender_); |
262 uint32_t ssrc_ GUARDED_BY(critical_section_rtcp_sender_); | 252 uint32_t ssrc_ GUARDED_BY(critical_section_rtcp_sender_); |
263 // SSRC that we receive on our RTP channel | 253 // SSRC that we receive on our RTP channel |
264 uint32_t remote_ssrc_ GUARDED_BY(critical_section_rtcp_sender_); | 254 uint32_t remote_ssrc_ GUARDED_BY(critical_section_rtcp_sender_); |
265 char cname_[RTCP_CNAME_SIZE] GUARDED_BY(critical_section_rtcp_sender_); | 255 char cname_[RTCP_CNAME_SIZE] GUARDED_BY(critical_section_rtcp_sender_); |
266 | 256 |
267 ReceiveStatistics* receive_statistics_ | 257 ReceiveStatistics* receive_statistics_ |
268 GUARDED_BY(critical_section_rtcp_sender_); | 258 GUARDED_BY(critical_section_rtcp_sender_); |
269 std::map<uint32_t, RTCPReportBlock*> internal_report_blocks_ | 259 std::map<uint32_t, rtcp::ReportBlock> report_blocks_ |
270 GUARDED_BY(critical_section_rtcp_sender_); | 260 GUARDED_BY(critical_section_rtcp_sender_); |
| 261 // TODO(sprang): Can we avoid pointers here? |
271 std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> csrc_cnames_ | 262 std::map<uint32_t, RTCPUtility::RTCPCnameInformation*> csrc_cnames_ |
272 GUARDED_BY(critical_section_rtcp_sender_); | 263 GUARDED_BY(critical_section_rtcp_sender_); |
273 | 264 |
274 // Sent | 265 // Sent |
275 uint32_t last_send_report_[RTCP_NUMBER_OF_SR] GUARDED_BY( | 266 uint32_t last_send_report_[RTCP_NUMBER_OF_SR] GUARDED_BY( |
276 critical_section_rtcp_sender_); // allow packet loss and RTT above 1 sec | 267 critical_section_rtcp_sender_); // allow packet loss and RTT above 1 sec |
277 int64_t last_rtcp_time_[RTCP_NUMBER_OF_SR] GUARDED_BY( | 268 int64_t last_rtcp_time_[RTCP_NUMBER_OF_SR] GUARDED_BY( |
278 critical_section_rtcp_sender_); | 269 critical_section_rtcp_sender_); |
279 | 270 |
280 // Sent XR receiver reference time report. | 271 // Sent XR receiver reference time report. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 bool operator<(const ReportFlag& flag) const { return type < flag.type; } | 322 bool operator<(const ReportFlag& flag) const { return type < flag.type; } |
332 bool operator==(const ReportFlag& flag) const { return type == flag.type; } | 323 bool operator==(const ReportFlag& flag) const { return type == flag.type; } |
333 const RTCPPacketType type; | 324 const RTCPPacketType type; |
334 const bool is_volatile; | 325 const bool is_volatile; |
335 }; | 326 }; |
336 | 327 |
337 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); | 328 std::set<ReportFlag> report_flags_ GUARDED_BY(critical_section_rtcp_sender_); |
338 | 329 |
339 typedef BuildResult (RTCPSender::*Builder)(RtcpContext*); | 330 typedef BuildResult (RTCPSender::*Builder)(RtcpContext*); |
340 std::map<RTCPPacketType, Builder> builders_; | 331 std::map<RTCPPacketType, Builder> builders_; |
| 332 |
| 333 class PacketBuiltCallback; |
341 }; | 334 }; |
342 } // namespace webrtc | 335 } // namespace webrtc |
343 | 336 |
344 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ | 337 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_SENDER_H_ |
OLD | NEW |