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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 request.set_ssrc(remote_ssrc_); | 641 request.set_ssrc(remote_ssrc_); |
642 request.set_bitrate_bps(tmmbr_send_ * 1000); | 642 request.set_bitrate_bps(tmmbr_send_ * 1000); |
643 request.set_packet_overhead(packet_oh_send_); | 643 request.set_packet_overhead(packet_oh_send_); |
644 tmmbr->WithTmmbr(request); | 644 tmmbr->WithTmmbr(request); |
645 | 645 |
646 return rtc::scoped_ptr<rtcp::Tmmbr>(tmmbr); | 646 return rtc::scoped_ptr<rtcp::Tmmbr>(tmmbr); |
647 } | 647 } |
648 | 648 |
649 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN( | 649 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN( |
650 const RtcpContext& ctx) { | 650 const RtcpContext& ctx) { |
651 TMMBRSet* boundingSet = tmmbr_help_.BoundingSetToSend(); | |
652 if (boundingSet == nullptr) | |
653 return nullptr; | |
654 | |
655 rtcp::Tmmbn* tmmbn = new rtcp::Tmmbn(); | 651 rtcp::Tmmbn* tmmbn = new rtcp::Tmmbn(); |
656 tmmbn->From(ssrc_); | 652 tmmbn->From(ssrc_); |
657 for (uint32_t i = 0; i < boundingSet->lengthOfSet(); i++) { | 653 for (const rtcp::TmmbItem& timber : tmmbn_to_send_) { |
658 if (boundingSet->Tmmbr(i) > 0) { | 654 if (timber.bitrate_bps() > 0) { |
659 tmmbn->WithTmmbr(boundingSet->Ssrc(i), boundingSet->Tmmbr(i), | 655 tmmbn->WithTmmbr(timber); |
660 boundingSet->PacketOH(i)); | |
661 } | 656 } |
662 } | 657 } |
663 | 658 |
664 return rtc::scoped_ptr<rtcp::Tmmbn>(tmmbn); | 659 return rtc::scoped_ptr<rtcp::Tmmbn>(tmmbn); |
665 } | 660 } |
666 | 661 |
667 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildAPP(const RtcpContext& ctx) { | 662 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildAPP(const RtcpContext& ctx) { |
668 rtcp::App* app = new rtcp::App(); | 663 rtcp::App* app = new rtcp::App(); |
669 app->From(ssrc_); | 664 app->From(ssrc_); |
670 app->WithSubType(app_sub_type_); | 665 app->WithSubType(app_sub_type_); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 CriticalSectionScoped lock(critical_section_rtcp_sender_.get()); | 970 CriticalSectionScoped lock(critical_section_rtcp_sender_.get()); |
976 xr_send_receiver_reference_time_enabled_ = enable; | 971 xr_send_receiver_reference_time_enabled_ = enable; |
977 } | 972 } |
978 | 973 |
979 bool RTCPSender::RtcpXrReceiverReferenceTime() const { | 974 bool RTCPSender::RtcpXrReceiverReferenceTime() const { |
980 CriticalSectionScoped lock(critical_section_rtcp_sender_.get()); | 975 CriticalSectionScoped lock(critical_section_rtcp_sender_.get()); |
981 return xr_send_receiver_reference_time_enabled_; | 976 return xr_send_receiver_reference_time_enabled_; |
982 } | 977 } |
983 | 978 |
984 // no callbacks allowed inside this function | 979 // no callbacks allowed inside this function |
985 int32_t RTCPSender::SetTMMBN(const TMMBRSet* boundingSet) { | 980 void RTCPSender::SetTMMBN(const TMMBRSet* bounding_set) { |
986 CriticalSectionScoped lock(critical_section_rtcp_sender_.get()); | 981 CriticalSectionScoped lock(critical_section_rtcp_sender_.get()); |
987 | 982 if (!bounding_set) { |
988 if (0 == tmmbr_help_.SetTMMBRBoundingSetToSend(boundingSet)) { | 983 tmmbn_to_send_.clear(); |
989 SetFlag(kRtcpTmmbn, true); | 984 } else { |
990 return 0; | 985 tmmbn_to_send_ = *bounding_set; |
991 } | 986 } |
992 return -1; | 987 SetFlag(kRtcpTmmbn, true); |
993 } | 988 } |
994 | 989 |
995 void RTCPSender::SetFlag(RTCPPacketType type, bool is_volatile) { | 990 void RTCPSender::SetFlag(RTCPPacketType type, bool is_volatile) { |
996 report_flags_.insert(ReportFlag(type, is_volatile)); | 991 report_flags_.insert(ReportFlag(type, is_volatile)); |
997 } | 992 } |
998 | 993 |
999 void RTCPSender::SetFlags(const std::set<RTCPPacketType>& types, | 994 void RTCPSender::SetFlags(const std::set<RTCPPacketType>& types, |
1000 bool is_volatile) { | 995 bool is_volatile) { |
1001 for (RTCPPacketType type : types) | 996 for (RTCPPacketType type : types) |
1002 SetFlag(type, is_volatile); | 997 SetFlag(type, is_volatile); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); | 1042 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); |
1048 // but we can't because of an incorrect warning (C4822) in MVS 2013. | 1043 // but we can't because of an incorrect warning (C4822) in MVS 2013. |
1049 } sender(transport_, event_log_); | 1044 } sender(transport_, event_log_); |
1050 | 1045 |
1051 uint8_t buffer[IP_PACKET_SIZE]; | 1046 uint8_t buffer[IP_PACKET_SIZE]; |
1052 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && | 1047 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && |
1053 !sender.send_failure_; | 1048 !sender.send_failure_; |
1054 } | 1049 } |
1055 | 1050 |
1056 } // namespace webrtc | 1051 } // namespace webrtc |
OLD | NEW |