| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 case kSendSideEstimator: | 92 case kSendSideEstimator: |
| 93 return new SendSideBweSender(kbps, observer, clock); | 93 return new SendSideBweSender(kbps, observer, clock); |
| 94 case kNadaEstimator: | 94 case kNadaEstimator: |
| 95 return new NadaBweSender(kbps, observer, clock); | 95 return new NadaBweSender(kbps, observer, clock); |
| 96 case kTcpEstimator: | 96 case kTcpEstimator: |
| 97 FALLTHROUGH(); | 97 FALLTHROUGH(); |
| 98 case kNullEstimator: | 98 case kNullEstimator: |
| 99 return new NullBweSender(); | 99 return new NullBweSender(); |
| 100 } | 100 } |
| 101 assert(false); | 101 assert(false); |
| 102 return NULL; | 102 return nullptr; |
| 103 } | 103 } |
| 104 | 104 |
| 105 BweReceiver* CreateBweReceiver(BandwidthEstimatorType type, | 105 BweReceiver* CreateBweReceiver(BandwidthEstimatorType type, |
| 106 int flow_id, | 106 int flow_id, |
| 107 bool plot) { | 107 bool plot) { |
| 108 switch (type) { | 108 switch (type) { |
| 109 case kRembEstimator: | 109 case kRembEstimator: |
| 110 return new RembReceiver(flow_id, plot); | 110 return new RembReceiver(flow_id, plot); |
| 111 case kSendSideEstimator: | 111 case kSendSideEstimator: |
| 112 return new SendSideBweReceiver(flow_id); | 112 return new SendSideBweReceiver(flow_id); |
| 113 case kNadaEstimator: | 113 case kNadaEstimator: |
| 114 return new NadaBweReceiver(flow_id); | 114 return new NadaBweReceiver(flow_id); |
| 115 case kTcpEstimator: | 115 case kTcpEstimator: |
| 116 return new TcpBweReceiver(flow_id); | 116 return new TcpBweReceiver(flow_id); |
| 117 case kNullEstimator: | 117 case kNullEstimator: |
| 118 return new BweReceiver(flow_id); | 118 return new BweReceiver(flow_id); |
| 119 } | 119 } |
| 120 assert(false); | 120 assert(false); |
| 121 return NULL; | 121 return nullptr; |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Take into account all LinkedSet content. | 124 // Take into account all LinkedSet content. |
| 125 void BweReceiver::UpdateLoss() { | 125 void BweReceiver::UpdateLoss() { |
| 126 loss_account_.Add(LinkedSetPacketLossRatio()); | 126 loss_account_.Add(LinkedSetPacketLossRatio()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Preserve 10% latest packets and update packet loss based on the oldest | 129 // Preserve 10% latest packets and update packet loss based on the oldest |
| 130 // 90%, that will be removed. | 130 // 90%, that will be removed. |
| 131 void BweReceiver::RelieveSetAndUpdateLoss() { | 131 void BweReceiver::RelieveSetAndUpdateLoss() { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 float LossAccount::LossRatio() { | 272 float LossAccount::LossRatio() { |
| 273 if (num_total == 0) | 273 if (num_total == 0) |
| 274 return 0.0f; | 274 return 0.0f; |
| 275 return static_cast<float>(num_lost) / num_total; | 275 return static_cast<float>(num_lost) / num_total; |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace bwe | 278 } // namespace bwe |
| 279 } // namespace testing | 279 } // namespace testing |
| 280 } // namespace webrtc | 280 } // namespace webrtc |
| OLD | NEW |