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

Side by Side Diff: webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 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
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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 Packet packet = gen.NextPacket(payload_len); 443 Packet packet = gen.NextPacket(payload_len);
444 packet.payload.Clear(); 444 packet.payload.Clear();
445 EXPECT_EQ(PacketBuffer::kInvalidPacket, 445 EXPECT_EQ(PacketBuffer::kInvalidPacket,
446 buffer->InsertPacket(std::move(packet))); 446 buffer->InsertPacket(std::move(packet)));
447 } 447 }
448 // Buffer should still be empty. Test all empty-checks. 448 // Buffer should still be empty. Test all empty-checks.
449 uint32_t temp_ts; 449 uint32_t temp_ts;
450 EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->NextTimestamp(&temp_ts)); 450 EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->NextTimestamp(&temp_ts));
451 EXPECT_EQ(PacketBuffer::kBufferEmpty, 451 EXPECT_EQ(PacketBuffer::kBufferEmpty,
452 buffer->NextHigherTimestamp(0, &temp_ts)); 452 buffer->NextHigherTimestamp(0, &temp_ts));
453 EXPECT_EQ(NULL, buffer->PeekNextPacket()); 453 EXPECT_EQ(nullptr, buffer->PeekNextPacket());
454 EXPECT_FALSE(buffer->GetNextPacket()); 454 EXPECT_FALSE(buffer->GetNextPacket());
455 EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->DiscardNextPacket()); 455 EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->DiscardNextPacket());
456 EXPECT_EQ(0, buffer->DiscardAllOldPackets(0)); // 0 packets discarded. 456 EXPECT_EQ(0, buffer->DiscardAllOldPackets(0)); // 0 packets discarded.
457 457
458 // Insert one packet to make the buffer non-empty. 458 // Insert one packet to make the buffer non-empty.
459 EXPECT_EQ(PacketBuffer::kOK, 459 EXPECT_EQ(PacketBuffer::kOK,
460 buffer->InsertPacket(gen.NextPacket(payload_len))); 460 buffer->InsertPacket(gen.NextPacket(payload_len)));
461 EXPECT_EQ(PacketBuffer::kInvalidPointer, buffer->NextTimestamp(NULL)); 461 EXPECT_EQ(PacketBuffer::kInvalidPointer, buffer->NextTimestamp(nullptr));
462 EXPECT_EQ(PacketBuffer::kInvalidPointer, 462 EXPECT_EQ(PacketBuffer::kInvalidPointer,
463 buffer->NextHigherTimestamp(0, NULL)); 463 buffer->NextHigherTimestamp(0, nullptr));
464 delete buffer; 464 delete buffer;
465 465
466 // Insert packet list of three packets, where the second packet has an invalid 466 // Insert packet list of three packets, where the second packet has an invalid
467 // payload. Expect first packet to be inserted, and the remaining two to be 467 // payload. Expect first packet to be inserted, and the remaining two to be
468 // discarded. 468 // discarded.
469 buffer = new PacketBuffer(100, &tick_timer); // 100 packets. 469 buffer = new PacketBuffer(100, &tick_timer); // 100 packets.
470 PacketList list; 470 PacketList list;
471 list.push_back(gen.NextPacket(payload_len)); // Valid packet. 471 list.push_back(gen.NextPacket(payload_len)); // Valid packet.
472 { 472 {
473 Packet packet = gen.NextPacket(payload_len); 473 Packet packet = gen.NextPacket(payload_len);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 // Test the IsObsoleteTimestamp method with different limit timestamps. 658 // Test the IsObsoleteTimestamp method with different limit timestamps.
659 TEST(PacketBuffer, IsObsoleteTimestamp) { 659 TEST(PacketBuffer, IsObsoleteTimestamp) {
660 TestIsObsoleteTimestamp(0); 660 TestIsObsoleteTimestamp(0);
661 TestIsObsoleteTimestamp(1); 661 TestIsObsoleteTimestamp(1);
662 TestIsObsoleteTimestamp(0xFFFFFFFF); // -1 in uint32_t. 662 TestIsObsoleteTimestamp(0xFFFFFFFF); // -1 in uint32_t.
663 TestIsObsoleteTimestamp(0x80000000); // 2^31. 663 TestIsObsoleteTimestamp(0x80000000); // 2^31.
664 TestIsObsoleteTimestamp(0x80000001); // 2^31 + 1. 664 TestIsObsoleteTimestamp(0x80000001); // 2^31 + 1.
665 TestIsObsoleteTimestamp(0x7FFFFFFF); // 2^31 - 1. 665 TestIsObsoleteTimestamp(0x7FFFFFFF); // 2^31 - 1.
666 } 666 }
667 } // namespace webrtc 667 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698