Index: webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc |
diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc |
index ba4be60d1d8d6e04b4616a91ead354d83e32c13d..eefe0a5420f2f802dbf75083f9c825d179da5ca7 100644 |
--- a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc |
+++ b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc |
@@ -1152,17 +1152,13 @@ class AcmSenderBitExactnessOldApi : public ::testing::Test, |
remove(output_file_name.c_str()); |
} |
- // Returns a pointer to the next packet. Returns NULL if the source is |
- // depleted (i.e., the test duration is exceeded), or if an error occurred. |
// Inherited from test::PacketSource. |
- test::Packet* NextPacket() override { |
- // Get the next packet from AcmSendTest. Ownership of |packet| is |
- // transferred to this method. |
- test::Packet* packet = send_test_->NextPacket(); |
+ std::unique_ptr<test::Packet> NextPacket() override { |
+ auto packet = send_test_->NextPacket(); |
if (!packet) |
return NULL; |
- VerifyPacket(packet); |
+ VerifyPacket(packet.get()); |
// TODO(henrik.lundin) Save the packet to file as well. |
// Pass it on to the caller. The caller becomes the owner of |packet|. |
@@ -1483,9 +1479,9 @@ class AcmSetBitRateOldApi : public ::testing::Test { |
ASSERT_TRUE(send_test_->acm()); |
send_test_->acm()->SetBitRate(target_bitrate_bps); |
int nr_bytes = 0; |
- while (test::Packet* next_packet = send_test_->NextPacket()) { |
+ while (std::unique_ptr<test::Packet> next_packet = |
+ send_test_->NextPacket()) { |
nr_bytes += next_packet->payload_length_bytes(); |
- delete next_packet; |
} |
EXPECT_EQ(expected_total_bits, nr_bytes * 8); |
} |
@@ -1580,7 +1576,8 @@ class AcmChangeBitRateOldApi : public AcmSetBitRateOldApi { |
sampling_freq_hz_ * kTestDurationMs / (frame_size_samples_ * 1000); |
int nr_bytes_before = 0, nr_bytes_after = 0; |
int packet_counter = 0; |
- while (test::Packet* next_packet = send_test_->NextPacket()) { |
+ while (std::unique_ptr<test::Packet> next_packet = |
+ send_test_->NextPacket()) { |
if (packet_counter == nr_packets / 2) |
send_test_->acm()->SetBitRate(target_bitrate_bps); |
if (packet_counter < nr_packets / 2) |
@@ -1588,7 +1585,6 @@ class AcmChangeBitRateOldApi : public AcmSetBitRateOldApi { |
else |
nr_bytes_after += next_packet->payload_length_bytes(); |
packet_counter++; |
- delete next_packet; |
} |
EXPECT_EQ(expected_before_switch_bits, nr_bytes_before * 8); |
EXPECT_EQ(expected_after_switch_bits, nr_bytes_after * 8); |
@@ -1736,7 +1732,7 @@ class AcmSwitchingOutputFrequencyOldApi : public ::testing::Test, |
} |
// Inherited from test::PacketSource. |
- test::Packet* NextPacket() override { |
+ std::unique_ptr<test::Packet> NextPacket() override { |
// Check if it is time to terminate the test. The packet source is of type |
// ConstantPcmPacketSource, which is infinite, so we must end the test |
// "manually". |