OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include "webrtc/modules/congestion_controller/congestion_controller_unittests_h
elper.h" | |
12 | |
13 #include "webrtc/base/checks.h" | |
14 #include "webrtc/test/gtest.h" | |
15 | |
16 namespace webrtc { | |
17 void ComparePacketFeedbackVectors(const std::vector<PacketFeedback>& truth, | |
18 const std::vector<PacketFeedback>& input) { | |
19 ASSERT_EQ(truth.size(), input.size()); | |
20 size_t len = truth.size(); | |
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 | |
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 | |
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 | |
27 // equal. However, the difference must be the same for all x. | |
28 int64_t arrival_time_delta = | |
29 truth[0].arrival_time_ms - input[0].arrival_time_ms; | |
30 for (size_t i = 0; i < len; ++i) { | |
31 RTC_CHECK(truth[i].arrival_time_ms != PacketFeedback::kNotReceived); | |
32 if (input[i].arrival_time_ms != PacketFeedback::kNotReceived) { | |
33 EXPECT_EQ(truth[i].arrival_time_ms, | |
34 input[i].arrival_time_ms + arrival_time_delta); | |
35 } | |
36 EXPECT_EQ(truth[i].send_time_ms, input[i].send_time_ms); | |
37 EXPECT_EQ(truth[i].sequence_number, input[i].sequence_number); | |
38 EXPECT_EQ(truth[i].payload_size, input[i].payload_size); | |
39 EXPECT_EQ(truth[i].pacing_info, input[i].pacing_info); | |
40 } | |
41 } | |
42 } // namespace webrtc | |
OLD | NEW |