Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc

Issue 2005313003: Propagate probing cluster id to SendTimeHistory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Only save probe cluster id in send time history. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 ~SendTimeHistoryTest() {} 28 ~SendTimeHistoryTest() {}
29 29
30 virtual void SetUp() {} 30 virtual void SetUp() {}
31 31
32 virtual void TearDown() {} 32 virtual void TearDown() {}
33 33
34 void AddPacketWithSendTime(uint16_t sequence_number, 34 void AddPacketWithSendTime(uint16_t sequence_number,
35 size_t length, 35 size_t length,
36 bool was_paced, 36 bool was_paced,
37 int64_t send_time_ms) { 37 int64_t send_time_ms) {
38 history_.AddAndRemoveOld(sequence_number, length, was_paced); 38 history_.AddAndRemoveOld(sequence_number, length, was_paced,
39 PacketInfo::kNotAProbe);
danilchap 2016/05/31 13:06:49 better propagate and test probe_cluster_id field t
philipel 2016/05/31 14:34:58 Integrated testing of cluster id into existing tes
39 history_.OnSentPacket(sequence_number, send_time_ms); 40 history_.OnSentPacket(sequence_number, send_time_ms);
40 } 41 }
41 42
42 webrtc::SimulatedClock clock_; 43 webrtc::SimulatedClock clock_;
43 SendTimeHistory history_; 44 SendTimeHistory history_;
44 }; 45 };
45 46
46 // Help class extended so we can do EXPECT_EQ and collections. 47 // Help class extended so we can do EXPECT_EQ and collections.
47 class PacketInfo : public webrtc::PacketInfo { 48 class PacketInfo : public webrtc::PacketInfo {
48 public: 49 public:
49 PacketInfo() : webrtc::PacketInfo(-1, 0, 0, 0, 0, false) {} 50 PacketInfo()
51 : webrtc::PacketInfo(-1,
52 0,
53 0,
54 0,
55 0,
56 false,
57 webrtc::PacketInfo::kNotAProbe) {}
50 PacketInfo(int64_t arrival_time_ms, uint16_t sequence_number) 58 PacketInfo(int64_t arrival_time_ms, uint16_t sequence_number)
51 : PacketInfo(arrival_time_ms, 0, sequence_number, 0, false) {} 59 : PacketInfo(arrival_time_ms, 0, sequence_number, 0, false) {}
52 PacketInfo(int64_t arrival_time_ms, 60 PacketInfo(int64_t arrival_time_ms,
53 int64_t send_time_ms, 61 int64_t send_time_ms,
54 uint16_t sequence_number, 62 uint16_t sequence_number,
55 size_t payload_size, 63 size_t payload_size,
56 bool was_paced) 64 bool was_paced)
57 : webrtc::PacketInfo(-1, 65 : webrtc::PacketInfo(-1,
58 arrival_time_ms, 66 arrival_time_ms,
59 send_time_ms, 67 send_time_ms,
60 sequence_number, 68 sequence_number,
61 payload_size, 69 payload_size,
62 was_paced) {} 70 was_paced,
71 webrtc::PacketInfo::kNotAProbe) {}
63 bool operator==(const PacketInfo& other) const { 72 bool operator==(const PacketInfo& other) const {
64 return arrival_time_ms == other.arrival_time_ms && 73 return arrival_time_ms == other.arrival_time_ms &&
65 send_time_ms == other.send_time_ms && 74 send_time_ms == other.send_time_ms &&
66 sequence_number == other.sequence_number && 75 sequence_number == other.sequence_number &&
67 payload_size == other.payload_size && was_paced == other.was_paced; 76 payload_size == other.payload_size && was_paced == other.was_paced &&
77 probe_cluster_id == other.probe_cluster_id;
68 } 78 }
69 }; 79 };
70 80
71 TEST_F(SendTimeHistoryTest, AddRemoveOne) { 81 TEST_F(SendTimeHistoryTest, AddRemoveOne) {
72 const uint16_t kSeqNo = 10; 82 const uint16_t kSeqNo = 10;
73 const PacketInfo kSentPacket(0, 1, kSeqNo, 1, true); 83 const PacketInfo kSentPacket(0, 1, kSeqNo, 1, true);
74 AddPacketWithSendTime(kSeqNo, 1, true, 1); 84 AddPacketWithSendTime(kSeqNo, 1, true, 1);
75 85
76 PacketInfo received_packet(0, 0, kSeqNo, 0, false); 86 PacketInfo received_packet(0, 0, kSeqNo, 0, false);
77 EXPECT_TRUE(history_.GetInfo(&received_packet, false)); 87 EXPECT_TRUE(history_.GetInfo(&received_packet, false));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 sent_packets.push_back(PacketInfo(0, static_cast<int64_t>(i), 124 sent_packets.push_back(PacketInfo(0, static_cast<int64_t>(i),
115 static_cast<uint16_t>(i), kPacketSize, 125 static_cast<uint16_t>(i), kPacketSize,
116 kPaced)); 126 kPaced));
117 received_packets.push_back( 127 received_packets.push_back(
118 PacketInfo(static_cast<int64_t>(i) + kTransmissionTime, 0, 128 PacketInfo(static_cast<int64_t>(i) + kTransmissionTime, 0,
119 static_cast<uint16_t>(i), kPacketSize, false)); 129 static_cast<uint16_t>(i), kPacketSize, false));
120 } 130 }
121 for (size_t i = 0; i < num_items; ++i) { 131 for (size_t i = 0; i < num_items; ++i) {
122 history_.AddAndRemoveOld(sent_packets[i].sequence_number, 132 history_.AddAndRemoveOld(sent_packets[i].sequence_number,
123 sent_packets[i].payload_size, 133 sent_packets[i].payload_size,
124 sent_packets[i].was_paced); 134 sent_packets[i].was_paced, PacketInfo::kNotAProbe);
danilchap 2016/05/31 13:06:50 sent_packets[i].probe_cluster_id
philipel 2016/05/31 14:34:58 Done.
125 } 135 }
126 for (size_t i = 0; i < num_items; ++i) 136 for (size_t i = 0; i < num_items; ++i)
127 history_.OnSentPacket(sent_packets[i].sequence_number, 137 history_.OnSentPacket(sent_packets[i].sequence_number,
128 sent_packets[i].send_time_ms); 138 sent_packets[i].send_time_ms);
129 std::random_shuffle(received_packets.begin(), received_packets.end()); 139 std::random_shuffle(received_packets.begin(), received_packets.end());
130 for (size_t i = 0; i < num_items; ++i) { 140 for (size_t i = 0; i < num_items; ++i) {
131 PacketInfo packet = received_packets[i]; 141 PacketInfo packet = received_packets[i];
132 EXPECT_TRUE(history_.GetInfo(&packet, false)); 142 EXPECT_TRUE(history_.GetInfo(&packet, false));
133 PacketInfo sent_packet = sent_packets[packet.sequence_number]; 143 PacketInfo sent_packet = sent_packets[packet.sequence_number];
134 sent_packet.arrival_time_ms = packet.arrival_time_ms; 144 sent_packet.arrival_time_ms = packet.arrival_time_ms;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 EXPECT_TRUE(history_.GetInfo(&info2, true)); 235 EXPECT_TRUE(history_.GetInfo(&info2, true));
226 EXPECT_EQ(packets[1], info2); 236 EXPECT_EQ(packets[1], info2);
227 237
228 PacketInfo info3(0, 0, packets[2].sequence_number, 0, false); 238 PacketInfo info3(0, 0, packets[2].sequence_number, 0, false);
229 EXPECT_TRUE(history_.GetInfo(&info3, true)); 239 EXPECT_TRUE(history_.GetInfo(&info3, true));
230 EXPECT_EQ(packets[2], info3); 240 EXPECT_EQ(packets[2], info3);
231 } 241 }
232 242
233 } // namespace test 243 } // namespace test
234 } // namespace webrtc 244 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698