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

Side by Side Diff: webrtc/modules/video_coding/session_info_unittest.cc

Issue 1528503003: Lint enabled for webrtc/modules/video_coding folder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 5 years 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 fragmentation_.VerifyAndAllocateFragmentationHeader(kMaxVP8Partitions); 74 fragmentation_.VerifyAndAllocateFragmentationHeader(kMaxVP8Partitions);
75 } 75 }
76 76
77 bool VerifyPartition(int partition_id, 77 bool VerifyPartition(int partition_id,
78 int packets_expected, 78 int packets_expected,
79 int start_value) { 79 int start_value) {
80 EXPECT_EQ(packets_expected * packet_buffer_size(), 80 EXPECT_EQ(packets_expected * packet_buffer_size(),
81 fragmentation_.fragmentationLength[partition_id]); 81 fragmentation_.fragmentationLength[partition_id]);
82 for (int i = 0; i < packets_expected; ++i) { 82 for (int i = 0; i < packets_expected; ++i) {
83 size_t packet_index = fragmentation_.fragmentationOffset[partition_id] + 83 size_t packet_index = fragmentation_.fragmentationOffset[partition_id] +
84 i * packet_buffer_size(); 84 i * packet_buffer_size();
85 if (packet_index + packet_buffer_size() > frame_buffer_size()) 85 if (packet_index + packet_buffer_size() > frame_buffer_size())
86 return false; 86 return false;
87 VerifyPacket(frame_buffer_ + packet_index, start_value + i); 87 VerifyPacket(frame_buffer_ + packet_index, start_value + i);
88 } 88 }
89 return true; 89 return true;
90 } 90 }
91 91
92 WebRtcRTPHeader packet_header_; 92 WebRtcRTPHeader packet_header_;
93 RTPVideoHeaderVP8* vp8_header_; 93 RTPVideoHeaderVP8* vp8_header_;
94 RTPFragmentationHeader fragmentation_; 94 RTPFragmentationHeader fragmentation_;
(...skipping 20 matching lines...) Expand all
115 class TestNackList : public TestSessionInfo { 115 class TestNackList : public TestSessionInfo {
116 protected: 116 protected:
117 static const size_t kMaxSeqNumListLength = 30; 117 static const size_t kMaxSeqNumListLength = 30;
118 118
119 virtual void SetUp() { 119 virtual void SetUp() {
120 TestSessionInfo::SetUp(); 120 TestSessionInfo::SetUp();
121 seq_num_list_length_ = 0; 121 seq_num_list_length_ = 0;
122 memset(seq_num_list_, 0, sizeof(seq_num_list_)); 122 memset(seq_num_list_, 0, sizeof(seq_num_list_));
123 } 123 }
124 124
125 void BuildSeqNumList(uint16_t low, 125 void BuildSeqNumList(uint16_t low, uint16_t high) {
126 uint16_t high) {
127 size_t i = 0; 126 size_t i = 0;
128 while (low != high + 1) { 127 while (low != high + 1) {
129 EXPECT_LT(i, kMaxSeqNumListLength); 128 EXPECT_LT(i, kMaxSeqNumListLength);
130 if (i >= kMaxSeqNumListLength) { 129 if (i >= kMaxSeqNumListLength) {
131 seq_num_list_length_ = kMaxSeqNumListLength; 130 seq_num_list_length_ = kMaxSeqNumListLength;
132 return; 131 return;
133 } 132 }
134 seq_num_list_[i] = low; 133 seq_num_list_[i] = low;
135 low++; 134 low++;
136 i++; 135 i++;
(...skipping 29 matching lines...) Expand all
166 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 165 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
167 kNoErrors, frame_data))); 166 kNoErrors, frame_data)));
168 EXPECT_TRUE(session_.HaveLastPacket()); 167 EXPECT_TRUE(session_.HaveLastPacket());
169 EXPECT_EQ(packet_.seqNum, session_.HighSequenceNumber()); 168 EXPECT_EQ(packet_.seqNum, session_.HighSequenceNumber());
170 EXPECT_EQ(0xFFFE, session_.LowSequenceNumber()); 169 EXPECT_EQ(0xFFFE, session_.LowSequenceNumber());
171 170
172 // Insert empty packet which will be the new high sequence number. 171 // Insert empty packet which will be the new high sequence number.
173 // To make things more difficult we will make sure to have a wrap here. 172 // To make things more difficult we will make sure to have a wrap here.
174 packet_.isFirstPacket = false; 173 packet_.isFirstPacket = false;
175 packet_.markerBit = true; 174 packet_.markerBit = true;
176 packet_.seqNum = 2; 175 packet_.seqNum = 2;
177 packet_.sizeBytes = 0; 176 packet_.sizeBytes = 0;
178 packet_.frameType = kEmptyFrame; 177 packet_.frameType = kEmptyFrame;
179 EXPECT_EQ(0, 178 EXPECT_EQ(
180 session_.InsertPacket(packet_, 179 0, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
181 frame_buffer_,
182 kNoErrors,
183 frame_data));
184 EXPECT_EQ(packet_.seqNum, session_.HighSequenceNumber()); 180 EXPECT_EQ(packet_.seqNum, session_.HighSequenceNumber());
185 } 181 }
186 182
187 TEST_F(TestSessionInfo, NormalOperation) { 183 TEST_F(TestSessionInfo, NormalOperation) {
188 packet_.seqNum = 0xFFFF; 184 packet_.seqNum = 0xFFFF;
189 packet_.isFirstPacket = true; 185 packet_.isFirstPacket = true;
190 packet_.markerBit = false; 186 packet_.markerBit = false;
191 FillPacket(0); 187 FillPacket(0);
192 EXPECT_EQ(packet_buffer_size(), 188 EXPECT_EQ(packet_buffer_size(),
193 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 189 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
194 kNoErrors, frame_data))); 190 kNoErrors, frame_data)));
195 191
196 packet_.isFirstPacket = false; 192 packet_.isFirstPacket = false;
197 for (int i = 1; i < 9; ++i) { 193 for (int i = 1; i < 9; ++i) {
198 packet_.seqNum += 1; 194 packet_.seqNum += 1;
199 FillPacket(i); 195 FillPacket(i);
200 ASSERT_EQ(packet_buffer_size(), 196 ASSERT_EQ(packet_buffer_size(),
201 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 197 static_cast<size_t>(session_.InsertPacket(
202 kNoErrors, 198 packet_, frame_buffer_, kNoErrors, frame_data)));
203 frame_data)));
204 } 199 }
205 200
206 packet_.seqNum += 1; 201 packet_.seqNum += 1;
207 packet_.markerBit = true; 202 packet_.markerBit = true;
208 FillPacket(9); 203 FillPacket(9);
209 EXPECT_EQ(packet_buffer_size(), 204 EXPECT_EQ(packet_buffer_size(),
210 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 205 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
211 kNoErrors, frame_data))); 206 kNoErrors, frame_data)));
212 207
213 EXPECT_EQ(10 * packet_buffer_size(), session_.SessionLength()); 208 EXPECT_EQ(10 * packet_buffer_size(), session_.SessionLength());
214 for (int i = 0; i < 10; ++i) { 209 for (int i = 0; i < 10; ++i) {
215 SCOPED_TRACE("Calling VerifyPacket"); 210 SCOPED_TRACE("Calling VerifyPacket");
216 VerifyPacket(frame_buffer_ + i * packet_buffer_size(), i); 211 VerifyPacket(frame_buffer_ + i * packet_buffer_size(), i);
217 } 212 }
218 } 213 }
219 214
220 TEST_F(TestSessionInfo, ErrorsEqualDecodableState) { 215 TEST_F(TestSessionInfo, ErrorsEqualDecodableState) {
221 packet_.seqNum = 0xFFFF; 216 packet_.seqNum = 0xFFFF;
222 packet_.isFirstPacket = false; 217 packet_.isFirstPacket = false;
223 packet_.markerBit = false; 218 packet_.markerBit = false;
224 FillPacket(3); 219 FillPacket(3);
225 EXPECT_EQ(packet_buffer_size(), 220 EXPECT_EQ(packet_buffer_size(),
226 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 221 static_cast<size_t>(session_.InsertPacket(
227 kWithErrors, 222 packet_, frame_buffer_, kWithErrors, frame_data)));
228 frame_data)));
229 EXPECT_TRUE(session_.decodable()); 223 EXPECT_TRUE(session_.decodable());
230 } 224 }
231 225
232 TEST_F(TestSessionInfo, SelectiveDecodableState) { 226 TEST_F(TestSessionInfo, SelectiveDecodableState) {
233 packet_.seqNum = 0xFFFF; 227 packet_.seqNum = 0xFFFF;
234 packet_.isFirstPacket = false; 228 packet_.isFirstPacket = false;
235 packet_.markerBit = false; 229 packet_.markerBit = false;
236 FillPacket(1); 230 FillPacket(1);
237 frame_data.rolling_average_packets_per_frame = 11; 231 frame_data.rolling_average_packets_per_frame = 11;
238 frame_data.rtt_ms = 150; 232 frame_data.rtt_ms = 150;
239 EXPECT_EQ(packet_buffer_size(), 233 EXPECT_EQ(packet_buffer_size(),
240 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 234 static_cast<size_t>(session_.InsertPacket(
241 kSelectiveErrors, 235 packet_, frame_buffer_, kSelectiveErrors, frame_data)));
242 frame_data)));
243 EXPECT_FALSE(session_.decodable()); 236 EXPECT_FALSE(session_.decodable());
244 237
245 packet_.seqNum -= 1; 238 packet_.seqNum -= 1;
246 FillPacket(0); 239 FillPacket(0);
247 packet_.isFirstPacket = true; 240 packet_.isFirstPacket = true;
248 EXPECT_EQ(packet_buffer_size(), 241 EXPECT_EQ(packet_buffer_size(),
249 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 242 static_cast<size_t>(session_.InsertPacket(
250 kSelectiveErrors, 243 packet_, frame_buffer_, kSelectiveErrors, frame_data)));
251 frame_data)));
252 EXPECT_TRUE(session_.decodable()); 244 EXPECT_TRUE(session_.decodable());
253 245
254 packet_.isFirstPacket = false; 246 packet_.isFirstPacket = false;
255 packet_.seqNum += 1; 247 packet_.seqNum += 1;
256 for (int i = 2; i < 8; ++i) { 248 for (int i = 2; i < 8; ++i) {
257 packet_.seqNum += 1; 249 packet_.seqNum += 1;
258 FillPacket(i); 250 FillPacket(i);
259 EXPECT_EQ(packet_buffer_size(), 251 EXPECT_EQ(packet_buffer_size(),
260 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 252 static_cast<size_t>(session_.InsertPacket(
261 kSelectiveErrors, 253 packet_, frame_buffer_, kSelectiveErrors, frame_data)));
262 frame_data)));
263 EXPECT_TRUE(session_.decodable()); 254 EXPECT_TRUE(session_.decodable());
264 } 255 }
265 256
266 packet_.seqNum += 1; 257 packet_.seqNum += 1;
267 FillPacket(8); 258 FillPacket(8);
268 EXPECT_EQ(packet_buffer_size(), 259 EXPECT_EQ(packet_buffer_size(),
269 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 260 static_cast<size_t>(session_.InsertPacket(
270 kSelectiveErrors, 261 packet_, frame_buffer_, kSelectiveErrors, frame_data)));
271 frame_data)));
272 EXPECT_TRUE(session_.decodable()); 262 EXPECT_TRUE(session_.decodable());
273 } 263 }
274 264
275 TEST_F(TestSessionInfo, OutOfBoundsPackets1PacketFrame) { 265 TEST_F(TestSessionInfo, OutOfBoundsPackets1PacketFrame) {
276 packet_.seqNum = 0x0001; 266 packet_.seqNum = 0x0001;
277 packet_.isFirstPacket = true; 267 packet_.isFirstPacket = true;
278 packet_.markerBit = true; 268 packet_.markerBit = true;
279 FillPacket(1); 269 FillPacket(1);
280 EXPECT_EQ(packet_buffer_size(), 270 EXPECT_EQ(packet_buffer_size(),
281 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 271 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
282 kNoErrors, frame_data))); 272 kNoErrors, frame_data)));
283 273
284 packet_.seqNum = 0x0004; 274 packet_.seqNum = 0x0004;
285 packet_.isFirstPacket = true; 275 packet_.isFirstPacket = true;
286 packet_.markerBit = true; 276 packet_.markerBit = true;
287 FillPacket(1); 277 FillPacket(1);
288 EXPECT_EQ(-3, session_.InsertPacket(packet_, 278 EXPECT_EQ(
289 frame_buffer_, 279 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
290 kNoErrors,
291 frame_data));
292 packet_.seqNum = 0x0000; 280 packet_.seqNum = 0x0000;
293 packet_.isFirstPacket = false; 281 packet_.isFirstPacket = false;
294 packet_.markerBit = false; 282 packet_.markerBit = false;
295 FillPacket(1); 283 FillPacket(1);
296 EXPECT_EQ(-3, session_.InsertPacket(packet_, 284 EXPECT_EQ(
297 frame_buffer_, 285 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
298 kNoErrors,
299 frame_data));
300 } 286 }
301 287
302 TEST_F(TestSessionInfo, SetMarkerBitOnce) { 288 TEST_F(TestSessionInfo, SetMarkerBitOnce) {
303 packet_.seqNum = 0x0005; 289 packet_.seqNum = 0x0005;
304 packet_.isFirstPacket = false; 290 packet_.isFirstPacket = false;
305 packet_.markerBit = true; 291 packet_.markerBit = true;
306 FillPacket(1); 292 FillPacket(1);
307 EXPECT_EQ(packet_buffer_size(), 293 EXPECT_EQ(packet_buffer_size(),
308 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 294 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
309 kNoErrors, frame_data))); 295 kNoErrors, frame_data)));
310 ++packet_.seqNum; 296 ++packet_.seqNum;
311 packet_.isFirstPacket = true; 297 packet_.isFirstPacket = true;
312 packet_.markerBit = true; 298 packet_.markerBit = true;
313 FillPacket(1); 299 FillPacket(1);
314 EXPECT_EQ(-3, session_.InsertPacket(packet_, 300 EXPECT_EQ(
315 frame_buffer_, 301 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
316 kNoErrors,
317 frame_data));
318 } 302 }
319 303
320 TEST_F(TestSessionInfo, OutOfBoundsPacketsBase) { 304 TEST_F(TestSessionInfo, OutOfBoundsPacketsBase) {
321 // Allow packets in the range 5-6. 305 // Allow packets in the range 5-6.
322 packet_.seqNum = 0x0005; 306 packet_.seqNum = 0x0005;
323 packet_.isFirstPacket = true; 307 packet_.isFirstPacket = true;
324 packet_.markerBit = false; 308 packet_.markerBit = false;
325 FillPacket(1); 309 FillPacket(1);
326 EXPECT_EQ(packet_buffer_size(), 310 EXPECT_EQ(packet_buffer_size(),
327 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 311 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
328 kNoErrors, frame_data))); 312 kNoErrors, frame_data)));
329 // Insert an older packet with a first packet set. 313 // Insert an older packet with a first packet set.
330 packet_.seqNum = 0x0004; 314 packet_.seqNum = 0x0004;
331 packet_.isFirstPacket = true; 315 packet_.isFirstPacket = true;
332 packet_.markerBit = true; 316 packet_.markerBit = true;
333 FillPacket(1); 317 FillPacket(1);
334 EXPECT_EQ(-3, session_.InsertPacket(packet_, 318 EXPECT_EQ(
335 frame_buffer_, 319 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
336 kNoErrors,
337 frame_data));
338 packet_.seqNum = 0x0006; 320 packet_.seqNum = 0x0006;
339 packet_.isFirstPacket = true; 321 packet_.isFirstPacket = true;
340 packet_.markerBit = true; 322 packet_.markerBit = true;
341 FillPacket(1); 323 FillPacket(1);
342 EXPECT_EQ(packet_buffer_size(), 324 EXPECT_EQ(packet_buffer_size(),
343 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 325 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
344 kNoErrors, frame_data))); 326 kNoErrors, frame_data)));
345 packet_.seqNum = 0x0008; 327 packet_.seqNum = 0x0008;
346 packet_.isFirstPacket = false; 328 packet_.isFirstPacket = false;
347 packet_.markerBit = true; 329 packet_.markerBit = true;
348 FillPacket(1); 330 FillPacket(1);
349 EXPECT_EQ(-3, session_.InsertPacket(packet_, 331 EXPECT_EQ(
350 frame_buffer_, 332 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
351 kNoErrors,
352 frame_data));
353 } 333 }
354 334
355 TEST_F(TestSessionInfo, OutOfBoundsPacketsWrap) { 335 TEST_F(TestSessionInfo, OutOfBoundsPacketsWrap) {
356 packet_.seqNum = 0xFFFE; 336 packet_.seqNum = 0xFFFE;
357 packet_.isFirstPacket = true; 337 packet_.isFirstPacket = true;
358 packet_.markerBit = false; 338 packet_.markerBit = false;
359 FillPacket(1); 339 FillPacket(1);
360 EXPECT_EQ(packet_buffer_size(), 340 EXPECT_EQ(packet_buffer_size(),
361 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 341 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
362 kNoErrors, frame_data))); 342 kNoErrors, frame_data)));
363 343
364 packet_.seqNum = 0x0004; 344 packet_.seqNum = 0x0004;
365 packet_.isFirstPacket = false; 345 packet_.isFirstPacket = false;
366 packet_.markerBit = true; 346 packet_.markerBit = true;
367 FillPacket(1); 347 FillPacket(1);
368 EXPECT_EQ(packet_buffer_size(), 348 EXPECT_EQ(packet_buffer_size(),
369 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 349 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
370 kNoErrors, frame_data))); 350 kNoErrors, frame_data)));
371 packet_.seqNum = 0x0002; 351 packet_.seqNum = 0x0002;
372 packet_.isFirstPacket = false; 352 packet_.isFirstPacket = false;
373 packet_.markerBit = false; 353 packet_.markerBit = false;
374 FillPacket(1); 354 FillPacket(1);
375 ASSERT_EQ(packet_buffer_size(), 355 ASSERT_EQ(packet_buffer_size(),
376 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 356 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
377 kNoErrors, frame_data))); 357 kNoErrors, frame_data)));
378 packet_.seqNum = 0xFFF0; 358 packet_.seqNum = 0xFFF0;
379 packet_.isFirstPacket = false; 359 packet_.isFirstPacket = false;
380 packet_.markerBit = false; 360 packet_.markerBit = false;
381 FillPacket(1); 361 FillPacket(1);
382 EXPECT_EQ(-3, 362 EXPECT_EQ(
383 session_.InsertPacket(packet_, 363 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
384 frame_buffer_,
385 kNoErrors,
386 frame_data));
387 packet_.seqNum = 0x0006; 364 packet_.seqNum = 0x0006;
388 packet_.isFirstPacket = false; 365 packet_.isFirstPacket = false;
389 packet_.markerBit = false; 366 packet_.markerBit = false;
390 FillPacket(1); 367 FillPacket(1);
391 EXPECT_EQ(-3, 368 EXPECT_EQ(
392 session_.InsertPacket(packet_, 369 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
393 frame_buffer_,
394 kNoErrors,
395 frame_data));
396 } 370 }
397 371
398 TEST_F(TestSessionInfo, OutOfBoundsOutOfOrder) { 372 TEST_F(TestSessionInfo, OutOfBoundsOutOfOrder) {
399 // Insert out of bound regular packets, and then the first and last packet. 373 // Insert out of bound regular packets, and then the first and last packet.
400 // Verify that correct bounds are maintained. 374 // Verify that correct bounds are maintained.
401 packet_.seqNum = 0x0003; 375 packet_.seqNum = 0x0003;
402 packet_.isFirstPacket = false; 376 packet_.isFirstPacket = false;
403 packet_.markerBit = false; 377 packet_.markerBit = false;
404 FillPacket(1); 378 FillPacket(1);
405 EXPECT_EQ(packet_buffer_size(), 379 EXPECT_EQ(packet_buffer_size(),
406 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 380 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
407 kNoErrors, frame_data))); 381 kNoErrors, frame_data)));
408 // Insert an older packet with a first packet set. 382 // Insert an older packet with a first packet set.
409 packet_.seqNum = 0x0005; 383 packet_.seqNum = 0x0005;
410 packet_.isFirstPacket = true; 384 packet_.isFirstPacket = true;
411 packet_.markerBit = false; 385 packet_.markerBit = false;
412 FillPacket(1); 386 FillPacket(1);
413 EXPECT_EQ(packet_buffer_size(), 387 EXPECT_EQ(packet_buffer_size(),
414 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 388 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
415 kNoErrors, frame_data))); 389 kNoErrors, frame_data)));
416 packet_.seqNum = 0x0004; 390 packet_.seqNum = 0x0004;
417 packet_.isFirstPacket = false; 391 packet_.isFirstPacket = false;
418 packet_.markerBit = false; 392 packet_.markerBit = false;
419 FillPacket(1); 393 FillPacket(1);
420 EXPECT_EQ(-3, session_.InsertPacket(packet_, 394 EXPECT_EQ(
421 frame_buffer_, 395 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
422 kNoErrors,
423 frame_data));
424 packet_.seqNum = 0x0010; 396 packet_.seqNum = 0x0010;
425 packet_.isFirstPacket = false; 397 packet_.isFirstPacket = false;
426 packet_.markerBit = false; 398 packet_.markerBit = false;
427 FillPacket(1); 399 FillPacket(1);
428 EXPECT_EQ(packet_buffer_size(), 400 EXPECT_EQ(packet_buffer_size(),
429 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 401 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
430 kNoErrors, frame_data))); 402 kNoErrors, frame_data)));
431 packet_.seqNum = 0x0008; 403 packet_.seqNum = 0x0008;
432 packet_.isFirstPacket = false; 404 packet_.isFirstPacket = false;
433 packet_.markerBit = true; 405 packet_.markerBit = true;
434 FillPacket(1); 406 FillPacket(1);
435 EXPECT_EQ(packet_buffer_size(), 407 EXPECT_EQ(packet_buffer_size(),
436 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 408 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
437 kNoErrors, frame_data))); 409 kNoErrors, frame_data)));
438 410
439 packet_.seqNum = 0x0009; 411 packet_.seqNum = 0x0009;
440 packet_.isFirstPacket = false; 412 packet_.isFirstPacket = false;
441 packet_.markerBit = false; 413 packet_.markerBit = false;
442 FillPacket(1); 414 FillPacket(1);
443 EXPECT_EQ(-3, session_.InsertPacket(packet_, 415 EXPECT_EQ(
444 frame_buffer_, 416 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
445 kNoErrors,
446 frame_data));
447 } 417 }
448 418
449 TEST_F(TestVP8Partitions, TwoPartitionsOneLoss) { 419 TEST_F(TestVP8Partitions, TwoPartitionsOneLoss) {
450 // Partition 0 | Partition 1 420 // Partition 0 | Partition 1
451 // [ 0 ] [ 2 ] | [ 3 ] 421 // [ 0 ] [ 2 ] | [ 3 ]
452 packet_header_.type.Video.isFirstPacket = true; 422 packet_header_.type.Video.isFirstPacket = true;
453 vp8_header_->beginningOfPartition = true; 423 vp8_header_->beginningOfPartition = true;
454 vp8_header_->partitionId = 0; 424 vp8_header_->partitionId = 0;
455 packet_header_.header.markerBit = false; 425 packet_header_.header.markerBit = false;
456 packet_header_.header.sequenceNumber = 0; 426 packet_header_.header.sequenceNumber = 0;
457 FillPacket(0); 427 FillPacket(0);
458 VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(), 428 VCMPacket* packet =
459 packet_header_); 429 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
460 EXPECT_EQ(packet_buffer_size(), 430 EXPECT_EQ(packet_buffer_size(),
461 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_, 431 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
462 kNoErrors, frame_data))); 432 kNoErrors, frame_data)));
463 delete packet; 433 delete packet;
464 434
465 packet_header_.type.Video.isFirstPacket = false; 435 packet_header_.type.Video.isFirstPacket = false;
466 vp8_header_->partitionId = 0; 436 vp8_header_->partitionId = 0;
467 vp8_header_->beginningOfPartition = false; 437 vp8_header_->beginningOfPartition = false;
468 packet_header_.header.markerBit = false; 438 packet_header_.header.markerBit = false;
469 packet_header_.header.sequenceNumber += 2; 439 packet_header_.header.sequenceNumber += 2;
(...skipping 28 matching lines...) Expand all
498 468
499 TEST_F(TestVP8Partitions, TwoPartitionsOneLoss2) { 469 TEST_F(TestVP8Partitions, TwoPartitionsOneLoss2) {
500 // Partition 0 | Partition 1 470 // Partition 0 | Partition 1
501 // [ 1 ] [ 2 ] | [ 3 ] [ 5 ] 471 // [ 1 ] [ 2 ] | [ 3 ] [ 5 ]
502 packet_header_.type.Video.isFirstPacket = true; 472 packet_header_.type.Video.isFirstPacket = true;
503 vp8_header_->beginningOfPartition = true; 473 vp8_header_->beginningOfPartition = true;
504 vp8_header_->partitionId = 0; 474 vp8_header_->partitionId = 0;
505 packet_header_.header.markerBit = false; 475 packet_header_.header.markerBit = false;
506 packet_header_.header.sequenceNumber = 1; 476 packet_header_.header.sequenceNumber = 1;
507 FillPacket(1); 477 FillPacket(1);
508 VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(), 478 VCMPacket* packet =
509 packet_header_); 479 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
510 EXPECT_EQ(packet_buffer_size(), 480 EXPECT_EQ(packet_buffer_size(),
511 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_, 481 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
512 kNoErrors, frame_data))); 482 kNoErrors, frame_data)));
513 delete packet; 483 delete packet;
514 484
515 packet_header_.type.Video.isFirstPacket = false; 485 packet_header_.type.Video.isFirstPacket = false;
516 vp8_header_->partitionId = 0; 486 vp8_header_->partitionId = 0;
517 vp8_header_->beginningOfPartition = false; 487 vp8_header_->beginningOfPartition = false;
518 packet_header_.header.markerBit = false; 488 packet_header_.header.markerBit = false;
519 packet_header_.header.sequenceNumber += 1; 489 packet_header_.header.sequenceNumber += 1;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 530
561 TEST_F(TestVP8Partitions, TwoPartitionsNoLossWrap) { 531 TEST_F(TestVP8Partitions, TwoPartitionsNoLossWrap) {
562 // Partition 0 | Partition 1 532 // Partition 0 | Partition 1
563 // [ fffd ] [ fffe ] | [ ffff ] [ 0 ] 533 // [ fffd ] [ fffe ] | [ ffff ] [ 0 ]
564 packet_header_.type.Video.isFirstPacket = true; 534 packet_header_.type.Video.isFirstPacket = true;
565 vp8_header_->beginningOfPartition = true; 535 vp8_header_->beginningOfPartition = true;
566 vp8_header_->partitionId = 0; 536 vp8_header_->partitionId = 0;
567 packet_header_.header.markerBit = false; 537 packet_header_.header.markerBit = false;
568 packet_header_.header.sequenceNumber = 0xfffd; 538 packet_header_.header.sequenceNumber = 0xfffd;
569 FillPacket(0); 539 FillPacket(0);
570 VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(), 540 VCMPacket* packet =
571 packet_header_); 541 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
572 EXPECT_EQ(packet_buffer_size(), 542 EXPECT_EQ(packet_buffer_size(),
573 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_, 543 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
574 kNoErrors, frame_data))); 544 kNoErrors, frame_data)));
575 delete packet; 545 delete packet;
576 546
577 packet_header_.type.Video.isFirstPacket = false; 547 packet_header_.type.Video.isFirstPacket = false;
578 vp8_header_->partitionId = 0; 548 vp8_header_->partitionId = 0;
579 vp8_header_->beginningOfPartition = false; 549 vp8_header_->beginningOfPartition = false;
580 packet_header_.header.markerBit = false; 550 packet_header_.header.markerBit = false;
581 packet_header_.header.sequenceNumber += 1; 551 packet_header_.header.sequenceNumber += 1;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 592
623 TEST_F(TestVP8Partitions, TwoPartitionsLossWrap) { 593 TEST_F(TestVP8Partitions, TwoPartitionsLossWrap) {
624 // Partition 0 | Partition 1 594 // Partition 0 | Partition 1
625 // [ fffd ] [ fffe ] | [ ffff ] [ 1 ] 595 // [ fffd ] [ fffe ] | [ ffff ] [ 1 ]
626 packet_header_.type.Video.isFirstPacket = true; 596 packet_header_.type.Video.isFirstPacket = true;
627 vp8_header_->beginningOfPartition = true; 597 vp8_header_->beginningOfPartition = true;
628 vp8_header_->partitionId = 0; 598 vp8_header_->partitionId = 0;
629 packet_header_.header.markerBit = false; 599 packet_header_.header.markerBit = false;
630 packet_header_.header.sequenceNumber = 0xfffd; 600 packet_header_.header.sequenceNumber = 0xfffd;
631 FillPacket(0); 601 FillPacket(0);
632 VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(), 602 VCMPacket* packet =
633 packet_header_); 603 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
634 EXPECT_EQ(packet_buffer_size(), 604 EXPECT_EQ(packet_buffer_size(),
635 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_, 605 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
636 kNoErrors, frame_data))); 606 kNoErrors, frame_data)));
637 delete packet; 607 delete packet;
638 608
639 packet_header_.type.Video.isFirstPacket = false; 609 packet_header_.type.Video.isFirstPacket = false;
640 vp8_header_->partitionId = 0; 610 vp8_header_->partitionId = 0;
641 vp8_header_->beginningOfPartition = false; 611 vp8_header_->beginningOfPartition = false;
642 packet_header_.header.markerBit = false; 612 packet_header_.header.markerBit = false;
643 packet_header_.header.sequenceNumber += 1; 613 packet_header_.header.sequenceNumber += 1;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // One packet should be removed from the last partition 645 // One packet should be removed from the last partition
676 EXPECT_EQ(3 * packet_buffer_size(), 646 EXPECT_EQ(3 * packet_buffer_size(),
677 session_.BuildVP8FragmentationHeader( 647 session_.BuildVP8FragmentationHeader(
678 frame_buffer_, frame_buffer_size(), &fragmentation_)); 648 frame_buffer_, frame_buffer_size(), &fragmentation_));
679 SCOPED_TRACE("Calling VerifyPartition"); 649 SCOPED_TRACE("Calling VerifyPartition");
680 EXPECT_TRUE(VerifyPartition(0, 2, 0)); 650 EXPECT_TRUE(VerifyPartition(0, 2, 0));
681 SCOPED_TRACE("Calling VerifyPartition"); 651 SCOPED_TRACE("Calling VerifyPartition");
682 EXPECT_TRUE(VerifyPartition(1, 1, 2)); 652 EXPECT_TRUE(VerifyPartition(1, 1, 2));
683 } 653 }
684 654
685
686 TEST_F(TestVP8Partitions, ThreePartitionsOneMissing) { 655 TEST_F(TestVP8Partitions, ThreePartitionsOneMissing) {
687 // Partition 1 |Partition 2 | Partition 3 656 // Partition 1 |Partition 2 | Partition 3
688 // [ 1 ] [ 2 ] | | [ 5 ] | [ 6 ] 657 // [ 1 ] [ 2 ] | | [ 5 ] | [ 6 ]
689 packet_header_.type.Video.isFirstPacket = true; 658 packet_header_.type.Video.isFirstPacket = true;
690 vp8_header_->beginningOfPartition = true; 659 vp8_header_->beginningOfPartition = true;
691 vp8_header_->partitionId = 0; 660 vp8_header_->partitionId = 0;
692 packet_header_.header.markerBit = false; 661 packet_header_.header.markerBit = false;
693 packet_header_.header.sequenceNumber = 1; 662 packet_header_.header.sequenceNumber = 1;
694 FillPacket(1); 663 FillPacket(1);
695 VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(), 664 VCMPacket* packet =
696 packet_header_); 665 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
697 EXPECT_EQ(packet_buffer_size(), 666 EXPECT_EQ(packet_buffer_size(),
698 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_, 667 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
699 kNoErrors, frame_data))); 668 kNoErrors, frame_data)));
700 delete packet; 669 delete packet;
701 670
702 packet_header_.type.Video.isFirstPacket = false; 671 packet_header_.type.Video.isFirstPacket = false;
703 vp8_header_->partitionId = 0; 672 vp8_header_->partitionId = 0;
704 vp8_header_->beginningOfPartition = false; 673 vp8_header_->beginningOfPartition = false;
705 packet_header_.header.markerBit = false; 674 packet_header_.header.markerBit = false;
706 packet_header_.header.sequenceNumber += 1; 675 packet_header_.header.sequenceNumber += 1;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 716
748 TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) { 717 TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
749 // Partition 0 |Partition 1 | Partition 2 718 // Partition 0 |Partition 1 | Partition 2
750 // [ 1 ] [ 2 ] | [ 4 ] [ 5 ] | [ 6 ] [ 7 ] 719 // [ 1 ] [ 2 ] | [ 4 ] [ 5 ] | [ 6 ] [ 7 ]
751 packet_header_.type.Video.isFirstPacket = true; 720 packet_header_.type.Video.isFirstPacket = true;
752 vp8_header_->beginningOfPartition = true; 721 vp8_header_->beginningOfPartition = true;
753 vp8_header_->partitionId = 0; 722 vp8_header_->partitionId = 0;
754 packet_header_.header.markerBit = false; 723 packet_header_.header.markerBit = false;
755 packet_header_.header.sequenceNumber = 1; 724 packet_header_.header.sequenceNumber = 1;
756 FillPacket(1); 725 FillPacket(1);
757 VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(), 726 VCMPacket* packet =
758 packet_header_); 727 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
759 EXPECT_EQ(packet_buffer_size(), 728 EXPECT_EQ(packet_buffer_size(),
760 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_, 729 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
761 kNoErrors, frame_data))); 730 kNoErrors, frame_data)));
762 delete packet; 731 delete packet;
763 732
764 packet_header_.type.Video.isFirstPacket = false; 733 packet_header_.type.Video.isFirstPacket = false;
765 vp8_header_->partitionId = 0; 734 vp8_header_->partitionId = 0;
766 vp8_header_->beginningOfPartition = false; 735 vp8_header_->beginningOfPartition = false;
767 packet_header_.header.markerBit = false; 736 packet_header_.header.markerBit = false;
768 packet_header_.header.sequenceNumber += 1; 737 packet_header_.header.sequenceNumber += 1;
769 FillPacket(2); 738 FillPacket(2);
770 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), 739 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
771 packet_header_);
772 EXPECT_EQ(packet_buffer_size(), 740 EXPECT_EQ(packet_buffer_size(),
773 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_, 741 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
774 kNoErrors, frame_data))); 742 kNoErrors, frame_data)));
775 delete packet; 743 delete packet;
776 744
777 packet_header_.type.Video.isFirstPacket = false; 745 packet_header_.type.Video.isFirstPacket = false;
778 vp8_header_->partitionId = 1; 746 vp8_header_->partitionId = 1;
779 vp8_header_->beginningOfPartition = false; 747 vp8_header_->beginningOfPartition = false;
780 packet_header_.header.markerBit = false; 748 packet_header_.header.markerBit = false;
781 packet_header_.header.sequenceNumber += 2; 749 packet_header_.header.sequenceNumber += 2;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 802
835 TEST_F(TestVP8Partitions, AggregationOverTwoPackets) { 803 TEST_F(TestVP8Partitions, AggregationOverTwoPackets) {
836 // Partition 0 | Partition 1 | Partition 2 804 // Partition 0 | Partition 1 | Partition 2
837 // [ 0 | ] [ 1 ] | [ 2 ] 805 // [ 0 | ] [ 1 ] | [ 2 ]
838 packet_header_.type.Video.isFirstPacket = true; 806 packet_header_.type.Video.isFirstPacket = true;
839 vp8_header_->beginningOfPartition = true; 807 vp8_header_->beginningOfPartition = true;
840 vp8_header_->partitionId = 0; 808 vp8_header_->partitionId = 0;
841 packet_header_.header.markerBit = false; 809 packet_header_.header.markerBit = false;
842 packet_header_.header.sequenceNumber = 0; 810 packet_header_.header.sequenceNumber = 0;
843 FillPacket(0); 811 FillPacket(0);
844 VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(), 812 VCMPacket* packet =
845 packet_header_); 813 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
846 EXPECT_EQ(packet_buffer_size(), 814 EXPECT_EQ(packet_buffer_size(),
847 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_, 815 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
848 kNoErrors, frame_data))); 816 kNoErrors, frame_data)));
849 delete packet; 817 delete packet;
850 818
851 packet_header_.type.Video.isFirstPacket = false; 819 packet_header_.type.Video.isFirstPacket = false;
852 vp8_header_->partitionId = 1; 820 vp8_header_->partitionId = 1;
853 vp8_header_->beginningOfPartition = false; 821 vp8_header_->beginningOfPartition = false;
854 packet_header_.header.markerBit = false; 822 packet_header_.header.markerBit = false;
855 packet_header_.header.sequenceNumber += 1; 823 packet_header_.header.sequenceNumber += 1;
(...skipping 29 matching lines...) Expand all
885 EXPECT_TRUE(VerifyPartition(2, 1, 2)); 853 EXPECT_TRUE(VerifyPartition(2, 1, 2));
886 } 854 }
887 855
888 TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) { 856 TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) {
889 packet_.isFirstPacket = false; 857 packet_.isFirstPacket = false;
890 packet_.completeNALU = kNaluComplete; 858 packet_.completeNALU = kNaluComplete;
891 packet_.frameType = kEmptyFrame; 859 packet_.frameType = kEmptyFrame;
892 packet_.sizeBytes = 0; 860 packet_.sizeBytes = 0;
893 packet_.seqNum = 0; 861 packet_.seqNum = 0;
894 packet_.markerBit = false; 862 packet_.markerBit = false;
895 EXPECT_EQ(0, session_.InsertPacket(packet_, 863 EXPECT_EQ(
896 frame_buffer_, 864 0, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
897 kNoErrors,
898 frame_data));
899 865
900 EXPECT_EQ(0U, session_.MakeDecodable()); 866 EXPECT_EQ(0U, session_.MakeDecodable());
901 EXPECT_EQ(0U, session_.SessionLength()); 867 EXPECT_EQ(0U, session_.SessionLength());
902 } 868 }
903 869
904 TEST_F(TestNalUnits, OneIsolatedNaluLoss) { 870 TEST_F(TestNalUnits, OneIsolatedNaluLoss) {
905 packet_.isFirstPacket = true; 871 packet_.isFirstPacket = true;
906 packet_.completeNALU = kNaluComplete; 872 packet_.completeNALU = kNaluComplete;
907 packet_.seqNum = 0; 873 packet_.seqNum = 0;
908 packet_.markerBit = false; 874 packet_.markerBit = false;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 FillPacket(1); 1021 FillPacket(1);
1056 EXPECT_EQ(packet_buffer_size(), 1022 EXPECT_EQ(packet_buffer_size(),
1057 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 1023 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
1058 kNoErrors, frame_data))); 1024 kNoErrors, frame_data)));
1059 1025
1060 EXPECT_EQ(2 * packet_buffer_size(), session_.MakeDecodable()); 1026 EXPECT_EQ(2 * packet_buffer_size(), session_.MakeDecodable());
1061 EXPECT_EQ(0U, session_.SessionLength()); 1027 EXPECT_EQ(0U, session_.SessionLength());
1062 } 1028 }
1063 1029
1064 } // namespace webrtc 1030 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/session_info.cc ('k') | webrtc/modules/video_coding/test/receiver_tests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698