| 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 |
| 11 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" |
| 12 | 12 |
| 13 #include <limits> | 13 #include <limits> |
| 14 | 14 |
| 15 #include "webrtc/base/common.h" | 15 #include "webrtc/base/common.h" |
| 16 #include "webrtc/base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
| 17 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h" | 17 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h" |
| 18 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h" | 18 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h" |
| 19 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h" |
| 20 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/abs_send_time.
h" |
| 20 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/tcp.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/tcp.h" |
| 21 | 22 |
| 22 namespace webrtc { | 23 namespace webrtc { |
| 23 namespace testing { | 24 namespace testing { |
| 24 namespace bwe { | 25 namespace bwe { |
| 25 | 26 |
| 26 // With the assumption that packet loss is lower than 97%, the max gap | 27 // With the assumption that packet loss is lower than 97%, the max gap |
| 27 // between elements in the set is lower than 0x8000, hence we have a | 28 // between elements in the set is lower than 0x8000, hence we have a |
| 28 // total order in the set. For (x,y,z) subset of the LinkedSet, | 29 // total order in the set. For (x,y,z) subset of the LinkedSet, |
| 29 // (x<=y and y<=z) ==> x<=z so the set can be sorted. | 30 // (x<=y and y<=z) ==> x<=z so the set can be sorted. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return static_cast<int64_t>(timestamp) * kTimestampToMs; | 84 return static_cast<int64_t>(timestamp) * kTimestampToMs; |
| 84 } | 85 } |
| 85 | 86 |
| 86 BweSender* CreateBweSender(BandwidthEstimatorType estimator, | 87 BweSender* CreateBweSender(BandwidthEstimatorType estimator, |
| 87 int kbps, | 88 int kbps, |
| 88 BitrateObserver* observer, | 89 BitrateObserver* observer, |
| 89 Clock* clock) { | 90 Clock* clock) { |
| 90 switch (estimator) { | 91 switch (estimator) { |
| 91 case kRembEstimator: | 92 case kRembEstimator: |
| 92 return new RembBweSender(kbps, observer, clock); | 93 return new RembBweSender(kbps, observer, clock); |
| 93 case kFullSendSideEstimator: | 94 case kAbsSendTimeEstimator: |
| 94 return new FullBweSender(kbps, observer, clock); | 95 return new AbsSendTimeBweSender(kbps, observer, clock); |
| 95 case kNadaEstimator: | 96 case kNadaEstimator: |
| 96 return new NadaBweSender(kbps, observer, clock); | 97 return new NadaBweSender(kbps, observer, clock); |
| 98 case kSendSideEstimator: |
| 99 return new SendSideBweSender(kbps, observer, clock); |
| 97 case kTcpEstimator: | 100 case kTcpEstimator: |
| 98 FALLTHROUGH(); | 101 FALLTHROUGH(); |
| 99 case kNullEstimator: | 102 case kNullEstimator: |
| 100 return new NullBweSender(); | 103 return new NullBweSender(); |
| 101 } | 104 } |
| 102 assert(false); | 105 assert(false); |
| 103 return NULL; | 106 return NULL; |
| 104 } | 107 } |
| 105 | 108 |
| 106 BweReceiver* CreateBweReceiver(BandwidthEstimatorType type, | 109 BweReceiver* CreateBweReceiver(BandwidthEstimatorType type, |
| 107 int flow_id, | 110 int flow_id, |
| 108 bool plot) { | 111 bool plot) { |
| 109 switch (type) { | 112 switch (type) { |
| 110 case kRembEstimator: | 113 case kRembEstimator: |
| 111 return new RembReceiver(flow_id, plot); | 114 return new RembReceiver(flow_id, plot); |
| 112 case kFullSendSideEstimator: | 115 case kAbsSendTimeEstimator: |
| 113 return new SendSideBweReceiver(flow_id); | 116 return new AbsSendTimeBweReceiver(flow_id); |
| 114 case kNadaEstimator: | 117 case kNadaEstimator: |
| 115 return new NadaBweReceiver(flow_id); | 118 return new NadaBweReceiver(flow_id); |
| 119 case kSendSideEstimator: |
| 120 return new SendSideBweReceiver(flow_id); |
| 116 case kTcpEstimator: | 121 case kTcpEstimator: |
| 117 return new TcpBweReceiver(flow_id); | 122 return new TcpBweReceiver(flow_id); |
| 118 case kNullEstimator: | 123 case kNullEstimator: |
| 119 return new BweReceiver(flow_id); | 124 return new BweReceiver(flow_id); |
| 120 } | 125 } |
| 121 assert(false); | 126 assert(false); |
| 122 return NULL; | 127 return NULL; |
| 123 } | 128 } |
| 124 | 129 |
| 125 // Take into account all LinkedSet content. | 130 // Take into account all LinkedSet content. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 277 |
| 273 float LossAccount::LossRatio() { | 278 float LossAccount::LossRatio() { |
| 274 if (num_total == 0) | 279 if (num_total == 0) |
| 275 return 0.0f; | 280 return 0.0f; |
| 276 return static_cast<float>(num_lost) / num_total; | 281 return static_cast<float>(num_lost) / num_total; |
| 277 } | 282 } |
| 278 | 283 |
| 279 } // namespace bwe | 284 } // namespace bwe |
| 280 } // namespace testing | 285 } // namespace testing |
| 281 } // namespace webrtc | 286 } // namespace webrtc |
| OLD | NEW |