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

Side by Side Diff: webrtc/modules/congestion_controller/transport_feedback_adapter_unittest.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) 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 ComparePacketVectors(expected_packets, 250 ComparePacketVectors(expected_packets,
251 adapter_->GetTransportFeedbackVector()); 251 adapter_->GetTransportFeedbackVector());
252 } 252 }
253 253
254 TEST_F(TransportFeedbackAdapterTest, SendTimeWrapsBothWays) { 254 TEST_F(TransportFeedbackAdapterTest, SendTimeWrapsBothWays) {
255 int64_t kHighArrivalTimeMs = rtcp::TransportFeedback::kDeltaScaleFactor * 255 int64_t kHighArrivalTimeMs = rtcp::TransportFeedback::kDeltaScaleFactor *
256 static_cast<int64_t>(1 << 8) * 256 static_cast<int64_t>(1 << 8) *
257 static_cast<int64_t>((1 << 23) - 1) / 1000; 257 static_cast<int64_t>((1 << 23) - 1) / 1000;
258 std::vector<PacketInfo> packets; 258 std::vector<PacketInfo> packets;
259 packets.push_back(PacketInfo(kHighArrivalTimeMs - 64, 200, 0, 1500, 259 packets.push_back(PacketInfo(kHighArrivalTimeMs - 64, 200, 0, 1500,
260 PacketInfo::kNotAProbe)); 260 PacedPacketInfo::kNotAProbe));
261 packets.push_back(PacketInfo(kHighArrivalTimeMs + 64, 210, 1, 1500, 261 packets.push_back(PacketInfo(kHighArrivalTimeMs + 64, 210, 1, 1500,
262 PacketInfo::kNotAProbe)); 262 PacedPacketInfo::kNotAProbe));
263 packets.push_back( 263 packets.push_back(PacketInfo(kHighArrivalTimeMs, 220, 2, 1500,
264 PacketInfo(kHighArrivalTimeMs, 220, 2, 1500, PacketInfo::kNotAProbe)); 264 PacedPacketInfo::kNotAProbe));
265 265
266 for (const PacketInfo& packet : packets) 266 for (const PacketInfo& packet : packets)
267 OnSentPacket(packet); 267 OnSentPacket(packet);
268 268
269 for (size_t i = 0; i < packets.size(); ++i) { 269 for (size_t i = 0; i < packets.size(); ++i) {
270 std::unique_ptr<rtcp::TransportFeedback> feedback( 270 std::unique_ptr<rtcp::TransportFeedback> feedback(
271 new rtcp::TransportFeedback()); 271 new rtcp::TransportFeedback());
272 feedback->SetBase(packets[i].sequence_number, 272 feedback->SetBase(packets[i].sequence_number,
273 packets[i].arrival_time_ms * 1000); 273 packets[i].arrival_time_ms * 1000);
274 274
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 std::vector<PacketInfo> sent_packets; 321 std::vector<PacketInfo> sent_packets;
322 const int64_t kSmallDeltaUs = 322 const int64_t kSmallDeltaUs =
323 rtcp::TransportFeedback::kDeltaScaleFactor * ((1 << 8) - 1); 323 rtcp::TransportFeedback::kDeltaScaleFactor * ((1 << 8) - 1);
324 const int64_t kLargePositiveDeltaUs = 324 const int64_t kLargePositiveDeltaUs =
325 rtcp::TransportFeedback::kDeltaScaleFactor * 325 rtcp::TransportFeedback::kDeltaScaleFactor *
326 std::numeric_limits<int16_t>::max(); 326 std::numeric_limits<int16_t>::max();
327 const int64_t kLargeNegativeDeltaUs = 327 const int64_t kLargeNegativeDeltaUs =
328 rtcp::TransportFeedback::kDeltaScaleFactor * 328 rtcp::TransportFeedback::kDeltaScaleFactor *
329 std::numeric_limits<int16_t>::min(); 329 std::numeric_limits<int16_t>::min();
330 330
331 PacketInfo info(100, 200, 0, 1500, true, PacketInfo::kNotAProbe); 331 PacketInfo info(100, 200, 0, 1500, true, PacedPacketInfo::kNotAProbe);
332 sent_packets.push_back(info); 332 sent_packets.push_back(info);
333 333
334 info.send_time_ms += kSmallDeltaUs / 1000; 334 info.send_time_ms += kSmallDeltaUs / 1000;
335 info.arrival_time_ms += kSmallDeltaUs / 1000; 335 info.arrival_time_ms += kSmallDeltaUs / 1000;
336 ++info.sequence_number; 336 ++info.sequence_number;
337 sent_packets.push_back(info); 337 sent_packets.push_back(info);
338 338
339 info.send_time_ms += kLargePositiveDeltaUs / 1000; 339 info.send_time_ms += kLargePositiveDeltaUs / 1000;
340 info.arrival_time_ms += kLargePositiveDeltaUs / 1000; 340 info.arrival_time_ms += kLargePositiveDeltaUs / 1000;
341 ++info.sequence_number; 341 ++info.sequence_number;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 410
411 TEST_F(TransportFeedbackAdapterTest, UpdatesDelayBasedEstimate) { 411 TEST_F(TransportFeedbackAdapterTest, UpdatesDelayBasedEstimate) {
412 uint16_t seq_num = 0; 412 uint16_t seq_num = 0;
413 size_t kPayloadSize = 1000; 413 size_t kPayloadSize = 1000;
414 // The test must run and insert packets/feedback long enough that the 414 // The test must run and insert packets/feedback long enough that the
415 // BWE computes a valid estimate. 415 // BWE computes a valid estimate.
416 const int64_t kRunTimeMs = 6000; 416 const int64_t kRunTimeMs = 6000;
417 int64_t start_time_ms = clock_.TimeInMilliseconds(); 417 int64_t start_time_ms = clock_.TimeInMilliseconds();
418 while (clock_.TimeInMilliseconds() - start_time_ms < kRunTimeMs) { 418 while (clock_.TimeInMilliseconds() - start_time_ms < kRunTimeMs) {
419 PacketInfo packet(clock_.TimeInMilliseconds(), clock_.TimeInMilliseconds(), 419 PacketInfo packet(clock_.TimeInMilliseconds(), clock_.TimeInMilliseconds(),
420 seq_num, kPayloadSize, PacketInfo::kNotAProbe); 420 seq_num, kPayloadSize, PacedPacketInfo::kNotAProbe);
421 OnSentPacket(packet); 421 OnSentPacket(packet);
422 // Create expected feedback and send into adapter. 422 // Create expected feedback and send into adapter.
423 std::unique_ptr<rtcp::TransportFeedback> feedback( 423 std::unique_ptr<rtcp::TransportFeedback> feedback(
424 new rtcp::TransportFeedback()); 424 new rtcp::TransportFeedback());
425 feedback->SetBase(packet.sequence_number, packet.arrival_time_ms * 1000); 425 feedback->SetBase(packet.sequence_number, packet.arrival_time_ms * 1000);
426 EXPECT_TRUE(feedback->AddReceivedPacket(packet.sequence_number, 426 EXPECT_TRUE(feedback->AddReceivedPacket(packet.sequence_number,
427 packet.arrival_time_ms * 1000)); 427 packet.arrival_time_ms * 1000));
428 rtc::Buffer raw_packet = feedback->Build(); 428 rtc::Buffer raw_packet = feedback->Build();
429 feedback = rtcp::TransportFeedback::ParseFrom(raw_packet.data(), 429 feedback = rtcp::TransportFeedback::ParseFrom(raw_packet.data(),
430 raw_packet.size()); 430 raw_packet.size());
431 EXPECT_TRUE(feedback.get() != nullptr); 431 EXPECT_TRUE(feedback.get() != nullptr);
432 adapter_->OnTransportFeedback(*feedback.get()); 432 adapter_->OnTransportFeedback(*feedback.get());
433 clock_.AdvanceTimeMilliseconds(50); 433 clock_.AdvanceTimeMilliseconds(50);
434 ++seq_num; 434 ++seq_num;
435 } 435 }
436 EXPECT_GT(target_bitrate_bps_, 0u); 436 EXPECT_GT(target_bitrate_bps_, 0u);
437 } 437 }
438 438
439 } // namespace test 439 } // namespace test
440 } // namespace webrtc 440 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/congestion_controller/probe_bitrate_estimator.cc ('k') | webrtc/modules/include/module_common_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698