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

Unified Diff: webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc

Issue 2289093003: NetEq: Changed Packet::payload to be an rtc::Buffer (Closed)
Patch Set: Changed Buffer constructor calls to SetData or SetSize Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc
diff --git a/webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc b/webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc
index 73dbd6203f81f48d7451afe9a8d08cdc997419ec..ba507986483cc220f5607ef4951f140e4a5fc82a 100644
--- a/webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc
@@ -59,9 +59,8 @@ Packet* PacketGenerator::NextPacket(int payload_size_bytes) {
packet->header.ssrc = 0x12345678;
packet->header.numCSRCs = 0;
packet->header.paddingLength = 0;
- packet->payload_length = payload_size_bytes;
packet->primary = true;
- packet->payload = new uint8_t[payload_size_bytes];
+ packet->payload.SetSize(payload_size_bytes);
++seq_no_;
ts_ += frame_size_;
return packet;
@@ -282,7 +281,6 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
Packet* packet = buffer.GetNextPacket(&drop_count);
EXPECT_EQ(0u, drop_count);
EXPECT_EQ(packet, expect_order[i]); // Compare pointer addresses.
- delete[] packet->payload;
delete packet;
}
EXPECT_TRUE(buffer.Empty());
@@ -357,7 +355,6 @@ TEST(PacketBuffer, Reordering) {
ASSERT_FALSE(packet == NULL);
EXPECT_EQ(current_ts, packet->header.timestamp);
current_ts += ts_increment;
- delete [] packet->payload;
delete packet;
}
EXPECT_TRUE(buffer.Empty());
@@ -377,8 +374,7 @@ TEST(PacketBuffer, Failures) {
Packet* packet = NULL;
EXPECT_EQ(PacketBuffer::kInvalidPacket, buffer->InsertPacket(packet));
packet = gen.NextPacket(payload_len);
- delete [] packet->payload;
- packet->payload = NULL;
+ packet->payload.Clear();
EXPECT_EQ(PacketBuffer::kInvalidPacket, buffer->InsertPacket(packet));
// Packet is deleted by the PacketBuffer.
@@ -407,8 +403,7 @@ TEST(PacketBuffer, Failures) {
PacketList list;
list.push_back(gen.NextPacket(payload_len)); // Valid packet.
packet = gen.NextPacket(payload_len);
- delete [] packet->payload;
- packet->payload = NULL; // Invalid.
+ packet->payload.Clear(); // Invalid.
list.push_back(packet);
list.push_back(gen.NextPacket(payload_len)); // Valid packet.
MockDecoderDatabase decoder_database;
@@ -484,9 +479,7 @@ TEST(PacketBuffer, ComparePackets) {
EXPECT_FALSE(*a <= *b);
EXPECT_TRUE(*a >= *b);
- delete [] a->payload;
delete a;
- delete [] b->payload;
delete b;
}

Powered by Google App Engine
This is Rietveld 408576698