OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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/congestion_controller/congestion_controller_unittests_h
elper.h" | 11 #include "webrtc/modules/congestion_controller/congestion_controller_unittests_h
elper.h" |
12 | 12 |
13 #include "webrtc/rtc_base/checks.h" | 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/test/gtest.h" | 14 #include "webrtc/test/gtest.h" |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 void ComparePacketFeedbackVectors(const std::vector<PacketFeedback>& truth, | 17 void ComparePacketFeedbackVectors(const std::vector<PacketFeedback>& truth, |
18 const std::vector<PacketFeedback>& input) { | 18 const std::vector<PacketFeedback>& input) { |
19 ASSERT_EQ(truth.size(), input.size()); | 19 ASSERT_EQ(truth.size(), input.size()); |
20 size_t len = truth.size(); | 20 size_t len = truth.size(); |
21 // truth contains the input data for the test, and input is what will be | 21 // truth contains the input data for the test, and input is what will be |
22 // sent to the bandwidth estimator. truth.arrival_tims_ms is used to | 22 // sent to the bandwidth estimator. truth.arrival_tims_ms is used to |
23 // populate the transport feedback messages. As these times may be changed | 23 // populate the transport feedback messages. As these times may be changed |
24 // (because of resolution limits in the packets, and because of the time | 24 // (because of resolution limits in the packets, and because of the time |
25 // base adjustment performed by the TransportFeedbackAdapter at the first | 25 // base adjustment performed by the TransportFeedbackAdapter at the first |
26 // packet, the truth[x].arrival_time and input[x].arrival_time may not be | 26 // packet, the truth[x].arrival_time and input[x].arrival_time may not be |
27 // equal. However, the difference must be the same for all x. | 27 // equal. However, the difference must be the same for all x. |
28 int64_t arrival_time_delta = | 28 int64_t arrival_time_delta = |
29 truth[0].arrival_time_ms - input[0].arrival_time_ms; | 29 truth[0].arrival_time_ms - input[0].arrival_time_ms; |
30 for (size_t i = 0; i < len; ++i) { | 30 for (size_t i = 0; i < len; ++i) { |
31 RTC_CHECK(truth[i].arrival_time_ms != PacketFeedback::kNotReceived); | 31 RTC_CHECK(truth[i].arrival_time_ms != PacketFeedback::kNotReceived); |
32 if (input[i].arrival_time_ms != PacketFeedback::kNotReceived) { | 32 if (input[i].arrival_time_ms != PacketFeedback::kNotReceived) { |
33 EXPECT_EQ(truth[i].arrival_time_ms, | 33 EXPECT_EQ(truth[i].arrival_time_ms, |
34 input[i].arrival_time_ms + arrival_time_delta); | 34 input[i].arrival_time_ms + arrival_time_delta); |
35 } | 35 } |
36 EXPECT_EQ(truth[i].send_time_ms, input[i].send_time_ms); | 36 EXPECT_EQ(truth[i].send_time_ms, input[i].send_time_ms); |
37 EXPECT_EQ(truth[i].sequence_number, input[i].sequence_number); | 37 EXPECT_EQ(truth[i].sequence_number, input[i].sequence_number); |
38 EXPECT_EQ(truth[i].payload_size, input[i].payload_size); | 38 EXPECT_EQ(truth[i].payload_size, input[i].payload_size); |
39 EXPECT_EQ(truth[i].pacing_info, input[i].pacing_info); | 39 EXPECT_EQ(truth[i].pacing_info, input[i].pacing_info); |
40 } | 40 } |
41 } | 41 } |
42 } // namespace webrtc | 42 } // namespace webrtc |
OLD | NEW |