Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc b/webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc |
| index 9192839be30566f5ffe2d295cc005e57cb5e182a..3f01552c2c2b3eb61111d97fe1cdf28868f4d3d1 100644 |
| --- a/webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc |
| +++ b/webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc |
| @@ -39,7 +39,7 @@ bool RtcEventLogSource::RegisterRtpHeaderExtension(RTPExtensionType type, |
| return parser_->RegisterRtpHeaderExtension(type, id); |
| } |
| -Packet* RtcEventLogSource::NextPacket() { |
| +std::unique_ptr<Packet> RtcEventLogSource::NextPacket() { |
| while (rtp_packet_index_ < parsed_stream_.GetNumberOfEvents()) { |
| if (parsed_stream_.GetEventType(rtp_packet_index_) == |
| ParsedRtcEventLog::RTP_EVENT) { |
| @@ -54,9 +54,9 @@ Packet* RtcEventLogSource::NextPacket() { |
| uint8_t* packet_header = new uint8_t[header_length]; |
| parsed_stream_.GetRtpHeader(rtp_packet_index_, nullptr, nullptr, |
| packet_header, nullptr, nullptr); |
| - Packet* packet = new Packet(packet_header, header_length, packet_length, |
| - static_cast<double>(timestamp_us) / 1000, |
| - *parser_.get()); |
| + std::unique_ptr<Packet> packet(new Packet( |
| + packet_header, header_length, packet_length, |
| + static_cast<double>(timestamp_us) / 1000, *parser_.get())); |
| if (packet->valid_header()) { |
| // Check if the packet should not be filtered out. |
| if (!filter_.test(packet->header().payloadType) && |
| @@ -70,8 +70,8 @@ Packet* RtcEventLogSource::NextPacket() { |
| << std::endl; |
| } |
| // The packet has either an invalid header or needs to be filtered out, |
| - // so it can be deleted. |
| - delete packet; |
| + // so it can be deleted. Implicitly done since the |packet| goes out of |
| + // scope. |
|
kwiberg-webrtc
2016/05/24 09:04:56
You can probably delete this comment.
hlundin-webrtc
2016/05/24 10:59:15
Done.
|
| } |
| } |
| rtp_packet_index_++; |