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

Side by Side Diff: webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.cc

Issue 2628563003: Propagate packet pacing information to SenTimeHistory (Closed)
Patch Set: Rebase Created 3 years, 10 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) 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 #include "webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.h " 10 #include "webrtc/modules/congestion_controller/delay_based_bwe_unittest_helper.h "
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 RTC_CHECK(packets != NULL); 54 RTC_CHECK(packets != NULL);
55 size_t bits_per_frame = (bitrate_bps_ + fps_ / 2) / fps_; 55 size_t bits_per_frame = (bitrate_bps_ + fps_ / 2) / fps_;
56 size_t n_packets = 56 size_t n_packets =
57 std::max<size_t>((bits_per_frame + 4 * kMtu) / (8 * kMtu), 1u); 57 std::max<size_t>((bits_per_frame + 4 * kMtu) / (8 * kMtu), 1u);
58 size_t payload_size = (bits_per_frame + 4 * n_packets) / (8 * n_packets); 58 size_t payload_size = (bits_per_frame + 4 * n_packets) / (8 * n_packets);
59 for (size_t i = 0; i < n_packets; ++i) { 59 for (size_t i = 0; i < n_packets; ++i) {
60 PacketInfo packet(-1, sequence_number_++); 60 PacketInfo packet(-1, sequence_number_++);
61 packet.send_time_ms = (time_now_us + kSendSideOffsetUs) / 1000; 61 packet.send_time_ms = (time_now_us + kSendSideOffsetUs) / 1000;
62 packet.payload_size = payload_size; 62 packet.payload_size = payload_size;
63 packet.probe_cluster_id = PacketInfo::kNotAProbe; 63 packet.probe_cluster_id = PacedPacketInfo::kNotAProbe;
64 packets->push_back(packet); 64 packets->push_back(packet);
65 } 65 }
66 next_rtp_time_ = time_now_us + (1000000 + fps_ / 2) / fps_; 66 next_rtp_time_ = time_now_us + (1000000 + fps_ / 2) / fps_;
67 return next_rtp_time_; 67 return next_rtp_time_;
68 } 68 }
69 69
70 // The send-side time when the next frame can be generated. 70 // The send-side time when the next frame can be generated.
71 int64_t RtpStream::next_rtp_time() const { 71 int64_t RtpStream::next_rtp_time() const {
72 return next_rtp_time_; 72 return next_rtp_time_;
73 } 73 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 stream_generator_->AddStream(new test::RtpStream(30, 3e5)); 162 stream_generator_->AddStream(new test::RtpStream(30, 3e5));
163 } 163 }
164 164
165 const uint32_t DelayBasedBweTest::kDefaultSsrc = 0; 165 const uint32_t DelayBasedBweTest::kDefaultSsrc = 0;
166 166
167 void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms, 167 void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms,
168 int64_t send_time_ms, 168 int64_t send_time_ms,
169 uint16_t sequence_number, 169 uint16_t sequence_number,
170 size_t payload_size) { 170 size_t payload_size) {
171 IncomingFeedback(arrival_time_ms, send_time_ms, sequence_number, payload_size, 171 IncomingFeedback(arrival_time_ms, send_time_ms, sequence_number, payload_size,
172 PacketInfo::kNotAProbe); 172 PacedPacketInfo::kNotAProbe);
173 } 173 }
174 174
175 void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms, 175 void DelayBasedBweTest::IncomingFeedback(int64_t arrival_time_ms,
176 int64_t send_time_ms, 176 int64_t send_time_ms,
177 uint16_t sequence_number, 177 uint16_t sequence_number,
178 size_t payload_size, 178 size_t payload_size,
179 int probe_cluster_id) { 179 int probe_cluster_id) {
180 RTC_CHECK_GE(arrival_time_ms + arrival_time_offset_ms_, 0); 180 RTC_CHECK_GE(arrival_time_ms + arrival_time_offset_ms_, 0);
181 PacketInfo packet(arrival_time_ms + arrival_time_offset_ms_, send_time_ms, 181 PacketInfo packet(arrival_time_ms + arrival_time_offset_ms_, send_time_ms,
182 sequence_number, payload_size, probe_cluster_id); 182 sequence_number, payload_size, probe_cluster_id);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 EXPECT_EQ(0u, ssrcs.size()); 273 EXPECT_EQ(0u, ssrcs.size());
274 clock_.AdvanceTimeMilliseconds(1000); 274 clock_.AdvanceTimeMilliseconds(1000);
275 EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); 275 EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps));
276 EXPECT_FALSE(bitrate_observer_.updated()); 276 EXPECT_FALSE(bitrate_observer_.updated());
277 bitrate_observer_.Reset(); 277 bitrate_observer_.Reset();
278 clock_.AdvanceTimeMilliseconds(1000); 278 clock_.AdvanceTimeMilliseconds(1000);
279 // Inserting packets for 5 seconds to get a valid estimate. 279 // Inserting packets for 5 seconds to get a valid estimate.
280 for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) { 280 for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) {
281 // NOTE!!! If the following line is moved under the if case then this test 281 // NOTE!!! If the following line is moved under the if case then this test
282 // wont work on windows realease bots. 282 // wont work on windows realease bots.
283 int cluster_id = i < kInitialProbingPackets ? 0 : PacketInfo::kNotAProbe; 283 int cluster_id =
284 i < kInitialProbingPackets ? 0 : PacedPacketInfo::kNotAProbe;
284 285
285 if (i == kNumInitialPackets) { 286 if (i == kNumInitialPackets) {
286 EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); 287 EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps));
287 EXPECT_EQ(0u, ssrcs.size()); 288 EXPECT_EQ(0u, ssrcs.size());
288 EXPECT_FALSE(bitrate_observer_.updated()); 289 EXPECT_FALSE(bitrate_observer_.updated());
289 bitrate_observer_.Reset(); 290 bitrate_observer_.Reset();
290 } 291 }
291 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, 292 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms,
292 sequence_number++, kMtu, cluster_id); 293 sequence_number++, kMtu, cluster_id);
293 clock_.AdvanceTimeMilliseconds(1000 / kFramerate); 294 clock_.AdvanceTimeMilliseconds(1000 / kFramerate);
(...skipping 11 matching lines...) Expand all
305 void DelayBasedBweTest::RateIncreaseReorderingTestHelper( 306 void DelayBasedBweTest::RateIncreaseReorderingTestHelper(
306 uint32_t expected_bitrate_bps) { 307 uint32_t expected_bitrate_bps) {
307 const int kFramerate = 50; // 50 fps to avoid rounding errors. 308 const int kFramerate = 50; // 50 fps to avoid rounding errors.
308 const int kFrameIntervalMs = 1000 / kFramerate; 309 const int kFrameIntervalMs = 1000 / kFramerate;
309 int64_t send_time_ms = 0; 310 int64_t send_time_ms = 0;
310 uint16_t sequence_number = 0; 311 uint16_t sequence_number = 0;
311 // Inserting packets for five seconds to get a valid estimate. 312 // Inserting packets for five seconds to get a valid estimate.
312 for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) { 313 for (int i = 0; i < 5 * kFramerate + 1 + kNumInitialPackets; ++i) {
313 // NOTE!!! If the following line is moved under the if case then this test 314 // NOTE!!! If the following line is moved under the if case then this test
314 // wont work on windows realease bots. 315 // wont work on windows realease bots.
315 int cluster_id = i < kInitialProbingPackets ? 0 : PacketInfo::kNotAProbe; 316 int cluster_id =
317 i < kInitialProbingPackets ? 0 : PacedPacketInfo::kNotAProbe;
316 318
317 // TODO(sprang): Remove this hack once the single stream estimator is gone, 319 // TODO(sprang): Remove this hack once the single stream estimator is gone,
318 // as it doesn't do anything in Process(). 320 // as it doesn't do anything in Process().
319 if (i == kNumInitialPackets) { 321 if (i == kNumInitialPackets) {
320 // Process after we have enough frames to get a valid input rate estimate. 322 // Process after we have enough frames to get a valid input rate estimate.
321 323
322 EXPECT_FALSE(bitrate_observer_.updated()); // No valid estimate. 324 EXPECT_FALSE(bitrate_observer_.updated()); // No valid estimate.
323 } 325 }
324 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, 326 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms,
325 sequence_number++, kMtu, cluster_id); 327 sequence_number++, kMtu, cluster_id);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms, 495 IncomingFeedback(clock_.TimeInMilliseconds(), send_time_ms,
494 sequence_number++, 1000); 496 sequence_number++, 1000);
495 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); 497 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs);
496 send_time_ms += kFrameIntervalMs; 498 send_time_ms += kFrameIntervalMs;
497 } 499 }
498 uint32_t bitrate_after = 0; 500 uint32_t bitrate_after = 0;
499 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); 501 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after);
500 EXPECT_LT(bitrate_after, bitrate_before); 502 EXPECT_LT(bitrate_after, bitrate_before);
501 } 503 }
502 } // namespace webrtc 504 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698