| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 13 matching lines...) Expand all Loading... |
| 24 class TestProbeBitrateEstimator : public ::testing::Test { | 24 class TestProbeBitrateEstimator : public ::testing::Test { |
| 25 public: | 25 public: |
| 26 TestProbeBitrateEstimator() : probe_bitrate_estimator_() {} | 26 TestProbeBitrateEstimator() : probe_bitrate_estimator_() {} |
| 27 | 27 |
| 28 // TODO(philipel): Use PacedPacketInfo when ProbeBitrateEstimator is rewritten | 28 // TODO(philipel): Use PacedPacketInfo when ProbeBitrateEstimator is rewritten |
| 29 // to use that information. | 29 // to use that information. |
| 30 void AddPacketFeedback(int probe_cluster_id, | 30 void AddPacketFeedback(int probe_cluster_id, |
| 31 size_t size_bytes, | 31 size_t size_bytes, |
| 32 int64_t send_time_ms, | 32 int64_t send_time_ms, |
| 33 int64_t arrival_time_ms) { | 33 int64_t arrival_time_ms) { |
| 34 PacketInfo info(arrival_time_ms, send_time_ms, 0, size_bytes, | 34 PacketFeedback packet_feedback(arrival_time_ms, send_time_ms, 0, size_bytes, |
| 35 PacedPacketInfo(probe_cluster_id, -1, -1)); | 35 PacedPacketInfo(probe_cluster_id, -1, -1)); |
| 36 measured_bps_ = | 36 measured_bps_ = |
| 37 probe_bitrate_estimator_.HandleProbeAndEstimateBitrate(info); | 37 probe_bitrate_estimator_.HandleProbeAndEstimateBitrate(packet_feedback); |
| 38 } | 38 } |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 int measured_bps_ = INVALID_BPS; | 41 int measured_bps_ = INVALID_BPS; |
| 42 ProbeBitrateEstimator probe_bitrate_estimator_; | 42 ProbeBitrateEstimator probe_bitrate_estimator_; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 TEST_F(TestProbeBitrateEstimator, OneCluster) { | 45 TEST_F(TestProbeBitrateEstimator, OneCluster) { |
| 46 AddPacketFeedback(0, 1000, 0, 10); | 46 AddPacketFeedback(0, 1000, 0, 10); |
| 47 AddPacketFeedback(0, 1000, 10, 20); | 47 AddPacketFeedback(0, 1000, 10, 20); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 TEST_F(TestProbeBitrateEstimator, IgnoreSizeFirstReceivePacket) { | 138 TEST_F(TestProbeBitrateEstimator, IgnoreSizeFirstReceivePacket) { |
| 139 AddPacketFeedback(0, 1500, 0, 10); | 139 AddPacketFeedback(0, 1500, 0, 10); |
| 140 AddPacketFeedback(0, 1000, 10, 20); | 140 AddPacketFeedback(0, 1000, 10, 20); |
| 141 AddPacketFeedback(0, 1000, 20, 30); | 141 AddPacketFeedback(0, 1000, 20, 30); |
| 142 AddPacketFeedback(0, 1000, 30, 40); | 142 AddPacketFeedback(0, 1000, 30, 40); |
| 143 | 143 |
| 144 EXPECT_NEAR(measured_bps_, 800000, 10); | 144 EXPECT_NEAR(measured_bps_, 800000, 10); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace webrtc | 147 } // namespace webrtc |
| OLD | NEW |