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

@ -12,8 +12,8 @@
#define WEBRTC_MODULES_VIDEO_CODING_CODEC_DATABASE_H_
#include <map>
#include <memory>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/modules/video_coding/include/video_coding.h"
#include "webrtc/modules/video_coding/generic_decoder.h"
@ -28,7 +28,7 @@ struct VCMDecoderMapItem {
int number_of_cores,
bool require_key_frame);
rtc::scoped_ptr<VideoCodec> settings;
std::unique_ptr<VideoCodec> settings;
int number_of_cores;
bool require_key_frame;
};
@ -156,7 +156,7 @@ class VCMCodecDataBase {
bool internal_source_;
VideoEncoderRateObserver* const encoder_rate_observer_;
VCMEncodedFrameCallback* const encoded_frame_callback_;
rtc::scoped_ptr<VCMGenericEncoder> ptr_encoder_;
std::unique_ptr<VCMGenericEncoder> ptr_encoder_;
VCMGenericDecoder* ptr_decoder_;
DecoderMap dec_map_;
ExternalDecoderMap dec_external_map_;

View File

@ -12,13 +12,14 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_
#include <memory>
#include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
extern "C" {
#include "third_party/ffmpeg/libavcodec/avcodec.h"
} // extern "C"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_video/include/i420_buffer_pool.h"
namespace webrtc {
@ -67,8 +68,8 @@ class H264DecoderImpl : public H264Decoder {
void ReportError();
I420BufferPool pool_;
rtc::scoped_ptr<AVCodecContext, AVCodecContextDeleter> av_context_;
rtc::scoped_ptr<AVFrame, AVFrameDeleter> av_frame_;
std::unique_ptr<AVCodecContext, AVCodecContextDeleter> av_context_;
std::unique_ptr<AVFrame, AVFrameDeleter> av_frame_;
DecodedImageCallback* decoded_image_callback_;

View File

@ -81,7 +81,7 @@ static FrameType EVideoFrameType_to_FrameType(EVideoFrameType type) {
// is updated to point to each fragment, with offsets and lengths set as to
// exclude the start codes.
static void RtpFragmentize(EncodedImage* encoded_image,
rtc::scoped_ptr<uint8_t[]>* encoded_image_buffer,
std::unique_ptr<uint8_t[]>* encoded_image_buffer,
const VideoFrame& frame,
SFrameBSInfo* info,
RTPFragmentationHeader* frag_header) {

View File

@ -14,9 +14,9 @@
#include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
#include <memory>
#include <vector>
#include "webrtc/base/scoped_ptr.h"
class ISVCEncoder;
@ -65,7 +65,7 @@ class H264EncoderImpl : public H264Encoder {
VideoCodec codec_settings_;
EncodedImage encoded_image_;
rtc::scoped_ptr<uint8_t[]> encoded_image_buffer_;
std::unique_ptr<uint8_t[]> encoded_image_buffer_;
EncodedImageCallback* encoded_image_callback_;
bool has_reported_init_;

View File

@ -13,6 +13,8 @@
#if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED)
#include <memory>
#include "libyuv/convert.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
@ -85,7 +87,7 @@ void VTDecompressionOutputCallback(void* decoder,
CVImageBufferRef image_buffer,
CMTime timestamp,
CMTime duration) {
rtc::scoped_ptr<FrameDecodeParams> decode_params(
std::unique_ptr<FrameDecodeParams> decode_params(
reinterpret_cast<FrameDecodeParams*>(params));
if (status != noErr) {
LOG(LS_ERROR) << "Failed to decode frame. Status: " << status;
@ -142,7 +144,7 @@ int H264VideoToolboxDecoder::Decode(
}
VTDecodeFrameFlags decode_flags =
kVTDecodeFrame_EnableAsynchronousDecompression;
rtc::scoped_ptr<internal::FrameDecodeParams> frame_decode_params;
std::unique_ptr<internal::FrameDecodeParams> frame_decode_params;
frame_decode_params.reset(
new internal::FrameDecodeParams(callback_, input_image._timeStamp));
OSStatus status = VTDecompressionSessionDecodeFrame(

View File

@ -13,13 +13,13 @@
#if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED)
#include <memory>
#include <string>
#include <vector>
#include "libyuv/convert_from.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.h"
#include "webrtc/system_wrappers/include/clock.h"
@ -43,7 +43,7 @@ std::string CFStringToString(const CFStringRef cf_string) {
CFStringGetMaximumSizeForEncoding(CFStringGetLength(cf_string),
kCFStringEncodingUTF8) +
1;
rtc::scoped_ptr<char[]> buffer(new char[buffer_size]);
std::unique_ptr<char[]> buffer(new char[buffer_size]);
if (CFStringGetCString(cf_string, buffer.get(), buffer_size,
kCFStringEncodingUTF8)) {
// Copy over the characters.
@ -177,7 +177,7 @@ void VTCompressionOutputCallback(void* encoder,
OSStatus status,
VTEncodeInfoFlags info_flags,
CMSampleBufferRef sample_buffer) {
rtc::scoped_ptr<FrameEncodeParams> encode_params(
std::unique_ptr<FrameEncodeParams> encode_params(
reinterpret_cast<FrameEncodeParams*>(params));
encode_params->encoder->OnEncodedFrame(
status, info_flags, sample_buffer, encode_params->codec_specific_info,
@ -277,7 +277,7 @@ int H264VideoToolboxEncoder::Encode(
CFTypeRef values[] = {kCFBooleanTrue};
frame_properties = internal::CreateCFDictionary(keys, values, 1);
}
rtc::scoped_ptr<internal::FrameEncodeParams> encode_params;
std::unique_ptr<internal::FrameEncodeParams> encode_params;
encode_params.reset(new internal::FrameEncodeParams(
this, codec_specific_info, width_, height_, input_image.render_time_ms(),
input_image.timestamp()));
@ -462,12 +462,17 @@ void H264VideoToolboxEncoder::OnEncodedFrame(
// Convert the sample buffer into a buffer suitable for RTP packetization.
// TODO(tkchin): Allocate buffers through a pool.
rtc::scoped_ptr<rtc::Buffer> buffer(new rtc::Buffer());
rtc::scoped_ptr<webrtc::RTPFragmentationHeader> header;
if (!H264CMSampleBufferToAnnexBBuffer(sample_buffer, is_keyframe,
buffer.get(), header.accept())) {
std::unique_ptr<rtc::Buffer> buffer(new rtc::Buffer());
std::unique_ptr<webrtc::RTPFragmentationHeader> header;
{
webrtc::RTPFragmentationHeader* header_raw;
bool result = H264CMSampleBufferToAnnexBBuffer(sample_buffer, is_keyframe,
buffer.get(), &header_raw);
header.reset(header_raw);
if (!result) {
return;
}
}
webrtc::EncodedImage frame(buffer->data(), buffer->size(), buffer->size());
frame._encodedWidth = width;
frame._encodedHeight = height;

View File

@ -14,6 +14,7 @@
#if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED)
#include <CoreFoundation/CoreFoundation.h>
#include <memory>
#include <vector>
#include "webrtc/base/checks.h"
@ -139,7 +140,7 @@ bool H264CMSampleBufferToAnnexBBuffer(
}
RTC_DCHECK_EQ(bytes_remaining, (size_t)0);
rtc::scoped_ptr<webrtc::RTPFragmentationHeader> header;
std::unique_ptr<webrtc::RTPFragmentationHeader> header;
header.reset(new webrtc::RTPFragmentationHeader());
header->VerifyAndAllocateFragmentationHeader(frag_offsets.size());
RTC_DCHECK_EQ(frag_lengths.size(), frag_offsets.size());

View File

@ -9,6 +9,8 @@
*
*/
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/arraysize.h"
@ -90,7 +92,7 @@ TEST(AnnexBBufferReaderTest, TestReadMultipleNalus) {
TEST(AvccBufferWriterTest, TestEmptyOutputBuffer) {
const uint8_t expected_buffer[] = {0x00};
const size_t buffer_size = 1;
rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
memset(buffer.get(), 0, buffer_size);
AvccBufferWriter writer(buffer.get(), 0);
EXPECT_EQ(0u, writer.BytesRemaining());
@ -104,7 +106,7 @@ TEST(AvccBufferWriterTest, TestWriteSingleNalu) {
0x00, 0x00, 0x00, 0x03, 0xAA, 0xBB, 0xCC,
};
const size_t buffer_size = arraysize(NALU_TEST_DATA_0) + 4;
rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
AvccBufferWriter writer(buffer.get(), buffer_size);
EXPECT_EQ(buffer_size, writer.BytesRemaining());
EXPECT_TRUE(writer.WriteNalu(NALU_TEST_DATA_0, arraysize(NALU_TEST_DATA_0)));
@ -123,7 +125,7 @@ TEST(AvccBufferWriterTest, TestWriteMultipleNalus) {
// clang-format on
const size_t buffer_size =
arraysize(NALU_TEST_DATA_0) + arraysize(NALU_TEST_DATA_1) + 8;
rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
AvccBufferWriter writer(buffer.get(), buffer_size);
EXPECT_EQ(buffer_size, writer.BytesRemaining());
EXPECT_TRUE(writer.WriteNalu(NALU_TEST_DATA_0, arraysize(NALU_TEST_DATA_0)));
@ -138,7 +140,7 @@ TEST(AvccBufferWriterTest, TestWriteMultipleNalus) {
TEST(AvccBufferWriterTest, TestOverflow) {
const uint8_t expected_buffer[] = {0x00, 0x00, 0x00};
const size_t buffer_size = arraysize(NALU_TEST_DATA_0);
rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
memset(buffer.get(), 0, buffer_size);
AvccBufferWriter writer(buffer.get(), buffer_size);
EXPECT_EQ(buffer_size, writer.BytesRemaining());

View File

@ -14,6 +14,7 @@
#include <string.h>
#include <limits>
#include <memory>
#include <vector>
#include "webrtc/system_wrappers/include/cpu_info.h"
@ -283,7 +284,7 @@ void VideoProcessorImpl::FrameEncoded(
// Make a raw copy of the |encoded_image| buffer.
size_t copied_buffer_size = encoded_image._length +
EncodedImage::GetBufferPaddingBytes(codec);
rtc::scoped_ptr<uint8_t[]> copied_buffer(new uint8_t[copied_buffer_size]);
std::unique_ptr<uint8_t[]> copied_buffer(new uint8_t[copied_buffer_size]);
memcpy(copied_buffer.get(), encoded_image._buffer, encoded_image._length);
// The image to feed to the decoder.
EncodedImage copied_image;
@ -350,7 +351,7 @@ void VideoProcessorImpl::FrameDecoded(const VideoFrame& image) {
}
// TODO(mikhal): Extracting the buffer for now - need to update test.
size_t length = CalcBufferSize(kI420, up_image.width(), up_image.height());
rtc::scoped_ptr<uint8_t[]> image_buffer(new uint8_t[length]);
std::unique_ptr<uint8_t[]> image_buffer(new uint8_t[length]);
int extracted_length = ExtractBuffer(up_image, length, image_buffer.get());
assert(extracted_length > 0);
// Update our copy of the last successful frame:
@ -364,7 +365,7 @@ void VideoProcessorImpl::FrameDecoded(const VideoFrame& image) {
// Update our copy of the last successful frame:
// TODO(mikhal): Add as a member function, so won't be allocated per frame.
size_t length = CalcBufferSize(kI420, image.width(), image.height());
rtc::scoped_ptr<uint8_t[]> image_buffer(new uint8_t[length]);
std::unique_ptr<uint8_t[]> image_buffer(new uint8_t[length]);
int extracted_length = ExtractBuffer(image, length, image_buffer.get());
assert(extracted_length > 0);
memcpy(last_successful_frame_buffer_, image_buffer.get(), extracted_length);

View File

@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <vector>
#include "gtest/gtest.h"
#include "vpx/vpx_encoder.h"
#include "vpx/vp8cx.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h"
#include "webrtc/modules/video_coding/utility/mock/mock_frame_dropper.h"
@ -105,7 +105,7 @@ class ScreenshareLayerTest : public ::testing::Test {
int min_qp_;
int max_qp_;
int frame_size_;
rtc::scoped_ptr<ScreenshareLayers> layers_;
std::unique_ptr<ScreenshareLayers> layers_;
};
TEST_F(ScreenshareLayerTest, 1Layer) {

View File

@ -12,10 +12,10 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_
#include <memory>
#include <string>
#include <vector>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
namespace webrtc {
@ -110,8 +110,8 @@ class SimulcastEncoderAdapter : public VP8Encoder {
bool Initialized() const;
rtc::scoped_ptr<VideoEncoderFactory> factory_;
rtc::scoped_ptr<TemporalLayersFactory> screensharing_tl_factory_;
std::unique_ptr<VideoEncoderFactory> factory_;
std::unique_ptr<TemporalLayersFactory> screensharing_tl_factory_;
VideoCodec codec_;
std::vector<StreamInfo> streaminfos_;
EncodedImageCallback* encoded_complete_callback_;

View File

@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <vector>
#include "testing/gmock/include/gmock/gmock.h"
@ -340,8 +341,8 @@ class TestSimulcastEncoderAdapterFake : public ::testing::Test,
}
protected:
rtc::scoped_ptr<TestSimulcastEncoderAdapterFakeHelper> helper_;
rtc::scoped_ptr<VP8Encoder> adapter_;
std::unique_ptr<TestSimulcastEncoderAdapterFakeHelper> helper_;
std::unique_ptr<VP8Encoder> adapter_;
VideoCodec codec_;
int last_encoded_image_width_;
int last_encoded_image_height_;

View File

@ -12,10 +12,10 @@
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_
#include <algorithm>
#include <memory>
#include <vector>
#include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
@ -944,9 +944,9 @@ class TestVp8Simulcast : public ::testing::Test {
}
}
rtc::scoped_ptr<VP8Encoder> encoder_;
std::unique_ptr<VP8Encoder> encoder_;
MockEncodedImageCallback encoder_callback_;
rtc::scoped_ptr<VP8Decoder> decoder_;
std::unique_ptr<VP8Decoder> decoder_;
MockDecodedImageCallback decoder_callback_;
VideoCodec settings_;
VideoFrame input_frame_;

View File

@ -10,9 +10,10 @@
#include <stdio.h>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
#include "webrtc/system_wrappers/include/tick_util.h"
@ -41,7 +42,7 @@ class Vp8UnitTestEncodeCompleteCallback : public webrtc::EncodedImageCallback {
private:
EncodedImage* const encoded_frame_;
rtc::scoped_ptr<uint8_t[]> frame_buffer_;
std::unique_ptr<uint8_t[]> frame_buffer_;
bool encode_complete_;
};
@ -181,13 +182,13 @@ class TestVp8Impl : public ::testing::Test {
const int kWidth = 172;
const int kHeight = 144;
rtc::scoped_ptr<Vp8UnitTestEncodeCompleteCallback> encode_complete_callback_;
rtc::scoped_ptr<Vp8UnitTestDecodeCompleteCallback> decode_complete_callback_;
rtc::scoped_ptr<uint8_t[]> source_buffer_;
std::unique_ptr<Vp8UnitTestEncodeCompleteCallback> encode_complete_callback_;
std::unique_ptr<Vp8UnitTestDecodeCompleteCallback> decode_complete_callback_;
std::unique_ptr<uint8_t[]> source_buffer_;
FILE* source_file_;
VideoFrame input_frame_;
rtc::scoped_ptr<VideoEncoder> encoder_;
rtc::scoped_ptr<VideoDecoder> decoder_;
std::unique_ptr<VideoEncoder> encoder_;
std::unique_ptr<VideoDecoder> decoder_;
EncodedImage encoded_frame_;
VideoFrame decoded_frame_;
size_t length_source_frame_;

View File

@ -8,9 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_video/include/video_image.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
@ -147,7 +148,7 @@ int SequenceCoder(webrtc::test::CommandLineParser* parser) {
EXPECT_EQ(0, decoder->InitDecode(&inst, 1));
webrtc::VideoFrame input_frame;
size_t length = webrtc::CalcBufferSize(webrtc::kI420, width, height);
rtc::scoped_ptr<uint8_t[]> frame_buffer(new uint8_t[length]);
std::unique_ptr<uint8_t[]> frame_buffer(new uint8_t[length]);
int half_width = (width + 1) / 2;
// Set and register callbacks.

View File

@ -9,6 +9,7 @@
*/
#include <limits>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "vpx/vp8cx.h"
@ -81,7 +82,7 @@ class ScreenshareLayerTestVP9 : public ::testing::Test {
Settings expected_;
SimulatedClock clock_;
rtc::scoped_ptr<ScreenshareLayersVP9> layers_;
std::unique_ptr<ScreenshareLayersVP9> layers_;
};
TEST_F(ScreenshareLayerTestVP9, NoRefsOnKeyFrame) {

View File

@ -12,6 +12,7 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_VP9_IMPL_H_
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_VP9_IMPL_H_
#include <memory>
#include <vector>
#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
@ -128,7 +129,7 @@ class VP9EncoderImpl : public VP9Encoder {
int64_t frames_encoded_;
uint8_t num_ref_pics_[kMaxVp9NumberOfSpatialLayers];
uint8_t p_diff_[kMaxVp9NumberOfSpatialLayers][kMaxVp9RefPics];
rtc::scoped_ptr<ScreenshareLayersVP9> spatial_layer_;
std::unique_ptr<ScreenshareLayersVP9> spatial_layer_;
};
class VP9DecoderImpl : public VP9Decoder {

View File

@ -18,7 +18,6 @@
#include "webrtc/modules/video_coding/include/video_coding_defines.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
namespace webrtc {
class CriticalSectionWrapper;

View File

@ -215,7 +215,7 @@ void Vp9SsMap::UpdateFrames(FrameList* frames) {
}
VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
rtc::scoped_ptr<EventWrapper> event)
std::unique_ptr<EventWrapper> event)
: clock_(clock),
running_(false),
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),

View File

@ -13,6 +13,7 @@
#include <list>
#include <map>
#include <memory>
#include <set>
#include <vector>
@ -103,7 +104,7 @@ class Vp9SsMap {
class VCMJitterBuffer {
public:
VCMJitterBuffer(Clock* clock, rtc::scoped_ptr<EventWrapper> event);
VCMJitterBuffer(Clock* clock, std::unique_ptr<EventWrapper> event);
~VCMJitterBuffer();
@ -325,7 +326,7 @@ class VCMJitterBuffer {
bool running_;
CriticalSectionWrapper* crit_sect_;
// Event to signal when we have a frame ready for decoder.
rtc::scoped_ptr<EventWrapper> frame_event_;
std::unique_ptr<EventWrapper> frame_event_;
// Number of allocated frames.
int max_number_of_frames_;
UnorderedFrameList free_frames_ GUARDED_BY(crit_sect_);

View File

@ -11,6 +11,7 @@
#include <string.h>
#include <list>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/modules/video_coding/frame_buffer.h"
@ -190,7 +191,7 @@ class TestBasicJitterBuffer : public ::testing::Test {
clock_.reset(new SimulatedClock(0));
jitter_buffer_.reset(new VCMJitterBuffer(
clock_.get(),
rtc::scoped_ptr<EventWrapper>(event_factory_.CreateEvent())));
std::unique_ptr<EventWrapper>(event_factory_.CreateEvent())));
jitter_buffer_->Start();
seq_num_ = 1234;
timestamp_ = 0;
@ -273,10 +274,10 @@ class TestBasicJitterBuffer : public ::testing::Test {
uint32_t timestamp_;
int size_;
uint8_t data_[1500];
rtc::scoped_ptr<VCMPacket> packet_;
rtc::scoped_ptr<SimulatedClock> clock_;
std::unique_ptr<VCMPacket> packet_;
std::unique_ptr<SimulatedClock> clock_;
NullEventFactory event_factory_;
rtc::scoped_ptr<VCMJitterBuffer> jitter_buffer_;
std::unique_ptr<VCMJitterBuffer> jitter_buffer_;
};
class TestRunningJitterBuffer : public ::testing::Test {
@ -289,7 +290,7 @@ class TestRunningJitterBuffer : public ::testing::Test {
oldest_packet_to_nack_ = 250;
jitter_buffer_ = new VCMJitterBuffer(
clock_.get(),
rtc::scoped_ptr<EventWrapper>(event_factory_.CreateEvent()));
std::unique_ptr<EventWrapper>(event_factory_.CreateEvent()));
stream_generator_ = new StreamGenerator(0, clock_->TimeInMilliseconds());
jitter_buffer_->Start();
jitter_buffer_->SetNackSettings(max_nack_list_size_, oldest_packet_to_nack_,
@ -380,7 +381,7 @@ class TestRunningJitterBuffer : public ::testing::Test {
VCMJitterBuffer* jitter_buffer_;
StreamGenerator* stream_generator_;
rtc::scoped_ptr<SimulatedClock> clock_;
std::unique_ptr<SimulatedClock> clock_;
NullEventFactory event_factory_;
size_t max_nack_list_size_;
int oldest_packet_to_nack_;

View File

@ -14,8 +14,9 @@
#include <math.h>
#include <stdlib.h>
#include <memory>
#include "webrtc/base/exp_filter.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/video_coding/internal_defines.h"
#include "webrtc/modules/video_coding/qm_select.h"
#include "webrtc/system_wrappers/include/trace.h"
@ -333,7 +334,7 @@ class VCMLossProtectionLogic {
// Sets the available loss protection methods.
void UpdateMaxLossHistory(uint8_t lossPr255, int64_t now);
uint8_t MaxFilteredLossPr(int64_t nowMs) const;
rtc::scoped_ptr<VCMProtectionMethod> _selectedMethod;
std::unique_ptr<VCMProtectionMethod> _selectedMethod;
VCMProtectionParameters _currentParameters;
int64_t _rtt;
float _lossPr;

View File

@ -12,8 +12,8 @@
#define WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPTIMIZATION_H_
#include <list>
#include <memory>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/video_coding/include/video_coding.h"
#include "webrtc/modules/video_coding/media_opt_util.h"
@ -134,7 +134,7 @@ class MediaOptimization {
uint32_t SentFrameRateInternal() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
// Protect all members.
rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_;
std::unique_ptr<CriticalSectionWrapper> crit_sect_;
Clock* clock_ GUARDED_BY(crit_sect_);
int32_t max_bit_rate_ GUARDED_BY(crit_sect_);
@ -142,8 +142,8 @@ class MediaOptimization {
uint16_t codec_width_ GUARDED_BY(crit_sect_);
uint16_t codec_height_ GUARDED_BY(crit_sect_);
float user_frame_rate_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<FrameDropper> frame_dropper_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<VCMLossProtectionLogic> loss_prot_logic_
std::unique_ptr<FrameDropper> frame_dropper_ GUARDED_BY(crit_sect_);
std::unique_ptr<VCMLossProtectionLogic> loss_prot_logic_
GUARDED_BY(crit_sect_);
uint8_t fraction_lost_ GUARDED_BY(crit_sect_);
uint32_t send_statistics_[4] GUARDED_BY(crit_sect_);
@ -158,8 +158,8 @@ class MediaOptimization {
uint32_t avg_sent_framerate_ GUARDED_BY(crit_sect_);
uint32_t key_frame_cnt_ GUARDED_BY(crit_sect_);
uint32_t delta_frame_cnt_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<VCMContentMetricsProcessing> content_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<VCMQmResolution> qm_resolution_ GUARDED_BY(crit_sect_);
std::unique_ptr<VCMContentMetricsProcessing> content_ GUARDED_BY(crit_sect_);
std::unique_ptr<VCMQmResolution> qm_resolution_ GUARDED_BY(crit_sect_);
int64_t last_qm_update_time_ GUARDED_BY(crit_sect_);
int64_t last_change_time_ GUARDED_BY(crit_sect_); // Content/user triggered.
int num_layers_ GUARDED_BY(crit_sect_);

View File

@ -32,14 +32,14 @@ VCMReceiver::VCMReceiver(VCMTiming* timing,
EventFactory* event_factory)
: VCMReceiver(timing,
clock,
rtc::scoped_ptr<EventWrapper>(event_factory->CreateEvent()),
rtc::scoped_ptr<EventWrapper>(event_factory->CreateEvent())) {
std::unique_ptr<EventWrapper>(event_factory->CreateEvent()),
std::unique_ptr<EventWrapper>(event_factory->CreateEvent())) {
}
VCMReceiver::VCMReceiver(VCMTiming* timing,
Clock* clock,
rtc::scoped_ptr<EventWrapper> receiver_event,
rtc::scoped_ptr<EventWrapper> jitter_buffer_event)
std::unique_ptr<EventWrapper> receiver_event,
std::unique_ptr<EventWrapper> jitter_buffer_event)
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
clock_(clock),
jitter_buffer_(clock_, std::move(jitter_buffer_event)),

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_RECEIVER_H_
#define WEBRTC_MODULES_VIDEO_CODING_RECEIVER_H_
#include <memory>
#include <vector>
#include "webrtc/modules/video_coding/jitter_buffer.h"
@ -35,8 +36,8 @@ class VCMReceiver {
// that of VCMReceiver itself.
VCMReceiver(VCMTiming* timing,
Clock* clock,
rtc::scoped_ptr<EventWrapper> receiver_event,
rtc::scoped_ptr<EventWrapper> jitter_buffer_event);
std::unique_ptr<EventWrapper> receiver_event,
std::unique_ptr<EventWrapper> jitter_buffer_event);
~VCMReceiver();
@ -83,7 +84,7 @@ class VCMReceiver {
Clock* const clock_;
VCMJitterBuffer jitter_buffer_;
VCMTiming* timing_;
rtc::scoped_ptr<EventWrapper> render_wait_event_;
std::unique_ptr<EventWrapper> render_wait_event_;
int max_video_delay_ms_;
};

View File

@ -10,6 +10,7 @@
#include <string.h>
#include <list>
#include <memory>
#include <queue>
#include <vector>
@ -84,11 +85,11 @@ class TestVCMReceiver : public ::testing::Test {
return true;
}
rtc::scoped_ptr<SimulatedClock> clock_;
std::unique_ptr<SimulatedClock> clock_;
VCMTiming timing_;
NullEventFactory event_factory_;
VCMReceiver receiver_;
rtc::scoped_ptr<StreamGenerator> stream_generator_;
std::unique_ptr<StreamGenerator> stream_generator_;
};
TEST_F(TestVCMReceiver, RenderBufferSize_AllComplete) {
@ -449,8 +450,8 @@ class VCMReceiverTimingTest : public ::testing::Test {
receiver_(
&timing_,
&clock_,
rtc::scoped_ptr<EventWrapper>(new FrameInjectEvent(&clock_, false)),
rtc::scoped_ptr<EventWrapper>(
std::unique_ptr<EventWrapper>(new FrameInjectEvent(&clock_, false)),
std::unique_ptr<EventWrapper>(
new FrameInjectEvent(&clock_, true))) {}
virtual void SetUp() { receiver_.Reset(); }

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));

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
#define WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#include "webrtc/typedefs.h"
namespace webrtc {
@ -36,7 +37,7 @@ class VCMTimestampMap {
};
bool IsEmpty() const;
rtc::scoped_ptr<TimestampDataTuple[]> ring_buffer_;
std::unique_ptr<TimestampDataTuple[]> ring_buffer_;
const size_t capacity_;
size_t next_add_idx_;
size_t next_pop_idx_;

View File

@ -65,7 +65,7 @@ class EncodedImageCallbackWrapper : public EncodedImageCallback {
}
private:
rtc::scoped_ptr<CriticalSectionWrapper> cs_;
std::unique_ptr<CriticalSectionWrapper> cs_;
EncodedImageCallback* callback_ GUARDED_BY(cs_);
};
@ -283,7 +283,7 @@ class VideoCodingModuleImpl : public VideoCodingModule {
EncodedImageCallbackWrapper post_encode_callback_;
vcm::VideoSender sender_;
vcm::VideoReceiver receiver_;
rtc::scoped_ptr<EventFactory> own_event_factory_;
std::unique_ptr<EventFactory> own_event_factory_;
};
} // namespace

View File

@ -13,6 +13,7 @@
#include "webrtc/modules/video_coding/include/video_coding.h"
#include <memory>
#include <vector>
#include "webrtc/base/thread_annotations.h"
@ -101,7 +102,7 @@ class VideoSender {
Clock* const clock_;
rtc::scoped_ptr<CriticalSectionWrapper> process_crit_sect_;
std::unique_ptr<CriticalSectionWrapper> process_crit_sect_;
rtc::CriticalSection encoder_crit_;
VCMGenericEncoder* _encoder;
VCMEncodedFrameCallback _encodedFrameCallback GUARDED_BY(encoder_crit_);
@ -185,7 +186,7 @@ class VideoReceiver {
private:
Clock* const clock_;
rtc::scoped_ptr<CriticalSectionWrapper> process_crit_sect_;
std::unique_ptr<CriticalSectionWrapper> process_crit_sect_;
CriticalSectionWrapper* _receiveCritSect;
VCMTiming _timing;
VCMReceiver _receiver;

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h"
@ -69,13 +71,13 @@ class VCMRobustnessTest : public ::testing::Test {
ASSERT_EQ(VCM_OK, vcm_->IncomingPacket(payload, kPayloadLen, rtp_info));
}
rtc::scoped_ptr<VideoCodingModule> vcm_;
std::unique_ptr<VideoCodingModule> vcm_;
VideoCodec video_codec_;
MockVCMFrameTypeCallback frame_type_callback_;
MockPacketRequestCallback request_callback_;
NiceMock<MockVideoDecoder> decoder_;
NiceMock<MockVideoDecoder> decoderCopy_;
rtc::scoped_ptr<SimulatedClock> clock_;
std::unique_ptr<SimulatedClock> clock_;
NullEventFactory event_factory_;
};

View File

@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h"
#include "webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h"
#include "webrtc/modules/video_coding/include/video_coding.h"
@ -75,7 +75,7 @@ class TestVideoReceiver : public ::testing::Test {
NiceMock<MockVideoDecoder> decoder_;
NiceMock<MockPacketRequestCallback> packet_request_callback_;
rtc::scoped_ptr<VideoReceiver> receiver_;
std::unique_ptr<VideoReceiver> receiver_;
};
TEST_F(TestVideoReceiver, PaddingOnlyFrames) {

View File

@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
@ -83,7 +83,7 @@ class EmptyFrameGenerator : public FrameGenerator {
private:
const int width_;
const int height_;
rtc::scoped_ptr<VideoFrame> frame_;
std::unique_ptr<VideoFrame> frame_;
};
class PacketizationCallback : public VCMPacketizationCallback {
@ -193,9 +193,9 @@ class TestVideoSender : public ::testing::Test {
PacketizationCallback packetization_callback_;
MockEncodedImageCallback post_encode_callback_;
// Used by subclassing tests, need to outlive sender_.
rtc::scoped_ptr<VideoEncoder> encoder_;
rtc::scoped_ptr<VideoSender> sender_;
rtc::scoped_ptr<FrameGenerator> generator_;
std::unique_ptr<VideoEncoder> encoder_;
std::unique_ptr<VideoSender> sender_;
std::unique_ptr<FrameGenerator> generator_;
};
class TestVideoSenderWithMockEncoder : public TestVideoSender {