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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report_unittest.cc

Issue 2991623002: Add SetReportBlocks to rtcp Sender/Receive Report classes. (Closed)
Patch Set: Created 3 years, 5 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 const size_t kMaxReportBlocks = (1 << 5) - 1; 120 const size_t kMaxReportBlocks = (1 << 5) - 1;
121 ReportBlock rb; 121 ReportBlock rb;
122 for (size_t i = 0; i < kMaxReportBlocks; ++i) { 122 for (size_t i = 0; i < kMaxReportBlocks; ++i) {
123 rb.SetMediaSsrc(kRemoteSsrc + i); 123 rb.SetMediaSsrc(kRemoteSsrc + i);
124 EXPECT_TRUE(rr.AddReportBlock(rb)); 124 EXPECT_TRUE(rr.AddReportBlock(rb));
125 } 125 }
126 rb.SetMediaSsrc(kRemoteSsrc + kMaxReportBlocks); 126 rb.SetMediaSsrc(kRemoteSsrc + kMaxReportBlocks);
127 EXPECT_FALSE(rr.AddReportBlock(rb)); 127 EXPECT_FALSE(rr.AddReportBlock(rb));
128 } 128 }
129 129
130 TEST(RtcpPacketReceiverReportTest, SetReportBlocksOverwritesOldBlocks) {
131 ReceiverReport rr;
132 ReportBlock report_block;
133 // Use jitter field of the report blocks to distinguish them.
134 report_block.SetJitter(1001);
135 rr.AddReportBlock(report_block);
136 ASSERT_EQ(rr.report_blocks().size(), 1u);
137 ASSERT_EQ(rr.report_blocks()[0].jitter(), 1001u);
138
139 std::vector<ReportBlock> blocks(3);
140 blocks[0].SetJitter(2001);
eladalon 2017/07/25 11:46:01 nit: Maybe use 2001u, here and elsewhere, to preve
danilchap 2017/07/25 12:45:20 Done. Less confusion is better.
141 blocks[1].SetJitter(3001);
142 blocks[2].SetJitter(4001);
143 EXPECT_TRUE(rr.SetReportBlocks(blocks));
144 ASSERT_EQ(rr.report_blocks().size(), 3u);
145 EXPECT_EQ(rr.report_blocks()[0].jitter(), 2001u);
146 EXPECT_EQ(rr.report_blocks()[1].jitter(), 3001u);
147 EXPECT_EQ(rr.report_blocks()[2].jitter(), 4001u);
148 }
149
150 TEST(RtcpPacketReceiverReportTest, CanSetMax31ReportBlock) {
eladalon 2017/07/25 11:46:01 nit: I would have used something like MaxReportBlo
danilchap 2017/07/25 12:45:20 Since exact value moved away from test, moved it a
151 ReceiverReport rr;
152 const size_t kMaxReportBlocks = (1 << 5) - 1;
eladalon 2017/07/25 11:48:47 Oh, by the way - I would understand if it were: (1
danilchap 2017/07/25 12:45:20 Not sure why I hide the constant in the private se
153
154 std::vector<ReportBlock> blocks(kMaxReportBlocks);
155 EXPECT_TRUE(rr.SetReportBlocks(blocks));
156
157 blocks.push_back(ReportBlock());
158 EXPECT_FALSE(rr.SetReportBlocks(blocks));
eladalon 2017/07/25 11:46:01 nit: This is not important enough to block (no pun
danilchap 2017/07/25 12:45:20 test guide suggest to test distinct behavior in di
eladalon 2017/07/25 13:26:09 The guide discourages performing actions on the ob
159 }
160
130 } // namespace webrtc 161 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698