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

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

Issue 1727283002: Fix OOB read in pacing test. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 EXPECT_EQ(0, send_bucket_->QueueInMs()); 718 EXPECT_EQ(0, send_bucket_->QueueInMs());
719 } 719 }
720 720
721 TEST_F(PacedSenderTest, ProbingWithInitialFrame) { 721 TEST_F(PacedSenderTest, ProbingWithInitialFrame) {
722 const int kNumPackets = 11; 722 const int kNumPackets = 11;
723 const int kNumDeltas = kNumPackets - 1; 723 const int kNumDeltas = kNumPackets - 1;
724 const size_t kPacketSize = 1200; 724 const size_t kPacketSize = 1200;
725 const int kInitialBitrateKbps = 300; 725 const int kInitialBitrateKbps = 300;
726 uint32_t ssrc = 12346; 726 uint32_t ssrc = 12346;
727 uint16_t sequence_number = 1234; 727 uint16_t sequence_number = 1234;
728 const int expected_deltas[kNumDeltas] = { 728 const int expected_deltas[kNumDeltas] = {10, 10, 10, 10, 10, 5, 5, 5, 5, 5};
729 10, 10, 10, 10, 10, 5, 5, 5, 5, 5};
730 std::list<int> expected_deltas_list(expected_deltas, 729 std::list<int> expected_deltas_list(expected_deltas,
731 expected_deltas + kNumPackets - 1); 730 expected_deltas + kNumDeltas);
732 PacedSenderProbing callback(expected_deltas_list, &clock_); 731 PacedSenderProbing callback(expected_deltas_list, &clock_);
733 send_bucket_.reset( 732 send_bucket_.reset(
734 new PacedSender(&clock_, 733 new PacedSender(&clock_,
735 &callback, 734 &callback,
736 kInitialBitrateKbps, 735 kInitialBitrateKbps,
737 kPaceMultiplier * kInitialBitrateKbps, 736 kPaceMultiplier * kInitialBitrateKbps,
738 0)); 737 0));
739 738
740 for (int i = 0; i < kNumPackets; ++i) { 739 for (int i = 0; i < kNumPackets; ++i) {
741 send_bucket_->InsertPacket(PacedSender::kNormalPriority, ssrc, 740 send_bucket_->InsertPacket(PacedSender::kNormalPriority, ssrc,
(...skipping 12 matching lines...) Expand all
754 753
755 TEST_F(PacedSenderTest, ProbingWithTooSmallInitialFrame) { 754 TEST_F(PacedSenderTest, ProbingWithTooSmallInitialFrame) {
756 const int kNumPackets = 11; 755 const int kNumPackets = 11;
757 const int kNumDeltas = kNumPackets - 1; 756 const int kNumDeltas = kNumPackets - 1;
758 const size_t kPacketSize = 1200; 757 const size_t kPacketSize = 1200;
759 const int kInitialBitrateKbps = 300; 758 const int kInitialBitrateKbps = 300;
760 uint32_t ssrc = 12346; 759 uint32_t ssrc = 12346;
761 uint16_t sequence_number = 1234; 760 uint16_t sequence_number = 1234;
762 const int expected_deltas[kNumDeltas] = {10, 10, 10, 10, 10, 5, 5, 5, 5, 5}; 761 const int expected_deltas[kNumDeltas] = {10, 10, 10, 10, 10, 5, 5, 5, 5, 5};
763 std::list<int> expected_deltas_list(expected_deltas, 762 std::list<int> expected_deltas_list(expected_deltas,
764 expected_deltas + kNumPackets - 1); 763 expected_deltas + kNumDeltas);
765 PacedSenderProbing callback(expected_deltas_list, &clock_); 764 PacedSenderProbing callback(expected_deltas_list, &clock_);
766 send_bucket_.reset(new PacedSender(&clock_, &callback, kInitialBitrateKbps, 765 send_bucket_.reset(new PacedSender(&clock_, &callback, kInitialBitrateKbps,
767 kPaceMultiplier * kInitialBitrateKbps, 0)); 766 kPaceMultiplier * kInitialBitrateKbps, 0));
768 767
769 for (int i = 0; i < kNumPackets - 5; ++i) { 768 for (int i = 0; i < kNumPackets - 5; ++i) {
770 send_bucket_->InsertPacket(PacedSender::kNormalPriority, ssrc, 769 send_bucket_->InsertPacket(PacedSender::kNormalPriority, ssrc,
771 sequence_number++, clock_.TimeInMilliseconds(), 770 sequence_number++, clock_.TimeInMilliseconds(),
772 kPacketSize, false); 771 kPacketSize, false);
773 } 772 }
774 while (callback.packets_sent() < kNumPackets) { 773 while (callback.packets_sent() < kNumPackets) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 for (int i = 0; i < 3; ++i) { 899 for (int i = 0; i < 3; ++i) {
901 clock_.AdvanceTimeMilliseconds(30); // Max delta. 900 clock_.AdvanceTimeMilliseconds(30); // Max delta.
902 send_bucket_->Process(); 901 send_bucket_->Process();
903 } 902 }
904 903
905 EXPECT_EQ(0, send_bucket_->AverageQueueTimeMs()); 904 EXPECT_EQ(0, send_bucket_->AverageQueueTimeMs());
906 } 905 }
907 906
908 } // namespace test 907 } // namespace test
909 } // namespace webrtc 908 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698