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

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

Issue 2005873002: Let PacketSource::NextPacket() return an std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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/neteq_rtpplay.cc
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
index 1d462b3c9f24b0498d39941e2a73b6c343ef63b5..34b82c10723fb4c80489695fd0cc1f47bed1de90 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
@@ -507,7 +507,7 @@ int main(int argc, char* argv[]) {
replacement_audio.reset(new int16_t[input_frame_size_timestamps]);
payload_mem_size_bytes = 2 * input_frame_size_timestamps;
payload.reset(new uint8_t[payload_mem_size_bytes]);
- next_packet.reset(file_source->NextPacket());
+ next_packet = file_source->NextPacket();
assert(next_packet);
next_packet_available = true;
}
@@ -580,9 +580,10 @@ int main(int argc, char* argv[]) {
}
// Get next packet from file.
- webrtc::test::Packet* temp_packet = file_source->NextPacket();
+ std::unique_ptr<webrtc::test::Packet> temp_packet =
+ file_source->NextPacket();
if (temp_packet) {
- packet.reset(temp_packet);
+ packet = std::move(temp_packet);
if (replace_payload) {
// At this point |packet| contains the packet *after* |next_packet|.
// Swap Packet objects between |packet| and |next_packet|.
@@ -600,6 +601,7 @@ int main(int argc, char* argv[]) {
next_input_time_ms = std::numeric_limits<int64_t>::max();
packet_available = false;
}
+ RTC_DCHECK(!temp_packet); // Must have transferred to another variable.
}
// Check if it is time to get output audio.

Powered by Google App Engine
This is Rietveld 408576698