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

Unified Diff: webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc

Issue 2005873002: Let PacketSource::NextPacket() return an std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 7 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/tools/constant_pcm_packet_source.cc
diff --git a/webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc b/webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc
index 5a9f79f8773303eda4983f5f0d667bf30c71d163..fbbd468df8baeb58fccb36667014641ab43fb98f 100644
--- a/webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc
@@ -35,7 +35,7 @@ ConstantPcmPacketSource::ConstantPcmPacketSource(size_t payload_len_samples,
RTC_CHECK_EQ(2U, encoded_len);
}
-Packet* ConstantPcmPacketSource::NextPacket() {
+std::unique_ptr<Packet> ConstantPcmPacketSource::NextPacket() {
RTC_CHECK_GT(packet_len_bytes_, kHeaderLenBytes);
uint8_t* packet_memory = new uint8_t[packet_len_bytes_];
// Fill the payload part of the packet memory with the pre-encoded value.
@@ -43,8 +43,8 @@ Packet* ConstantPcmPacketSource::NextPacket() {
packet_memory[kHeaderLenBytes + i] = encoded_sample_[i % 2];
WriteHeader(packet_memory);
// |packet| assumes ownership of |packet_memory|.
- Packet* packet =
- new Packet(packet_memory, packet_len_bytes_, next_arrival_time_ms_);
+ std::unique_ptr<Packet> packet(
+ new Packet(packet_memory, packet_len_bytes_, next_arrival_time_ms_));
next_arrival_time_ms_ += payload_len_samples_ / samples_per_ms_;
return packet;
}

Powered by Google App Engine
This is Rietveld 408576698