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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc

Issue 2766323006: Correcting the amount of padding when send side bwe includes RTP overhead.
Patch Set: on comments` Created 3 years, 8 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) 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 214
215 fake_clock_.AdvanceTimeMilliseconds(100); 215 fake_clock_.AdvanceTimeMilliseconds(100);
216 216
217 // Retransmit all packets currently in buffer. 217 // Retransmit all packets currently in buffer.
218 for (size_t i = 1; i < RtpPacketHistory::kMaxCapacity + 1; ++i) { 218 for (size_t i = 1; i < RtpPacketHistory::kMaxCapacity + 1; ++i) {
219 EXPECT_TRUE(hist_.GetPacketAndSetSendTime(kSeqNum + i, 100, false)); 219 EXPECT_TRUE(hist_.GetPacketAndSetSendTime(kSeqNum + i, 100, false));
220 } 220 }
221 } 221 }
222 222
223 TEST_F(RtpPacketHistoryTest, GetBestFittingPacket) {
224 constexpr size_t kMinPacketRequestBytes = 50;
225
226 hist_.SetStorePacketsStatus(true, 3);
227
228 std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kSeqNum);
229 const size_t header_size = packet->headers_size();
230 const int64_t start_time_ms = fake_clock_.TimeInMilliseconds();
231
232 packet->SetPayloadSize(kMinPacketRequestBytes - header_size);
233 hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, false);
234
235 fake_clock_.AdvanceTimeMilliseconds(1);
236
237 packet = CreateRtpPacket(kSeqNum + 1);
238 packet->SetPayloadSize(kMinPacketRequestBytes);
239 hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, false);
240
241 fake_clock_.AdvanceTimeMilliseconds(1);
242
243 packet = CreateRtpPacket(kSeqNum + 2);
244 packet->SetPayloadSize(kMinPacketRequestBytes + header_size);
245 hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, false);
246
247 constexpr bool kIncludeHeader = true;
248 std::unique_ptr<RtpPacketToSend> fit =
249 hist_.GetBestFittingPacket(kMinPacketRequestBytes, kIncludeHeader);
250 ASSERT_TRUE(fit);
251 EXPECT_EQ(start_time_ms, fit->capture_time_ms());
252
253 fit = hist_.GetBestFittingPacket(kMinPacketRequestBytes, !kIncludeHeader);
254 ASSERT_TRUE(fit);
255 EXPECT_EQ(start_time_ms + 1, fit->capture_time_ms());
256 }
257
223 } // namespace webrtc 258 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698