Chromium Code Reviews| 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..6b32efaecb4f1fe23b0a3dec46906e4fee5df5b1 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 = rtc::Buffer(payload_size_bytes); |
|
kwiberg-webrtc
2016/08/30 16:04:36
packet->payload.SetSize(payload_size_bytes);
Also
ossu
2016/08/30 16:27:14
Acknowledged.
|
| ++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; |
| } |