Let PacketSource::NextPacket() return an std::unique_ptr

The return type of PacketSource::NextPacket() is changed from a naked
pointer to an std::uniqe_ptr. The interface contract was and still is
that the ownership is passed from the callee to the caller, but a
unique_ptr makes this explicit.

BUG=webrtc:2692

Review-Url: https://codereview.webrtc.org/2005873002
Cr-Commit-Position: refs/heads/master@{#12884}
This commit is contained in:
henrik.lundin
2016-05-24 22:50:47 -07:00
committed by Commit bot
parent 1672ab271c
commit 46ba49c622
14 changed files with 43 additions and 57 deletions

View File

@ -12,6 +12,7 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_SOURCE_H_
#include <bitset>
#include <memory>
#include "webrtc/base/constructormagic.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet.h"
@ -26,9 +27,9 @@ class PacketSource {
PacketSource() : use_ssrc_filter_(false), ssrc_(0) {}
virtual ~PacketSource() {}
// Returns a pointer to the next packet. Returns NULL if the source is
// depleted, or if an error occurred.
virtual Packet* NextPacket() = 0;
// Returns next packet. Returns nullptr if the source is depleted, or if an
// error occurred.
virtual std::unique_ptr<Packet> NextPacket() = 0;
virtual void FilterOutPayloadType(uint8_t payload_type) {
filter_.set(payload_type, true);