| 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 582 |
| 583 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR( | 583 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR( |
| 584 const RtcpContext& ctx) { | 584 const RtcpContext& ctx) { |
| 585 if (ctx.feedback_state_.module == nullptr) | 585 if (ctx.feedback_state_.module == nullptr) |
| 586 return nullptr; | 586 return nullptr; |
| 587 // Before sending the TMMBR check the received TMMBN, only an owner is | 587 // Before sending the TMMBR check the received TMMBN, only an owner is |
| 588 // allowed to raise the bitrate: | 588 // allowed to raise the bitrate: |
| 589 // * If the sender is an owner of the TMMBN -> send TMMBR | 589 // * If the sender is an owner of the TMMBN -> send TMMBR |
| 590 // * If not an owner but the TMMBR would enter the TMMBN -> send TMMBR | 590 // * If not an owner but the TMMBR would enter the TMMBN -> send TMMBR |
| 591 | 591 |
| 592 TMMBRHelp tmmbr_help; | |
| 593 // get current bounding set from RTCP receiver | 592 // get current bounding set from RTCP receiver |
| 594 bool tmmbrOwner = false; | 593 bool tmmbrOwner = false; |
| 595 // store in candidateSet, allocates one extra slot | 594 TMMBRSet candidates; |
| 596 TMMBRSet* candidateSet = tmmbr_help.CandidateSet(); | |
| 597 | 595 |
| 598 // holding critical_section_rtcp_sender_ while calling RTCPreceiver which | 596 // holding critical_section_rtcp_sender_ while calling RTCPreceiver which |
| 599 // will accuire criticalSectionRTCPReceiver_ is a potental deadlock but | 597 // will accuire criticalSectionRTCPReceiver_ is a potental deadlock but |
| 600 // since RTCPreceiver is not doing the reverse we should be fine | 598 // since RTCPreceiver is not doing the reverse we should be fine |
| 601 int32_t lengthOfBoundingSet = | 599 int32_t lengthOfBoundingSet = |
| 602 ctx.feedback_state_.module->BoundingSet(&tmmbrOwner, candidateSet); | 600 ctx.feedback_state_.module->BoundingSet(&tmmbrOwner, &candidates); |
| 603 | 601 |
| 604 if (lengthOfBoundingSet > 0) { | 602 if (lengthOfBoundingSet > 0) { |
| 605 for (int32_t i = 0; i < lengthOfBoundingSet; i++) { | 603 for (int32_t i = 0; i < lengthOfBoundingSet; i++) { |
| 606 if (candidateSet->Tmmbr(i) == tmmbr_send_ && | 604 if (candidates.Tmmbr(i) == tmmbr_send_ && |
| 607 candidateSet->PacketOH(i) == packet_oh_send_) { | 605 candidates.PacketOH(i) == packet_oh_send_) { |
| 608 // Do not send the same tuple. | 606 // Do not send the same tuple. |
| 609 return nullptr; | 607 return nullptr; |
| 610 } | 608 } |
| 611 } | 609 } |
| 612 if (!tmmbrOwner) { | 610 if (!tmmbrOwner) { |
| 613 // use received bounding set as candidate set | 611 // use received bounding set as candidate set |
| 614 // add current tuple | 612 // add current tuple |
| 615 candidateSet->SetEntry(lengthOfBoundingSet, tmmbr_send_, packet_oh_send_, | 613 candidates.SetEntry(lengthOfBoundingSet, tmmbr_send_, packet_oh_send_, |
| 616 ssrc_); | 614 ssrc_); |
| 617 | 615 |
| 618 // find bounding set | 616 // find bounding set |
| 619 std::vector<rtcp::TmmbItem> bounding = tmmbr_help.FindTMMBRBoundingSet(); | 617 std::vector<rtcp::TmmbItem> bounding = |
| 618 TMMBRHelp::FindBoundingSet(std::move(candidates)); |
| 620 tmmbrOwner = TMMBRHelp::IsOwner(bounding, ssrc_); | 619 tmmbrOwner = TMMBRHelp::IsOwner(bounding, ssrc_); |
| 621 if (!tmmbrOwner) { | 620 if (!tmmbrOwner) { |
| 622 // Did not enter bounding set, no meaning to send this request. | 621 // Did not enter bounding set, no meaning to send this request. |
| 623 return nullptr; | 622 return nullptr; |
| 624 } | 623 } |
| 625 } | 624 } |
| 626 } | 625 } |
| 627 | 626 |
| 628 if (!tmmbr_send_) | 627 if (!tmmbr_send_) |
| 629 return nullptr; | 628 return nullptr; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 // but we can't because of an incorrect warning (C4822) in MVS 2013. | 1051 // but we can't because of an incorrect warning (C4822) in MVS 2013. |
| 1053 } sender(transport_, event_log_); | 1052 } sender(transport_, event_log_); |
| 1054 | 1053 |
| 1055 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE)); | 1054 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE)); |
| 1056 uint8_t buffer[IP_PACKET_SIZE]; | 1055 uint8_t buffer[IP_PACKET_SIZE]; |
| 1057 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) && | 1056 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) && |
| 1058 !sender.send_failure_; | 1057 !sender.send_failure_; |
| 1059 } | 1058 } |
| 1060 | 1059 |
| 1061 } // namespace webrtc | 1060 } // namespace webrtc |
| OLD | NEW |