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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 request.set_ssrc(remote_ssrc_); | 632 request.set_ssrc(remote_ssrc_); |
633 request.set_bitrate_bps(tmmbr_send_ * 1000); | 633 request.set_bitrate_bps(tmmbr_send_ * 1000); |
634 request.set_packet_overhead(packet_oh_send_); | 634 request.set_packet_overhead(packet_oh_send_); |
635 tmmbr->WithTmmbr(request); | 635 tmmbr->WithTmmbr(request); |
636 | 636 |
637 return std::unique_ptr<rtcp::RtcpPacket>(tmmbr); | 637 return std::unique_ptr<rtcp::RtcpPacket>(tmmbr); |
638 } | 638 } |
639 | 639 |
640 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN( | 640 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN( |
641 const RtcpContext& ctx) { | 641 const RtcpContext& ctx) { |
642 TMMBRSet* boundingSet = tmmbr_help_.BoundingSetToSend(); | |
643 if (boundingSet == nullptr) | |
644 return nullptr; | |
645 | |
646 rtcp::Tmmbn* tmmbn = new rtcp::Tmmbn(); | 642 rtcp::Tmmbn* tmmbn = new rtcp::Tmmbn(); |
647 tmmbn->From(ssrc_); | 643 tmmbn->From(ssrc_); |
648 for (uint32_t i = 0; i < boundingSet->lengthOfSet(); i++) { | 644 for (const rtcp::TmmbItem& timber : tmmbn_to_send_) { |
åsapersson
2016/05/09 15:57:11
maybe timber->tmmbr
danilchap
2016/05/09 16:06:26
Done.
| |
649 if (boundingSet->Tmmbr(i) > 0) { | 645 if (timber.bitrate_bps() > 0) { |
650 tmmbn->WithTmmbr(boundingSet->Ssrc(i), boundingSet->Tmmbr(i), | 646 tmmbn->WithTmmbr(timber); |
651 boundingSet->PacketOH(i)); | |
652 } | 647 } |
653 } | 648 } |
654 | 649 |
655 return std::unique_ptr<rtcp::RtcpPacket>(tmmbn); | 650 return std::unique_ptr<rtcp::RtcpPacket>(tmmbn); |
656 } | 651 } |
657 | 652 |
658 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildAPP(const RtcpContext& ctx) { | 653 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildAPP(const RtcpContext& ctx) { |
659 rtcp::App* app = new rtcp::App(); | 654 rtcp::App* app = new rtcp::App(); |
660 app->From(ssrc_); | 655 app->From(ssrc_); |
661 app->WithSubType(app_sub_type_); | 656 app->WithSubType(app_sub_type_); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
968 rtc::CritScope lock(&critical_section_rtcp_sender_); | 963 rtc::CritScope lock(&critical_section_rtcp_sender_); |
969 xr_send_receiver_reference_time_enabled_ = enable; | 964 xr_send_receiver_reference_time_enabled_ = enable; |
970 } | 965 } |
971 | 966 |
972 bool RTCPSender::RtcpXrReceiverReferenceTime() const { | 967 bool RTCPSender::RtcpXrReceiverReferenceTime() const { |
973 rtc::CritScope lock(&critical_section_rtcp_sender_); | 968 rtc::CritScope lock(&critical_section_rtcp_sender_); |
974 return xr_send_receiver_reference_time_enabled_; | 969 return xr_send_receiver_reference_time_enabled_; |
975 } | 970 } |
976 | 971 |
977 // no callbacks allowed inside this function | 972 // no callbacks allowed inside this function |
978 int32_t RTCPSender::SetTMMBN(const TMMBRSet* boundingSet) { | 973 void RTCPSender::SetTMMBN(const std::vector<rtcp::TmmbItem>* bounding_set) { |
979 rtc::CritScope lock(&critical_section_rtcp_sender_); | 974 rtc::CritScope lock(&critical_section_rtcp_sender_); |
980 | 975 if (!bounding_set) { |
åsapersson
2016/05/09 15:57:11
maybe if (bounding_set)...
danilchap
2016/05/09 16:06:26
Done.
| |
981 if (0 == tmmbr_help_.SetTMMBRBoundingSetToSend(boundingSet)) { | 976 tmmbn_to_send_.clear(); |
982 SetFlag(kRtcpTmmbn, true); | 977 } else { |
983 return 0; | 978 tmmbn_to_send_ = *bounding_set; |
984 } | 979 } |
985 return -1; | 980 SetFlag(kRtcpTmmbn, true); |
986 } | 981 } |
987 | 982 |
988 void RTCPSender::SetFlag(RTCPPacketType type, bool is_volatile) { | 983 void RTCPSender::SetFlag(RTCPPacketType type, bool is_volatile) { |
989 report_flags_.insert(ReportFlag(type, is_volatile)); | 984 report_flags_.insert(ReportFlag(type, is_volatile)); |
990 } | 985 } |
991 | 986 |
992 void RTCPSender::SetFlags(const std::set<RTCPPacketType>& types, | 987 void RTCPSender::SetFlags(const std::set<RTCPPacketType>& types, |
993 bool is_volatile) { | 988 bool is_volatile) { |
994 for (RTCPPacketType type : types) | 989 for (RTCPPacketType type : types) |
995 SetFlag(type, is_volatile); | 990 SetFlag(type, is_volatile); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1041 // but we can't because of an incorrect warning (C4822) in MVS 2013. | 1036 // but we can't because of an incorrect warning (C4822) in MVS 2013. |
1042 } sender(transport_, event_log_); | 1037 } sender(transport_, event_log_); |
1043 | 1038 |
1044 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE)); | 1039 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE)); |
1045 uint8_t buffer[IP_PACKET_SIZE]; | 1040 uint8_t buffer[IP_PACKET_SIZE]; |
1046 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) && | 1041 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) && |
1047 !sender.send_failure_; | 1042 !sender.send_failure_; |
1048 } | 1043 } |
1049 | 1044 |
1050 } // namespace webrtc | 1045 } // namespace webrtc |
OLD | NEW |