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

Side by Side Diff: webrtc/modules/pacing/paced_sender_unittest.cc

Issue 2994323002: Don't boost pacing rate after pause. (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « webrtc/modules/pacing/paced_sender.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 EXPECT_CALL(callback_, TimeToSendPadding(_, _)) 1087 EXPECT_CALL(callback_, TimeToSendPadding(_, _))
1088 .Times(2) 1088 .Times(2)
1089 .WillRepeatedly(Return(0)); 1089 .WillRepeatedly(Return(0));
1090 send_bucket_->Process(); 1090 send_bucket_->Process();
1091 EXPECT_EQ(1, send_bucket_->TimeUntilNextProcess()); 1091 EXPECT_EQ(1, send_bucket_->TimeUntilNextProcess());
1092 clock_.AdvanceTimeMilliseconds(1); 1092 clock_.AdvanceTimeMilliseconds(1);
1093 send_bucket_->Process(); 1093 send_bucket_->Process();
1094 EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); 1094 EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());
1095 } 1095 }
1096 1096
1097 TEST_F(PacedSenderTest, QueueTimeWithPause) {
1098 const size_t kPacketSize = 1200;
1099 const uint32_t kSsrc = 12346;
1100 uint16_t sequence_number = 1234;
1101
1102 send_bucket_->InsertPacket(PacedSender::kNormalPriority, kSsrc,
1103 sequence_number++, clock_.TimeInMilliseconds(),
1104 kPacketSize, false);
1105 send_bucket_->InsertPacket(PacedSender::kNormalPriority, kSsrc,
1106 sequence_number++, clock_.TimeInMilliseconds(),
1107 kPacketSize, false);
1108
1109 clock_.AdvanceTimeMilliseconds(100);
1110 EXPECT_EQ(100, send_bucket_->AverageQueueTimeMs());
1111
1112 send_bucket_->Pause();
1113 EXPECT_EQ(100, send_bucket_->AverageQueueTimeMs());
1114
1115 // In paused state, queue time should not increase.
1116 clock_.AdvanceTimeMilliseconds(100);
1117 EXPECT_EQ(100, send_bucket_->AverageQueueTimeMs());
1118
1119 send_bucket_->Resume();
1120 EXPECT_EQ(100, send_bucket_->AverageQueueTimeMs());
1121
1122 clock_.AdvanceTimeMilliseconds(100);
1123 EXPECT_EQ(200, send_bucket_->AverageQueueTimeMs());
1124 }
1125
1126 TEST_F(PacedSenderTest, QueueTimePausedDuringPush) {
1127 const size_t kPacketSize = 1200;
1128 const uint32_t kSsrc = 12346;
1129 uint16_t sequence_number = 1234;
1130
1131 send_bucket_->InsertPacket(PacedSender::kNormalPriority, kSsrc,
1132 sequence_number++, clock_.TimeInMilliseconds(),
1133 kPacketSize, false);
1134 clock_.AdvanceTimeMilliseconds(100);
1135 send_bucket_->Pause();
1136 clock_.AdvanceTimeMilliseconds(100);
1137 EXPECT_EQ(100, send_bucket_->AverageQueueTimeMs());
1138
1139 // Add a new packet during paused phase.
1140 send_bucket_->InsertPacket(PacedSender::kNormalPriority, kSsrc,
1141 sequence_number++, clock_.TimeInMilliseconds(),
1142 kPacketSize, false);
1143 // From a queue time perspective, packet inserted during pause will have zero
1144 // queue time. Average queue time will then be (0 + 100) / 2 = 50.
1145 EXPECT_EQ(50, send_bucket_->AverageQueueTimeMs());
1146
1147 clock_.AdvanceTimeMilliseconds(100);
1148 EXPECT_EQ(50, send_bucket_->AverageQueueTimeMs());
1149
1150 send_bucket_->Resume();
1151 EXPECT_EQ(50, send_bucket_->AverageQueueTimeMs());
1152
1153 clock_.AdvanceTimeMilliseconds(100);
1154 EXPECT_EQ(150, send_bucket_->AverageQueueTimeMs());
1155 }
1156
1157 // TODO(sprang): Extract PacketQueue from PacedSender so that we can test
1158 // removing elements while paused. (This is possible, but only because of semi-
1159 // racy condition so can't easily be tested).
1160
1097 } // namespace test 1161 } // namespace test
1098 } // namespace webrtc 1162 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/paced_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698