Replace scoped_ptr with unique_ptr in webrtc/modules/video_coding/

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1721353002

Cr-Commit-Position: refs/heads/master@{#11814}
This commit is contained in:
kwiberg
2016-02-29 05:51:59 -08:00
committed by Commit bot
parent a4f31bd03a
commit 3f55dea259
36 changed files with 145 additions and 118 deletions

View File

@ -13,8 +13,8 @@
#include <stdio.h>
#include <map>
#include <memory>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
@ -62,7 +62,7 @@ class RawRtpPacket {
uint16_t seq_num() const { return seq_num_; }
private:
rtc::scoped_ptr<uint8_t[]> data_;
std::unique_ptr<uint8_t[]> data_;
size_t length_;
int64_t resend_time_ms_;
uint32_t ssrc_;
@ -177,7 +177,7 @@ class LostPackets {
typedef RtpPacketList::iterator RtpPacketIterator;
typedef RtpPacketList::const_iterator ConstRtpPacketIterator;
rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_;
std::unique_ptr<CriticalSectionWrapper> crit_sect_;
FILE* debug_file_;
int loss_count_;
RtpPacketList packets_;
@ -210,7 +210,7 @@ class SsrcHandlers {
}
DEBUG_LOG1("Registering handler for ssrc=%08x", ssrc);
rtc::scoped_ptr<Handler> handler(
std::unique_ptr<Handler> handler(
new Handler(ssrc, payload_types_, lost_packets));
handler->payload_sink_.reset(payload_sink_factory_->Create(handler.get()));
if (handler->payload_sink_.get() == NULL) {
@ -292,10 +292,10 @@ class SsrcHandlers {
virtual uint32_t ssrc() const { return ssrc_; }
virtual const PayloadTypes& payload_types() const { return payload_types_; }
rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_;
rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;
rtc::scoped_ptr<RtpReceiver> rtp_module_;
rtc::scoped_ptr<PayloadSinkInterface> payload_sink_;
std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_;
std::unique_ptr<RtpReceiver> rtp_module_;
std::unique_ptr<PayloadSinkInterface> payload_sink_;
private:
uint32_t ssrc_;
@ -320,7 +320,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
RtpPlayerImpl(PayloadSinkFactoryInterface* payload_sink_factory,
const PayloadTypes& payload_types,
Clock* clock,
rtc::scoped_ptr<test::RtpFileReader>* packet_source,
std::unique_ptr<test::RtpFileReader>* packet_source,
float loss_rate,
int64_t rtt_ms,
bool reordering)
@ -419,7 +419,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
assert(data);
assert(length > 0);
rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser(
std::unique_ptr<RtpHeaderParser> rtp_header_parser(
RtpHeaderParser::Create());
if (!rtp_header_parser->IsRtcp(data, length)) {
RTPHeader header;
@ -448,7 +448,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
SsrcHandlers ssrc_handlers_;
Clock* clock_;
rtc::scoped_ptr<test::RtpFileReader> packet_source_;
std::unique_ptr<test::RtpFileReader> packet_source_;
test::RtpPacket next_packet_;
uint32_t next_rtp_time_;
bool first_packet_;
@ -460,7 +460,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
uint32_t no_loss_startup_;
bool end_of_file_;
bool reordering_;
rtc::scoped_ptr<RawRtpPacket> reorder_buffer_;
std::unique_ptr<RawRtpPacket> reorder_buffer_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpPlayerImpl);
};
@ -472,7 +472,7 @@ RtpPlayerInterface* Create(const std::string& input_filename,
float loss_rate,
int64_t rtt_ms,
bool reordering) {
rtc::scoped_ptr<test::RtpFileReader> packet_source(
std::unique_ptr<test::RtpFileReader> packet_source(
test::RtpFileReader::Create(test::RtpFileReader::kRtpDump,
input_filename));
if (packet_source.get() == NULL) {
@ -483,7 +483,7 @@ RtpPlayerInterface* Create(const std::string& input_filename,
}
}
rtc::scoped_ptr<RtpPlayerImpl> impl(
std::unique_ptr<RtpPlayerImpl> impl(
new RtpPlayerImpl(payload_sink_factory, payload_types, clock,
&packet_source, loss_rate, rtt_ms, reordering));
return impl.release();

View File

@ -27,8 +27,8 @@ class VcmPayloadSinkFactory::VcmPayloadSink : public PayloadSinkInterface,
public:
VcmPayloadSink(VcmPayloadSinkFactory* factory,
RtpStreamInterface* stream,
rtc::scoped_ptr<VideoCodingModule>* vcm,
rtc::scoped_ptr<FileOutputFrameReceiver>* frame_receiver)
std::unique_ptr<VideoCodingModule>* vcm,
std::unique_ptr<FileOutputFrameReceiver>* frame_receiver)
: factory_(factory), stream_(stream), vcm_(), frame_receiver_() {
assert(factory);
assert(stream);
@ -87,8 +87,8 @@ class VcmPayloadSinkFactory::VcmPayloadSink : public PayloadSinkInterface,
private:
VcmPayloadSinkFactory* factory_;
RtpStreamInterface* stream_;
rtc::scoped_ptr<VideoCodingModule> vcm_;
rtc::scoped_ptr<FileOutputFrameReceiver> frame_receiver_;
std::unique_ptr<VideoCodingModule> vcm_;
std::unique_ptr<FileOutputFrameReceiver> frame_receiver_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(VcmPayloadSink);
};
@ -124,7 +124,7 @@ PayloadSinkInterface* VcmPayloadSinkFactory::Create(
assert(stream);
CriticalSectionScoped cs(crit_sect_.get());
rtc::scoped_ptr<VideoCodingModule> vcm(
std::unique_ptr<VideoCodingModule> vcm(
VideoCodingModule::Create(clock_, null_event_factory_.get()));
if (vcm.get() == NULL) {
return NULL;
@ -149,9 +149,9 @@ PayloadSinkInterface* VcmPayloadSinkFactory::Create(
vcm->SetMinimumPlayoutDelay(min_playout_delay_ms_);
vcm->SetNackSettings(kMaxNackListSize, kMaxPacketAgeToNack, 0);
rtc::scoped_ptr<FileOutputFrameReceiver> frame_receiver(
std::unique_ptr<FileOutputFrameReceiver> frame_receiver(
new FileOutputFrameReceiver(base_out_filename_, stream->ssrc()));
rtc::scoped_ptr<VcmPayloadSink> sink(
std::unique_ptr<VcmPayloadSink> sink(
new VcmPayloadSink(this, stream, &vcm, &frame_receiver));
sinks_.push_back(sink.get());

View File

@ -11,11 +11,11 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_TEST_VCM_PAYLOAD_SINK_FACTORY_H_
#define WEBRTC_MODULES_VIDEO_CODING_TEST_VCM_PAYLOAD_SINK_FACTORY_H_
#include <memory>
#include <string>
#include <vector>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/video_coding/include/video_coding_defines.h"
#include "webrtc/modules/video_coding/test/rtp_player.h"
@ -58,8 +58,8 @@ class VcmPayloadSinkFactory : public PayloadSinkFactoryInterface {
int64_t rtt_ms_;
uint32_t render_delay_ms_;
uint32_t min_playout_delay_ms_;
rtc::scoped_ptr<NullEventFactory> null_event_factory_;
rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_;
std::unique_ptr<NullEventFactory> null_event_factory_;
std::unique_ptr<CriticalSectionWrapper> crit_sect_;
Sinks sinks_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(VcmPayloadSinkFactory);

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "webrtc/modules/video_coding/test/receiver_tests.h"
#include "webrtc/modules/video_coding/test/vcm_payload_sink_factory.h"
#include "webrtc/system_wrappers/include/trace.h"
@ -51,7 +53,7 @@ int RtpPlay(const CmdArgs& args) {
webrtc::rtpplayer::VcmPayloadSinkFactory factory(
output_file, &clock, kConfigProtectionEnabled, kConfigProtectionMethod,
kConfigRttMs, kConfigRenderDelayMs, kConfigMinPlayoutDelayMs);
rtc::scoped_ptr<webrtc::rtpplayer::RtpPlayerInterface> rtp_player(
std::unique_ptr<webrtc::rtpplayer::RtpPlayerInterface> rtp_player(
webrtc::rtpplayer::Create(args.inputFile, &factory, &clock, payload_types,
kConfigLossRate, kConfigRttMs,
kConfigReordering));