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

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

Powered by Google App Engine
This is Rietveld 408576698