| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 bool VieRemb::InUse() const { | 88 bool VieRemb::InUse() const { |
| 89 rtc::CritScope lock(&list_crit_); | 89 rtc::CritScope lock(&list_crit_); |
| 90 return !receive_modules_.empty() || !rtcp_sender_.empty(); | 90 return !receive_modules_.empty() || !rtcp_sender_.empty(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void VieRemb::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, | 93 void VieRemb::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, |
| 94 uint32_t bitrate) { | 94 uint32_t bitrate) { |
| 95 RtpRtcp* sender = NULL; | 95 RtpRtcp* sender = nullptr; |
| 96 { | 96 { |
| 97 rtc::CritScope lock(&list_crit_); | 97 rtc::CritScope lock(&list_crit_); |
| 98 // If we already have an estimate, check if the new total estimate is below | 98 // If we already have an estimate, check if the new total estimate is below |
| 99 // kSendThresholdPercent of the previous estimate. | 99 // kSendThresholdPercent of the previous estimate. |
| 100 if (last_send_bitrate_ > 0) { | 100 if (last_send_bitrate_ > 0) { |
| 101 uint32_t new_remb_bitrate = last_send_bitrate_ - bitrate_ + bitrate; | 101 uint32_t new_remb_bitrate = last_send_bitrate_ - bitrate_ + bitrate; |
| 102 | 102 |
| 103 if (new_remb_bitrate < kSendThresholdPercent * last_send_bitrate_ / 100) { | 103 if (new_remb_bitrate < kSendThresholdPercent * last_send_bitrate_ / 100) { |
| 104 // The new bitrate estimate is less than kSendThresholdPercent % of the | 104 // The new bitrate estimate is less than kSendThresholdPercent % of the |
| 105 // last report. Send a REMB asap. | 105 // last report. Send a REMB asap. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 128 } | 128 } |
| 129 last_send_bitrate_ = bitrate_; | 129 last_send_bitrate_ = bitrate_; |
| 130 } | 130 } |
| 131 | 131 |
| 132 if (sender) { | 132 if (sender) { |
| 133 sender->SetREMBData(bitrate_, ssrcs); | 133 sender->SetREMBData(bitrate_, ssrcs); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace webrtc | 137 } // namespace webrtc |
| OLD | NEW |