| 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 |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 16 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 17 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" | 17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 18 | 18 |
| 19 using webrtc::RtcpBandwidthObserver; | 19 using webrtc::RtcpBandwidthObserver; |
| 20 using webrtc::BitrateObserver; | 20 using webrtc::BitrateObserver; |
| 21 using webrtc::BitrateController; | 21 using webrtc::BitrateController; |
| 22 | 22 |
| 23 uint8_t WeightedLoss(int num_packets1, uint8_t fraction_loss1, | 23 uint8_t WeightedLoss(int num_packets1, uint8_t fraction_loss1, |
| 24 int num_packets2, uint8_t fraction_loss2) { | 24 int num_packets2, uint8_t fraction_loss2) { |
| 25 int weighted_sum = num_packets1 * fraction_loss1 + | 25 int weighted_sum = num_packets1 * fraction_loss1 + |
| 26 num_packets2 * fraction_loss2; | 26 num_packets2 * fraction_loss2; |
| 27 int total_num_packets = num_packets1 + num_packets2; | 27 int total_num_packets = num_packets1 + num_packets2; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 EXPECT_EQ(120000, bitrate_observer_.last_bitrate_); | 388 EXPECT_EQ(120000, bitrate_observer_.last_bitrate_); |
| 389 controller_->SetReservedBitrate(50000); | 389 controller_->SetReservedBitrate(50000); |
| 390 bandwidth_observer_->OnReceivedEstimatedBitrate(120000); | 390 bandwidth_observer_->OnReceivedEstimatedBitrate(120000); |
| 391 // Limited by min bitrate. | 391 // Limited by min bitrate. |
| 392 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); | 392 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); |
| 393 | 393 |
| 394 controller_->SetReservedBitrate(10000); | 394 controller_->SetReservedBitrate(10000); |
| 395 bandwidth_observer_->OnReceivedEstimatedBitrate(1); | 395 bandwidth_observer_->OnReceivedEstimatedBitrate(1); |
| 396 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); | 396 EXPECT_EQ(100000, bitrate_observer_.last_bitrate_); |
| 397 } | 397 } |
| OLD | NEW |