OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 packet_buffer_->ClearTo(9025); | 431 packet_buffer_->ClearTo(9025); |
432 Insert(9057, kDeltaFrame, kFirst, kLast); | 432 Insert(9057, kDeltaFrame, kFirst, kLast); |
433 Insert(9026, kDeltaFrame, kFirst, kLast); | 433 Insert(9026, kDeltaFrame, kFirst, kLast); |
434 | 434 |
435 CheckFrame(9024); | 435 CheckFrame(9024); |
436 CheckFrame(9025); | 436 CheckFrame(9025); |
437 CheckFrame(9026); | 437 CheckFrame(9026); |
438 CheckFrame(9057); | 438 CheckFrame(9057); |
439 } | 439 } |
440 | 440 |
| 441 TEST_F(TestPacketBuffer, DontLeakPayloadData) { |
| 442 // NOTE! Any eventual leak is suppose to be detected by valgrind |
| 443 // or any other similar tool. |
| 444 uint8_t* data1 = new uint8_t[5]; |
| 445 uint8_t* data2 = new uint8_t[5]; |
| 446 uint8_t* data3 = new uint8_t[5]; |
| 447 uint8_t* data4 = new uint8_t[5]; |
| 448 |
| 449 // Expected to free data1 upon PacketBuffer destruction. |
| 450 EXPECT_TRUE(Insert(2, kKeyFrame, kFirst, kNotLast, 5, data1)); |
| 451 |
| 452 // Expect to free data2 upon insertion. |
| 453 EXPECT_TRUE(Insert(2, kKeyFrame, kFirst, kNotLast, 5, data2)); |
| 454 |
| 455 // Expect to free data3 upon insertion (old packet). |
| 456 packet_buffer_->ClearTo(1); |
| 457 EXPECT_FALSE(Insert(1, kKeyFrame, kFirst, kNotLast, 5, data3)); |
| 458 |
| 459 // Expect to free data4 upon insertion (packet buffer is full). |
| 460 EXPECT_FALSE(Insert(2 + kMaxSize, kKeyFrame, kFirst, kNotLast, 5, data4)); |
| 461 } |
| 462 |
441 } // namespace video_coding | 463 } // namespace video_coding |
442 } // namespace webrtc | 464 } // namespace webrtc |
OLD | NEW |