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 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 RTC_DCHECK_LT(strlen(c_name), RTCP_CNAME_SIZE); | 320 RTC_DCHECK_LT(strlen(c_name), RTCP_CNAME_SIZE); |
321 rtc::CritScope lock(&critical_section_rtcp_sender_); | 321 rtc::CritScope lock(&critical_section_rtcp_sender_); |
322 cname_ = c_name; | 322 cname_ = c_name; |
323 return 0; | 323 return 0; |
324 } | 324 } |
325 | 325 |
326 int32_t RTCPSender::AddMixedCNAME(uint32_t SSRC, const char* c_name) { | 326 int32_t RTCPSender::AddMixedCNAME(uint32_t SSRC, const char* c_name) { |
327 RTC_DCHECK(c_name); | 327 RTC_DCHECK(c_name); |
328 RTC_DCHECK_LT(strlen(c_name), RTCP_CNAME_SIZE); | 328 RTC_DCHECK_LT(strlen(c_name), RTCP_CNAME_SIZE); |
329 rtc::CritScope lock(&critical_section_rtcp_sender_); | 329 rtc::CritScope lock(&critical_section_rtcp_sender_); |
330 if (csrc_cnames_.size() >= kRtpCsrcSize) | 330 // One spot is reserved for ssrc_/cname_. |
331 if (csrc_cnames_.size() >= rtcp::Sdes::kMaxNumberOfChunks - 1) | |
nisse-webrtc
2017/03/16 13:42:44
I'd need a bit more context to understand what's g
danilchap
2017/03/16 13:58:02
imagine 30 participant meeting with server-side au
| |
331 return -1; | 332 return -1; |
332 | 333 |
333 csrc_cnames_[SSRC] = c_name; | 334 csrc_cnames_[SSRC] = c_name; |
334 return 0; | 335 return 0; |
335 } | 336 } |
336 | 337 |
337 int32_t RTCPSender::RemoveMixedCNAME(uint32_t SSRC) { | 338 int32_t RTCPSender::RemoveMixedCNAME(uint32_t SSRC) { |
338 rtc::CritScope lock(&critical_section_rtcp_sender_); | 339 rtc::CritScope lock(&critical_section_rtcp_sender_); |
339 auto it = csrc_cnames_.find(SSRC); | 340 auto it = csrc_cnames_.find(SSRC); |
340 | 341 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 } | 457 } |
457 | 458 |
458 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSDES( | 459 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSDES( |
459 const RtcpContext& ctx) { | 460 const RtcpContext& ctx) { |
460 size_t length_cname = cname_.length(); | 461 size_t length_cname = cname_.length(); |
461 RTC_CHECK_LT(length_cname, RTCP_CNAME_SIZE); | 462 RTC_CHECK_LT(length_cname, RTCP_CNAME_SIZE); |
462 | 463 |
463 rtcp::Sdes* sdes = new rtcp::Sdes(); | 464 rtcp::Sdes* sdes = new rtcp::Sdes(); |
464 sdes->AddCName(ssrc_, cname_); | 465 sdes->AddCName(ssrc_, cname_); |
465 | 466 |
466 for (const auto it : csrc_cnames_) | 467 for (const auto& it : csrc_cnames_) |
467 sdes->AddCName(it.first, it.second); | 468 RTC_CHECK(sdes->AddCName(it.first, it.second)); |
468 | 469 |
469 return std::unique_ptr<rtcp::RtcpPacket>(sdes); | 470 return std::unique_ptr<rtcp::RtcpPacket>(sdes); |
470 } | 471 } |
471 | 472 |
472 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildRR(const RtcpContext& ctx) { | 473 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildRR(const RtcpContext& ctx) { |
473 rtcp::ReceiverReport* report = new rtcp::ReceiverReport(); | 474 rtcp::ReceiverReport* report = new rtcp::ReceiverReport(); |
474 report->SetSenderSsrc(ssrc_); | 475 report->SetSenderSsrc(ssrc_); |
475 for (auto it : report_blocks_) | 476 for (auto it : report_blocks_) |
476 report->AddReportBlock(it.second); | 477 report->AddReportBlock(it.second); |
477 | 478 |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1000 max_packet_size = max_packet_size_; | 1001 max_packet_size = max_packet_size_; |
1001 } | 1002 } |
1002 | 1003 |
1003 RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE); | 1004 RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE); |
1004 uint8_t buffer[IP_PACKET_SIZE]; | 1005 uint8_t buffer[IP_PACKET_SIZE]; |
1005 return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) && | 1006 return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) && |
1006 !sender.send_failure_; | 1007 !sender.send_failure_; |
1007 } | 1008 } |
1008 | 1009 |
1009 } // namespace webrtc | 1010 } // namespace webrtc |
OLD | NEW |