Replace scoped_ptr with unique_ptr in webrtc/pc/

BUG=webrtc:5520

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

Cr-Commit-Position: refs/heads/master@{#11961}
This commit is contained in:
kwiberg 2016-03-11 14:18:21 -08:00 committed by Commit bot
parent 6f59a4fc4f
commit 3102294fc0
11 changed files with 197 additions and 206 deletions

View File

@ -1210,7 +1210,7 @@ void WebRtcSession::SetRawAudioSink(uint32_t ssrc,
if (!voice_channel_)
return;
voice_channel_->SetRawAudioSink(ssrc, std::move(sink));
voice_channel_->SetRawAudioSink(ssrc, rtc::ScopedToUnique(std::move(sink)));
}
bool WebRtcSession::SetCaptureDevice(uint32_t ssrc,

View File

@ -29,11 +29,11 @@ namespace cricket {
using rtc::Bind;
namespace {
// See comment below for why we need to use a pointer to a scoped_ptr.
// See comment below for why we need to use a pointer to a unique_ptr.
bool SetRawAudioSink_w(VoiceMediaChannel* channel,
uint32_t ssrc,
rtc::scoped_ptr<webrtc::AudioSinkInterface>* sink) {
channel->SetRawAudioSink(ssrc, rtc::ScopedToUnique(std::move(*sink)));
std::unique_ptr<webrtc::AudioSinkInterface>* sink) {
channel->SetRawAudioSink(ssrc, std::move(*sink));
return true;
}
} // namespace
@ -1377,8 +1377,8 @@ bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) {
void VoiceChannel::SetRawAudioSink(
uint32_t ssrc,
rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) {
// We need to work around Bind's lack of support for scoped_ptr and ownership
std::unique_ptr<webrtc::AudioSinkInterface> sink) {
// We need to work around Bind's lack of support for unique_ptr and ownership
// passing. So we invoke to our own little routine that gets a pointer to
// our local variable. This is OK since we're synchronously invoking.
InvokeOnWorker(Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink));

View File

@ -12,6 +12,7 @@
#define WEBRTC_PC_CHANNEL_H_
#include <map>
#include <memory>
#include <set>
#include <string>
#include <utility>
@ -304,7 +305,7 @@ class BaseChannel
SrtpFilter srtp_filter_;
RtcpMuxFilter rtcp_mux_filter_;
BundleFilter bundle_filter_;
rtc::scoped_ptr<ConnectionMonitor> connection_monitor_;
std::unique_ptr<ConnectionMonitor> connection_monitor_;
bool enabled_;
bool writable_;
bool rtp_ready_to_send_;
@ -359,7 +360,7 @@ class VoiceChannel : public BaseChannel {
bool InsertDtmf(uint32_t ssrc, int event_code, int duration);
bool SetOutputVolume(uint32_t ssrc, double volume);
void SetRawAudioSink(uint32_t ssrc,
rtc::scoped_ptr<webrtc::AudioSinkInterface> sink);
std::unique_ptr<webrtc::AudioSinkInterface> sink);
// Get statistics about the current media session.
bool GetStats(VoiceMediaInfo* stats);
@ -411,8 +412,8 @@ class VoiceChannel : public BaseChannel {
static const int kEarlyMediaTimeout = 1000;
MediaEngineInterface* media_engine_;
bool received_media_;
rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_;
rtc::scoped_ptr<AudioMonitor> audio_monitor_;
std::unique_ptr<VoiceMediaMonitor> media_monitor_;
std::unique_ptr<AudioMonitor> audio_monitor_;
// Last AudioSendParameters sent down to the media_channel() via
// SetSendParameters.
@ -471,7 +472,7 @@ class VideoChannel : public BaseChannel {
virtual void OnMediaMonitorUpdate(
VideoMediaChannel* media_channel, const VideoMediaInfo& info);
rtc::scoped_ptr<VideoMediaMonitor> media_monitor_;
std::unique_ptr<VideoMediaMonitor> media_monitor_;
// Last VideoSendParameters sent down to the media_channel() via
// SetSendParameters.
@ -587,7 +588,7 @@ class DataChannel : public BaseChannel {
void OnDataChannelReadyToSend(bool writable);
void OnStreamClosedRemotely(uint32_t sid);
rtc::scoped_ptr<DataMediaMonitor> media_monitor_;
std::unique_ptr<DataMediaMonitor> media_monitor_;
// TODO(pthatcher): Make a separate SctpDataChannel and
// RtpDataChannel instead of using this.
DataChannelType data_channel_type_;

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "webrtc/base/arraysize.h"
#include "webrtc/base/fileutils.h"
#include "webrtc/base/gunit.h"
@ -1533,13 +1535,13 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
CreateChannels(0, 0);
std::string err;
rtc::scoped_ptr<cricket::SessionDescription> sdesc1(
std::unique_ptr<cricket::SessionDescription> sdesc1(
CreateSessionDescriptionWithStream(1));
EXPECT_TRUE(channel1_->PushdownLocalDescription(
sdesc1.get(), cricket::CA_OFFER, &err));
EXPECT_TRUE(media_channel1_->HasSendStream(1));
rtc::scoped_ptr<cricket::SessionDescription> sdesc2(
std::unique_ptr<cricket::SessionDescription> sdesc2(
CreateSessionDescriptionWithStream(2));
EXPECT_TRUE(channel1_->PushdownLocalDescription(
sdesc2.get(), cricket::CA_OFFER, &err));
@ -1551,13 +1553,13 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
CreateChannels(0, 0);
std::string err;
rtc::scoped_ptr<cricket::SessionDescription> sdesc1(
std::unique_ptr<cricket::SessionDescription> sdesc1(
CreateSessionDescriptionWithStream(1));
EXPECT_TRUE(channel1_->PushdownRemoteDescription(
sdesc1.get(), cricket::CA_OFFER, &err));
EXPECT_TRUE(media_channel1_->HasRecvStream(1));
rtc::scoped_ptr<cricket::SessionDescription> sdesc2(
std::unique_ptr<cricket::SessionDescription> sdesc2(
CreateSessionDescriptionWithStream(2));
EXPECT_TRUE(channel1_->PushdownRemoteDescription(
sdesc2.get(), cricket::CA_OFFER, &err));
@ -1570,14 +1572,14 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
std::string err;
// Receive offer
rtc::scoped_ptr<cricket::SessionDescription> sdesc1(
std::unique_ptr<cricket::SessionDescription> sdesc1(
CreateSessionDescriptionWithStream(1));
EXPECT_TRUE(channel1_->PushdownRemoteDescription(
sdesc1.get(), cricket::CA_OFFER, &err));
EXPECT_TRUE(media_channel1_->HasRecvStream(1));
// Send PR answer
rtc::scoped_ptr<cricket::SessionDescription> sdesc2(
std::unique_ptr<cricket::SessionDescription> sdesc2(
CreateSessionDescriptionWithStream(2));
EXPECT_TRUE(channel1_->PushdownLocalDescription(
sdesc2.get(), cricket::CA_PRANSWER, &err));
@ -1585,7 +1587,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
EXPECT_TRUE(media_channel1_->HasSendStream(2));
// Send answer
rtc::scoped_ptr<cricket::SessionDescription> sdesc3(
std::unique_ptr<cricket::SessionDescription> sdesc3(
CreateSessionDescriptionWithStream(3));
EXPECT_TRUE(channel1_->PushdownLocalDescription(
sdesc3.get(), cricket::CA_ANSWER, &err));
@ -1599,14 +1601,14 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
std::string err;
// Send offer
rtc::scoped_ptr<cricket::SessionDescription> sdesc1(
std::unique_ptr<cricket::SessionDescription> sdesc1(
CreateSessionDescriptionWithStream(1));
EXPECT_TRUE(channel1_->PushdownLocalDescription(
sdesc1.get(), cricket::CA_OFFER, &err));
EXPECT_TRUE(media_channel1_->HasSendStream(1));
// Receive PR answer
rtc::scoped_ptr<cricket::SessionDescription> sdesc2(
std::unique_ptr<cricket::SessionDescription> sdesc2(
CreateSessionDescriptionWithStream(2));
EXPECT_TRUE(channel1_->PushdownRemoteDescription(
sdesc2.get(), cricket::CA_PRANSWER, &err));
@ -1614,7 +1616,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
EXPECT_TRUE(media_channel1_->HasRecvStream(2));
// Receive answer
rtc::scoped_ptr<cricket::SessionDescription> sdesc3(
std::unique_ptr<cricket::SessionDescription> sdesc3(
CreateSessionDescriptionWithStream(3));
EXPECT_TRUE(channel1_->PushdownRemoteDescription(
sdesc3.get(), cricket::CA_ANSWER, &err));
@ -1777,8 +1779,8 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
// The media channels are owned by the voice channel objects below.
typename T::MediaChannel* media_channel1_;
typename T::MediaChannel* media_channel2_;
rtc::scoped_ptr<typename T::Channel> channel1_;
rtc::scoped_ptr<typename T::Channel> channel2_;
std::unique_ptr<typename T::Channel> channel1_;
std::unique_ptr<typename T::Channel> channel2_;
typename T::Content local_media_content1_;
typename T::Content local_media_content2_;
typename T::Content remote_media_content1_;

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_PC_CHANNELMANAGER_H_
#define WEBRTC_PC_CHANNELMANAGER_H_
#include <memory>
#include <string>
#include <vector>
@ -161,8 +162,8 @@ class ChannelManager {
DataChannelType data_channel_type);
void DestroyDataChannel_w(DataChannel* data_channel);
rtc::scoped_ptr<MediaEngineInterface> media_engine_;
rtc::scoped_ptr<DataEngineInterface> data_media_engine_;
std::unique_ptr<MediaEngineInterface> media_engine_;
std::unique_ptr<DataEngineInterface> data_media_engine_;
bool initialized_;
rtc::Thread* main_thread_;
rtc::Thread* worker_thread_;

View File

@ -13,12 +13,12 @@
#include <algorithm> // For std::find_if.
#include <functional>
#include <map>
#include <memory>
#include <set>
#include <utility>
#include "webrtc/base/helpers.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/media/base/cryptoparams.h"
#include "webrtc/media/base/mediaconstants.h"
@ -49,7 +49,6 @@ void GetSupportedCryptoSuiteNames(void (*func)(std::vector<int>*),
namespace cricket {
using rtc::scoped_ptr;
// RTP Profile names
// http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml
@ -1263,7 +1262,7 @@ MediaSessionDescriptionFactory::MediaSessionDescriptionFactory(
SessionDescription* MediaSessionDescriptionFactory::CreateOffer(
const MediaSessionOptions& options,
const SessionDescription* current_description) const {
scoped_ptr<SessionDescription> offer(new SessionDescription());
std::unique_ptr<SessionDescription> offer(new SessionDescription());
StreamParamsVec current_streams;
GetCurrentStreamParams(current_description, &current_streams);
@ -1372,7 +1371,7 @@ SessionDescription* MediaSessionDescriptionFactory::CreateAnswer(
// The answer contains the intersection of the codecs in the offer with the
// codecs we support, ordered by our local preference. As indicated by
// XEP-0167, we retain the same payload ids from the offer in the answer.
scoped_ptr<SessionDescription> answer(new SessionDescription());
std::unique_ptr<SessionDescription> answer(new SessionDescription());
StreamParamsVec current_streams;
GetCurrentStreamParams(current_description, &current_streams);
@ -1520,7 +1519,7 @@ bool MediaSessionDescriptionFactory::AddTransportOffer(
return false;
const TransportDescription* current_tdesc =
GetTransportDescription(content_name, current_desc);
rtc::scoped_ptr<TransportDescription> new_tdesc(
std::unique_ptr<TransportDescription> new_tdesc(
transport_desc_factory_->CreateOffer(transport_options, current_tdesc));
bool ret = (new_tdesc.get() != NULL &&
offer_desc->AddTransportInfo(TransportInfo(content_name, *new_tdesc)));
@ -1576,7 +1575,7 @@ bool MediaSessionDescriptionFactory::AddAudioContentForOffer(
IsDtlsActive(content_name, current_description) ? cricket::SEC_DISABLED
: secure();
scoped_ptr<AudioContentDescription> audio(new AudioContentDescription());
std::unique_ptr<AudioContentDescription> audio(new AudioContentDescription());
std::vector<std::string> crypto_suites;
GetSupportedAudioCryptoSuiteNames(&crypto_suites);
if (!CreateMediaContentOffer(
@ -1636,7 +1635,7 @@ bool MediaSessionDescriptionFactory::AddVideoContentForOffer(
IsDtlsActive(content_name, current_description) ? cricket::SEC_DISABLED
: secure();
scoped_ptr<VideoContentDescription> video(new VideoContentDescription());
std::unique_ptr<VideoContentDescription> video(new VideoContentDescription());
std::vector<std::string> crypto_suites;
GetSupportedVideoCryptoSuiteNames(&crypto_suites);
if (!CreateMediaContentOffer(
@ -1689,7 +1688,7 @@ bool MediaSessionDescriptionFactory::AddDataContentForOffer(
SessionDescription* desc) const {
bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED);
scoped_ptr<DataContentDescription> data(new DataContentDescription());
std::unique_ptr<DataContentDescription> data(new DataContentDescription());
bool is_sctp = (options.data_channel_type == DCT_SCTP);
FilterDataCodecs(data_codecs, is_sctp);
@ -1753,7 +1752,7 @@ bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
SessionDescription* answer) const {
const ContentInfo* audio_content = GetFirstAudioContent(offer);
scoped_ptr<TransportDescription> audio_transport(CreateTransportAnswer(
std::unique_ptr<TransportDescription> audio_transport(CreateTransportAnswer(
audio_content->name, offer,
GetTransportOptions(options, audio_content->name), current_description));
if (!audio_transport) {
@ -1767,7 +1766,7 @@ bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
bool bundle_enabled =
offer->HasGroup(GROUP_TYPE_BUNDLE) && options.bundle_enabled;
scoped_ptr<AudioContentDescription> audio_answer(
std::unique_ptr<AudioContentDescription> audio_answer(
new AudioContentDescription());
// Do not require or create SDES cryptos if DTLS is used.
cricket::SecurePolicy sdes_policy =
@ -1811,14 +1810,14 @@ bool MediaSessionDescriptionFactory::AddVideoContentForAnswer(
StreamParamsVec* current_streams,
SessionDescription* answer) const {
const ContentInfo* video_content = GetFirstVideoContent(offer);
scoped_ptr<TransportDescription> video_transport(CreateTransportAnswer(
std::unique_ptr<TransportDescription> video_transport(CreateTransportAnswer(
video_content->name, offer,
GetTransportOptions(options, video_content->name), current_description));
if (!video_transport) {
return false;
}
scoped_ptr<VideoContentDescription> video_answer(
std::unique_ptr<VideoContentDescription> video_answer(
new VideoContentDescription());
// Do not require or create SDES cryptos if DTLS is used.
cricket::SecurePolicy sdes_policy =
@ -1866,7 +1865,7 @@ bool MediaSessionDescriptionFactory::AddDataContentForAnswer(
StreamParamsVec* current_streams,
SessionDescription* answer) const {
const ContentInfo* data_content = GetFirstDataContent(offer);
scoped_ptr<TransportDescription> data_transport(CreateTransportAnswer(
std::unique_ptr<TransportDescription> data_transport(CreateTransportAnswer(
data_content->name, offer,
GetTransportOptions(options, data_content->name), current_description));
if (!data_transport) {
@ -1876,7 +1875,7 @@ bool MediaSessionDescriptionFactory::AddDataContentForAnswer(
std::vector<DataCodec> data_codecs(data_codecs_);
FilterDataCodecs(&data_codecs, is_sctp);
scoped_ptr<DataContentDescription> data_answer(
std::unique_ptr<DataContentDescription> data_answer(
new DataContentDescription());
// Do not require or create SDES cryptos if DTLS is used.
cricket::SecurePolicy sdes_policy =

View File

@ -18,7 +18,6 @@
#include <string>
#include <vector>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/media/base/codec.h"
#include "webrtc/media/base/cryptoparams.h"
#include "webrtc/media/base/mediachannel.h"

View File

@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <string>
#include <vector>
@ -273,8 +274,8 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
const std::string current_video_pwd = "current_video_pwd";
const std::string current_data_ufrag = "current_data_ufrag";
const std::string current_data_pwd = "current_data_pwd";
rtc::scoped_ptr<SessionDescription> current_desc;
rtc::scoped_ptr<SessionDescription> desc;
std::unique_ptr<SessionDescription> current_desc;
std::unique_ptr<SessionDescription> desc;
if (has_current_desc) {
current_desc.reset(new SessionDescription());
EXPECT_TRUE(current_desc->AddTransportInfo(
@ -293,7 +294,7 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
if (offer) {
desc.reset(f1_.CreateOffer(options, current_desc.get()));
} else {
rtc::scoped_ptr<SessionDescription> offer;
std::unique_ptr<SessionDescription> offer;
offer.reset(f1_.CreateOffer(options, NULL));
desc.reset(f1_.CreateAnswer(offer.get(), options, current_desc.get()));
}
@ -366,8 +367,8 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
options.recv_audio = true;
options.recv_video = true;
options.data_channel_type = cricket::DCT_RTP;
rtc::scoped_ptr<SessionDescription> ref_desc;
rtc::scoped_ptr<SessionDescription> desc;
std::unique_ptr<SessionDescription> ref_desc;
std::unique_ptr<SessionDescription> desc;
if (offer) {
options.bundle_enabled = false;
ref_desc.reset(f1_.CreateOffer(options, NULL));
@ -417,8 +418,7 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
cricket::MediaContentDirection expected_direction_in_answer) {
MediaSessionOptions opts;
opts.recv_video = true;
rtc::scoped_ptr<SessionDescription> offer(
f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
ContentInfo* ac_offer= offer->GetContentByName("audio");
ASSERT_TRUE(ac_offer != NULL);
@ -431,7 +431,7 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
static_cast<VideoContentDescription*>(vc_offer->description);
vcd_offer->set_direction(direction_in_offer);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const AudioContentDescription* acd_answer =
GetFirstAudioContentDescription(answer.get());
@ -464,7 +464,7 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
// Create a typical audio offer, and ensure it matches what we expect.
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioOffer) {
f1_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(
std::unique_ptr<SessionDescription> offer(
f1_.CreateOffer(MediaSessionOptions(), NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
@ -488,8 +488,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoOffer) {
MediaSessionOptions opts;
opts.recv_video = true;
f1_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
const ContentInfo* vc = offer->GetContentByName("video");
@ -532,8 +531,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestBundleOfferWithSameCodecPlType) {
opts.recv_video = true;
opts.data_channel_type = cricket::DCT_RTP;
opts.bundle_enabled = true;
rtc::scoped_ptr<SessionDescription>
offer(f2_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f2_.CreateOffer(opts, NULL));
const VideoContentDescription* vcd =
GetFirstVideoContentDescription(offer.get());
const AudioContentDescription* acd =
@ -562,8 +560,8 @@ TEST_F(MediaSessionDescriptionFactoryTest,
opts.recv_video = false;
opts.data_channel_type = cricket::DCT_NONE;
opts.bundle_enabled = true;
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
MediaSessionOptions updated_opts;
@ -571,8 +569,8 @@ TEST_F(MediaSessionDescriptionFactoryTest,
updated_opts.recv_video = true;
updated_opts.data_channel_type = cricket::DCT_RTP;
updated_opts.bundle_enabled = true;
rtc::scoped_ptr<SessionDescription> updated_offer(f1_.CreateOffer(
updated_opts, answer.get()));
std::unique_ptr<SessionDescription> updated_offer(
f1_.CreateOffer(updated_opts, answer.get()));
const AudioContentDescription* acd =
GetFirstAudioContentDescription(updated_offer.get());
@ -597,8 +595,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateRtpDataOffer) {
MediaSessionOptions opts;
opts.data_channel_type = cricket::DCT_RTP;
f1_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
const ContentInfo* dc = offer->GetContentByName("data");
@ -634,7 +631,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSctpDataOffer) {
opts.bundle_enabled = true;
opts.data_channel_type = cricket::DCT_SCTP;
f1_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
EXPECT_TRUE(offer.get() != NULL);
EXPECT_TRUE(offer->GetContentByName("data") != NULL);
}
@ -646,7 +643,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateImplicitSctpDataOffer) {
opts.bundle_enabled = true;
opts.data_channel_type = cricket::DCT_SCTP;
f1_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer1.get() != NULL);
const ContentInfo* data = offer1->GetContentByName("data");
ASSERT_TRUE(data != NULL);
@ -658,7 +655,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateImplicitSctpDataOffer) {
// datachannel type that gets generated from the previous offer, is of the
// same type.
opts.data_channel_type = cricket::DCT_NONE;
rtc::scoped_ptr<SessionDescription> offer2(
std::unique_ptr<SessionDescription> offer2(
f1_.CreateOffer(opts, offer1.get()));
data = offer2->GetContentByName("data");
ASSERT_TRUE(data != NULL);
@ -672,8 +669,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
MediaSessionOptions opts;
opts.recv_video = true;
f1_.set_add_legacy_streams(false);
rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
const ContentInfo* vc = offer->GetContentByName("video");
@ -696,7 +692,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSendOnlyOffer) {
options.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack1, kMediaStream1);
options.AddSendStream(MEDIA_TYPE_AUDIO, kAudioTrack1, kMediaStream1);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(options, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(options, NULL));
ASSERT_TRUE(offer.get() != NULL);
EXPECT_EQ(2u, offer->contents().size());
EXPECT_TRUE(IsMediaContentOfType(&offer->contents()[0], MEDIA_TYPE_AUDIO));
@ -714,13 +710,13 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateOfferContentOrder) {
opts.recv_video = false;
opts.data_channel_type = cricket::DCT_SCTP;
rtc::scoped_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer1.get() != NULL);
EXPECT_EQ(1u, offer1->contents().size());
EXPECT_TRUE(IsMediaContentOfType(&offer1->contents()[0], MEDIA_TYPE_DATA));
opts.recv_video = true;
rtc::scoped_ptr<SessionDescription> offer2(
std::unique_ptr<SessionDescription> offer2(
f1_.CreateOffer(opts, offer1.get()));
ASSERT_TRUE(offer2.get() != NULL);
EXPECT_EQ(2u, offer2->contents().size());
@ -728,7 +724,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateOfferContentOrder) {
EXPECT_TRUE(IsMediaContentOfType(&offer2->contents()[1], MEDIA_TYPE_VIDEO));
opts.recv_audio = true;
rtc::scoped_ptr<SessionDescription> offer3(
std::unique_ptr<SessionDescription> offer3(
f1_.CreateOffer(opts, offer2.get()));
ASSERT_TRUE(offer3.get() != NULL);
EXPECT_EQ(3u, offer3->contents().size());
@ -738,7 +734,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateOfferContentOrder) {
// Verifies the default order is audio-video-data, so that the previous checks
// didn't pass by accident.
rtc::scoped_ptr<SessionDescription> offer4(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer4(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer4.get() != NULL);
EXPECT_EQ(3u, offer4->contents().size());
EXPECT_TRUE(IsMediaContentOfType(&offer4->contents()[0], MEDIA_TYPE_AUDIO));
@ -750,10 +746,10 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateOfferContentOrder) {
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswer) {
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(
std::unique_ptr<SessionDescription> offer(
f1_.CreateOffer(MediaSessionOptions(), NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@ -777,9 +773,9 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoAnswer) {
opts.recv_video = true;
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@ -810,9 +806,9 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateDataAnswer) {
opts.data_channel_type = cricket::DCT_RTP;
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("data");
@ -846,22 +842,22 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAnswerContentOrder) {
// Creates a data only offer.
opts.recv_audio = false;
opts.data_channel_type = cricket::DCT_SCTP;
rtc::scoped_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer1.get() != NULL);
// Appends audio to the offer.
opts.recv_audio = true;
rtc::scoped_ptr<SessionDescription> offer2(
std::unique_ptr<SessionDescription> offer2(
f1_.CreateOffer(opts, offer1.get()));
ASSERT_TRUE(offer2.get() != NULL);
// Appends video to the offer.
opts.recv_video = true;
rtc::scoped_ptr<SessionDescription> offer3(
std::unique_ptr<SessionDescription> offer3(
f1_.CreateOffer(opts, offer2.get()));
ASSERT_TRUE(offer3.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer3.get(), opts, NULL));
ASSERT_TRUE(answer.get() != NULL);
EXPECT_EQ(3u, answer->contents().size());
@ -902,7 +898,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
opts.recv_audio = false;
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ContentInfo* dc_offer= offer->GetContentByName("data");
ASSERT_TRUE(dc_offer != NULL);
DataContentDescription* dcd_offer =
@ -911,7 +907,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
std::string protocol = "a weird unknown protocol";
dcd_offer->set_protocol(protocol);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* dc_answer = answer->GetContentByName("data");
@ -931,13 +927,13 @@ TEST_F(MediaSessionDescriptionFactoryTest, AudioOfferAnswerWithCryptoDisabled) {
tdf1_.set_secure(SEC_DISABLED);
tdf2_.set_secure(SEC_DISABLED);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
const AudioContentDescription* offer_acd =
GetFirstAudioContentDescription(offer.get());
ASSERT_TRUE(offer_acd != NULL);
EXPECT_EQ(std::string(cricket::kMediaProtocolAvpf), offer_acd->protocol());
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* ac_answer = answer->GetContentByName("audio");
@ -961,9 +957,9 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestOfferAnswerWithRtpExtensions) {
f2_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension2));
f2_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension2));
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension1),
@ -988,9 +984,9 @@ TEST_F(MediaSessionDescriptionFactoryTest,
opts.data_channel_type = cricket::DCT_RTP;
f1_.set_add_legacy_streams(false);
f2_.set_add_legacy_streams(false);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@ -1014,8 +1010,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestPartial) {
opts.recv_video = true;
opts.data_channel_type = cricket::DCT_RTP;
f1_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
const ContentInfo* vc = offer->GetContentByName("video");
@ -1055,8 +1050,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoAnswerRtcpMux) {
answer_opts.data_channel_type = cricket::DCT_RTP;
offer_opts.data_channel_type = cricket::DCT_RTP;
rtc::scoped_ptr<SessionDescription> offer;
rtc::scoped_ptr<SessionDescription> answer;
std::unique_ptr<SessionDescription> offer;
std::unique_ptr<SessionDescription> answer;
offer_opts.rtcp_mux_enabled = true;
answer_opts.rtcp_mux_enabled = true;
@ -1135,10 +1130,9 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoAnswerRtcpMux) {
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswerToVideo) {
MediaSessionOptions opts;
opts.recv_video = true;
rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@ -1152,10 +1146,9 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswerToVideo) {
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateNoDataAnswerToDataOffer) {
MediaSessionOptions opts;
opts.data_channel_type = cricket::DCT_RTP;
rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* dc = answer->GetContentByName("data");
@ -1171,8 +1164,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
MediaSessionOptions opts;
opts.recv_video = true;
opts.data_channel_type = cricket::DCT_RTP;
rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
ContentInfo* ac = offer->GetContentByName("audio");
ContentInfo* vc = offer->GetContentByName("video");
@ -1183,7 +1175,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
ac->rejected = true;
vc->rejected = true;
dc->rejected = true;
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
ac = answer->GetContentByName("audio");
vc = answer->GetContentByName("video");
@ -1212,7 +1204,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateMultiStreamVideoOffer) {
opts.AddSendStream(MEDIA_TYPE_DATA, kDataTrack2, kMediaStream1);
f1_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
@ -1282,8 +1274,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateMultiStreamVideoOffer) {
opts.AddSendStream(MEDIA_TYPE_AUDIO, kAudioTrack3, kMediaStream1);
opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2);
opts.AddSendStream(MEDIA_TYPE_DATA, kDataTrack3, kMediaStream1);
rtc::scoped_ptr<SessionDescription>
updated_offer(f1_.CreateOffer(opts, offer.get()));
std::unique_ptr<SessionDescription> updated_offer(
f1_.CreateOffer(opts, offer.get()));
ASSERT_TRUE(updated_offer.get() != NULL);
ac = updated_offer->GetContentByName("audio");
@ -1340,7 +1332,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSimulcastVideoOffer) {
MediaSessionOptions opts;
const int num_sim_layers = 3;
opts.AddSendVideoStream(kVideoTrack1, kMediaStream1, num_sim_layers);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* vc = offer->GetContentByName("video");
@ -1369,8 +1361,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateMultiStreamVideoAnswer) {
offer_opts.data_channel_type = cricket::DCT_RTP;
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(offer_opts,
NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(offer_opts, NULL));
MediaSessionOptions opts;
opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack1, kMediaStream1);
@ -1380,8 +1371,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateMultiStreamVideoAnswer) {
opts.AddSendStream(MEDIA_TYPE_DATA, kDataTrack1, kMediaStream1);
opts.AddSendStream(MEDIA_TYPE_DATA, kDataTrack2, kMediaStream1);
rtc::scoped_ptr<SessionDescription>
answer(f2_.CreateAnswer(offer.get(), opts, NULL));
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
ASSERT_TRUE(answer.get() != NULL);
const ContentInfo* ac = answer->GetContentByName("audio");
@ -1448,8 +1439,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateMultiStreamVideoAnswer) {
opts.AddSendStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2);
opts.RemoveSendStream(MEDIA_TYPE_AUDIO, kAudioTrack2);
opts.RemoveSendStream(MEDIA_TYPE_DATA, kDataTrack2);
rtc::scoped_ptr<SessionDescription>
updated_answer(f2_.CreateAnswer(offer.get(), opts, answer.get()));
std::unique_ptr<SessionDescription> updated_answer(
f2_.CreateAnswer(offer.get(), opts, answer.get()));
ASSERT_TRUE(updated_answer.get() != NULL);
ac = updated_answer->GetContentByName("audio");
@ -1504,8 +1495,8 @@ TEST_F(MediaSessionDescriptionFactoryTest,
opts.recv_audio = true;
opts.recv_video = true;
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const AudioContentDescription* acd =
@ -1516,7 +1507,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
GetFirstVideoContentDescription(answer.get());
EXPECT_EQ(MAKE_VECTOR(kVideoCodecsAnswer), vcd->codecs());
rtc::scoped_ptr<SessionDescription> updated_offer(
std::unique_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
// The expected audio codecs are the common audio codecs from the first
@ -1565,9 +1556,9 @@ TEST_F(MediaSessionDescriptionFactoryTest,
AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const VideoContentDescription* vcd =
@ -1584,10 +1575,10 @@ TEST_F(MediaSessionDescriptionFactoryTest,
// are different from |f1_|.
expected_codecs[0].preference = f1_codecs[1].preference;
rtc::scoped_ptr<SessionDescription> updated_offer(
std::unique_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
ASSERT_TRUE(updated_offer);
rtc::scoped_ptr<SessionDescription> updated_answer(
std::unique_ptr<SessionDescription> updated_answer(
f1_.CreateAnswer(updated_offer.get(), opts, answer.get()));
const VideoContentDescription* updated_vcd =
@ -1611,8 +1602,8 @@ TEST_F(MediaSessionDescriptionFactoryTest,
opts.recv_audio = true;
opts.recv_video = false;
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const AudioContentDescription* acd =
@ -1631,10 +1622,10 @@ TEST_F(MediaSessionDescriptionFactoryTest,
AddRtxCodec(VideoCodec::CreateRtxCodec(125, used_pl_type), &f2_codecs);
f2_.set_video_codecs(f2_codecs);
rtc::scoped_ptr<SessionDescription> updated_offer(
std::unique_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
ASSERT_TRUE(updated_offer);
rtc::scoped_ptr<SessionDescription> updated_answer(
std::unique_ptr<SessionDescription> updated_answer(
f1_.CreateAnswer(updated_offer.get(), opts, answer.get()));
const AudioContentDescription* updated_acd =
@ -1668,9 +1659,9 @@ TEST_F(MediaSessionDescriptionFactoryTest,
AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr));
ASSERT_TRUE(offer.get() != nullptr);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, nullptr));
const VideoContentDescription* vcd =
@ -1682,7 +1673,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
// Now, ensure that the RTX codec is created correctly when |f2_| creates an
// updated offer, even though the default payload types are different from
// those of |f1_|.
rtc::scoped_ptr<SessionDescription> updated_offer(
std::unique_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
ASSERT_TRUE(updated_offer);
@ -1711,7 +1702,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtxWithoutApt) {
AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
// kCodecParamAssociatedPayloadType will always be added to the offer when RTX
// is selected. Manually remove kCodecParamAssociatedPayloadType so that it
@ -1730,7 +1721,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtxWithoutApt) {
}
desc->set_codecs(codecs);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
std::vector<std::string> codec_names =
@ -1755,11 +1746,11 @@ TEST_F(MediaSessionDescriptionFactoryTest, FilterOutRtxIfAptDoesntMatch) {
AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[1].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
// Associated payload type doesn't match, therefore, RTX codec is removed in
// the answer.
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
std::vector<std::string> codec_names =
@ -1791,9 +1782,9 @@ TEST_F(MediaSessionDescriptionFactoryTest,
// H264-SVC codec is removed in the answer, therefore, associated RTX codec
// for H264-SVC should also be removed.
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const VideoContentDescription* vcd =
GetFirstVideoContentDescription(answer.get());
@ -1815,7 +1806,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) {
AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr));
ASSERT_TRUE(offer);
const VideoContentDescription* vcd =
GetFirstVideoContentDescription(offer.get());
@ -1829,7 +1820,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) {
AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs);
rtc::scoped_ptr<SessionDescription> updated_offer(
std::unique_ptr<SessionDescription> updated_offer(
f1_.CreateOffer(opts, offer.get()));
ASSERT_TRUE(updated_offer);
vcd = GetFirstVideoContentDescription(updated_offer.get());
@ -1857,7 +1848,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateMultipleRtxSsrcs) {
// Ensure that the offer has an RTX ssrc for each regular ssrc, and that there
// is a FID ssrc + grouping for each.
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
VideoContentDescription* desc = static_cast<VideoContentDescription*>(
offer->GetContentDescriptionByName(cricket::CN_VIDEO));
@ -1894,8 +1885,8 @@ TEST_F(MediaSessionDescriptionFactoryTest,
f2_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension2));
f2_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension2));
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionAnswer),
@ -1905,7 +1896,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
GetFirstVideoContentDescription(
answer.get())->rtp_header_extensions());
rtc::scoped_ptr<SessionDescription> updated_offer(
std::unique_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
// The expected RTP header extensions in the new offer are the resulting
@ -1950,7 +1941,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
f1_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension3));
f1_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension3));
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
// Since the audio extensions used ID 3 for "both_audio_and_video", so should
// the video extensions.
@ -1967,7 +1958,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
offer.get())->rtp_header_extensions());
// Nothing should change when creating a new offer
rtc::scoped_ptr<SessionDescription> updated_offer(
std::unique_ptr<SessionDescription> updated_offer(
f1_.CreateOffer(opts, offer.get()));
EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension3),
@ -1991,7 +1982,7 @@ TEST(MediaSessionDescription, CopySessionDescription) {
vcd->AddLegacyStream(2);
source.AddContent(cricket::CN_VIDEO, cricket::NS_JINGLE_RTP, vcd);
rtc::scoped_ptr<SessionDescription> copy(source.Copy());
std::unique_ptr<SessionDescription> copy(source.Copy());
ASSERT_TRUE(copy.get() != NULL);
EXPECT_TRUE(copy->HasGroup(cricket::CN_AUDIO));
const ContentInfo* ac = copy->GetContentByName("audio");
@ -2131,7 +2122,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
tdf1_.set_secure(SEC_DISABLED);
tdf2_.set_secure(SEC_DISABLED);
rtc::scoped_ptr<SessionDescription> offer(
std::unique_ptr<SessionDescription> offer(
f1_.CreateOffer(MediaSessionOptions(), NULL));
ASSERT_TRUE(offer.get() != NULL);
ContentInfo* offer_content = offer->GetContentByName("audio");
@ -2140,7 +2131,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
static_cast<AudioContentDescription*>(offer_content->description);
offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
ASSERT_TRUE(answer != NULL);
ContentInfo* answer_content = answer->GetContentByName("audio");
@ -2157,7 +2148,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestOfferDtlsSavpfCreateAnswer) {
tdf1_.set_secure(SEC_ENABLED);
tdf2_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(
std::unique_ptr<SessionDescription> offer(
f1_.CreateOffer(MediaSessionOptions(), NULL));
ASSERT_TRUE(offer.get() != NULL);
ContentInfo* offer_content = offer->GetContentByName("audio");
@ -2166,7 +2157,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestOfferDtlsSavpfCreateAnswer) {
static_cast<AudioContentDescription*>(offer_content->description);
offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
ASSERT_TRUE(answer != NULL);
@ -2190,7 +2181,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoDtls) {
MediaSessionOptions options;
options.recv_audio = true;
options.recv_video = true;
rtc::scoped_ptr<SessionDescription> offer, answer;
std::unique_ptr<SessionDescription> offer, answer;
const cricket::MediaContentDescription* audio_media_desc;
const cricket::MediaContentDescription* video_media_desc;
const cricket::TransportDescription* audio_trans_desc;
@ -2291,10 +2282,9 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestSecureAnswerToUnsecureOffer) {
f2_.set_secure(SEC_REQUIRED);
tdf1_.set_secure(SEC_ENABLED);
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(options,
NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(options, NULL));
ASSERT_TRUE(offer.get() != NULL);
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), options, NULL));
EXPECT_TRUE(answer.get() == NULL);
}
@ -2311,7 +2301,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoOfferDtlsButNotSdes) {
options.recv_video = true;
options.data_channel_type = cricket::DCT_RTP;
rtc::scoped_ptr<SessionDescription> offer, answer;
std::unique_ptr<SessionDescription> offer, answer;
// Generate an offer with DTLS but without SDES.
offer.reset(f1_.CreateOffer(options, NULL));
@ -2358,8 +2348,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestVADEnableOption) {
MediaSessionOptions options;
options.recv_audio = true;
options.recv_video = true;
rtc::scoped_ptr<SessionDescription> offer(
f1_.CreateOffer(options, NULL));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(options, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* audio_content = offer->GetContentByName("audio");
EXPECT_FALSE(VerifyNoCNCodecs(audio_content));
@ -2369,7 +2358,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestVADEnableOption) {
ASSERT_TRUE(offer.get() != NULL);
audio_content = offer->GetContentByName("audio");
EXPECT_TRUE(VerifyNoCNCodecs(audio_content));
rtc::scoped_ptr<SessionDescription> answer(
std::unique_ptr<SessionDescription> answer(
f1_.CreateAnswer(offer.get(), options, NULL));
ASSERT_TRUE(answer.get() != NULL);
audio_content = answer->GetContentByName("audio");
@ -2385,12 +2374,12 @@ TEST_F(MediaSessionDescriptionFactoryTest,
opts.recv_video = true;
opts.data_channel_type = cricket::DCT_SCTP;
// Create offer and modify the default content names.
rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr));
std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr));
for (ContentInfo& content : offer->contents()) {
content.name.append("_modified");
}
rtc::scoped_ptr<SessionDescription> updated_offer(
std::unique_ptr<SessionDescription> updated_offer(
f1_.CreateOffer(opts, offer.get()));
const ContentInfo* audio_content = GetFirstAudioContent(updated_offer.get());
const ContentInfo* video_content = GetFirstVideoContent(updated_offer.get());

View File

@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include <string>
#include "libyuv/convert.h"
@ -17,7 +18,6 @@
#include "libyuv/planar_functions.h"
#include "webrtc/base/flags.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/media/base/testutils.h"
#include "webrtc/media/base/videocommon.h"
@ -469,12 +469,12 @@ class PlanarFunctionsTest : public testing::TestWithParam<int> {
int repeat_;
// Y, U, V and R, G, B channels of testing colors.
rtc::scoped_ptr<uint8_t[]> testing_color_y_;
rtc::scoped_ptr<uint8_t[]> testing_color_u_;
rtc::scoped_ptr<uint8_t[]> testing_color_v_;
rtc::scoped_ptr<uint8_t[]> testing_color_r_;
rtc::scoped_ptr<uint8_t[]> testing_color_g_;
rtc::scoped_ptr<uint8_t[]> testing_color_b_;
std::unique_ptr<uint8_t[]> testing_color_y_;
std::unique_ptr<uint8_t[]> testing_color_u_;
std::unique_ptr<uint8_t[]> testing_color_v_;
std::unique_ptr<uint8_t[]> testing_color_r_;
std::unique_ptr<uint8_t[]> testing_color_g_;
std::unique_ptr<uint8_t[]> testing_color_b_;
};
TEST_F(PlanarFunctionsTest, I420Copy) {
@ -488,11 +488,11 @@ TEST_F(PlanarFunctionsTest, I420Copy) {
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 3;
// Generate a fake input image.
rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage(
std::unique_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage(
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_pointer, u_pointer,
v_pointer));
// Allocate space for the output image.
rtc::scoped_ptr<uint8_t[]> yuv_output(
std::unique_ptr<uint8_t[]> yuv_output(
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment]);
uint8_t* y_output_pointer = ALIGNP(yuv_output.get(), kAlignment);
uint8_t* u_output_pointer = y_output_pointer + y_size;
@ -526,11 +526,11 @@ TEST_F(PlanarFunctionsTest, I422ToI420) {
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 2;
// Generate a fake input image.
rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage(
std::unique_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage(
kHeight, kWidth, block_size, libyuv::kJpegYuv422, y_pointer, u_pointer,
v_pointer));
// Allocate space for the output image.
rtc::scoped_ptr<uint8_t[]> yuv_output(
std::unique_ptr<uint8_t[]> yuv_output(
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment]);
uint8_t* y_output_pointer = ALIGNP(yuv_output.get(), kAlignment);
uint8_t* u_output_pointer = y_output_pointer + y_size;
@ -539,7 +539,7 @@ TEST_F(PlanarFunctionsTest, I422ToI420) {
uint8_t* y_expected_pointer = nullptr;
uint8_t* u_expected_pointer = nullptr;
uint8_t* v_expected_pointer = nullptr;
rtc::scoped_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage(
std::unique_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage(
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_expected_pointer,
u_expected_pointer, v_expected_pointer));
@ -574,10 +574,10 @@ TEST_P(PlanarFunctionsTest, M420ToI420) {
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 2;
// Generate a fake input image.
rtc::scoped_ptr<uint8_t[]> yuv_input(
std::unique_ptr<uint8_t[]> yuv_input(
CreateFakeM420TestingImage(kHeight, kWidth, block_size, m420_pointer));
// Allocate space for the output image.
rtc::scoped_ptr<uint8_t[]> yuv_output(
std::unique_ptr<uint8_t[]> yuv_output(
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]);
uint8_t* y_output_pointer =
ALIGNP(yuv_output.get(), kAlignment) + unalignment;
@ -587,7 +587,7 @@ TEST_P(PlanarFunctionsTest, M420ToI420) {
uint8_t* y_expected_pointer = nullptr;
uint8_t* u_expected_pointer = nullptr;
uint8_t* v_expected_pointer = nullptr;
rtc::scoped_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage(
std::unique_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage(
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_expected_pointer,
u_expected_pointer, v_expected_pointer));
@ -620,10 +620,10 @@ TEST_P(PlanarFunctionsTest, NV12ToI420) {
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 2;
// Generate a fake input image.
rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeNV12TestingImage(
std::unique_ptr<uint8_t[]> yuv_input(CreateFakeNV12TestingImage(
kHeight, kWidth, block_size, y_pointer, uv_pointer));
// Allocate space for the output image.
rtc::scoped_ptr<uint8_t[]> yuv_output(
std::unique_ptr<uint8_t[]> yuv_output(
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]);
uint8_t* y_output_pointer =
ALIGNP(yuv_output.get(), kAlignment) + unalignment;
@ -633,7 +633,7 @@ TEST_P(PlanarFunctionsTest, NV12ToI420) {
uint8_t* y_expected_pointer = nullptr;
uint8_t* u_expected_pointer = nullptr;
uint8_t* v_expected_pointer = nullptr;
rtc::scoped_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage(
std::unique_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage(
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_expected_pointer,
u_expected_pointer, v_expected_pointer));
@ -668,10 +668,10 @@ TEST_P(PlanarFunctionsTest, NV12ToI420) {
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); \
int block_size = 2; \
/* Generate a fake input image.*/ \
rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeInterleaveYuvTestingImage( \
std::unique_ptr<uint8_t[]> yuv_input(CreateFakeInterleaveYuvTestingImage( \
kHeight, kWidth, BLOCK_SIZE, yuv_pointer, FOURCC_##SRC_NAME)); \
/* Allocate space for the output image.*/ \
rtc::scoped_ptr<uint8_t[]> yuv_output( \
std::unique_ptr<uint8_t[]> yuv_output( \
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]); \
uint8_t* y_output_pointer = \
ALIGNP(yuv_output.get(), kAlignment) + unalignment; \
@ -681,7 +681,7 @@ TEST_P(PlanarFunctionsTest, NV12ToI420) {
uint8_t* y_expected_pointer = nullptr; \
uint8_t* u_expected_pointer = nullptr; \
uint8_t* v_expected_pointer = nullptr; \
rtc::scoped_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( \
std::unique_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( \
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_expected_pointer, \
u_expected_pointer, v_expected_pointer)); \
for (int i = 0; i < repeat_; ++i) { \
@ -715,15 +715,15 @@ TEST_YUVTOI420(UYVY, 1.e-6, 2);
int u_pitch = (kWidth + 1) >> 1; \
int v_pitch = (kWidth + 1) >> 1; \
/* Generate a fake input image.*/ \
rtc::scoped_ptr<uint8_t[]> yuv_input( \
std::unique_ptr<uint8_t[]> yuv_input( \
CreateFakeYuvTestingImage(kHeight, kWidth, BLOCK_SIZE, JPG_TYPE, \
y_pointer, u_pointer, v_pointer)); \
/* Generate the expected output.*/ \
rtc::scoped_ptr<uint8_t[]> argb_expected( \
std::unique_ptr<uint8_t[]> argb_expected( \
CreateFakeArgbTestingImage(kHeight, kWidth, BLOCK_SIZE, \
argb_expected_pointer, FOURCC_##DST_NAME)); \
/* Allocate space for the output.*/ \
rtc::scoped_ptr<uint8_t[]> argb_output( \
std::unique_ptr<uint8_t[]> argb_output( \
new uint8_t[kHeight * kWidth * 4 + kAlignment]); \
uint8_t* argb_pointer = ALIGNP(argb_expected.get(), kAlignment); \
for (int i = 0; i < repeat_; ++i) { \
@ -760,21 +760,21 @@ TEST_F(PlanarFunctionsTest, I400ToARGB_Reference) {
int v_pitch = (kWidth + 1) >> 1;
int block_size = 3;
// Generate a fake input image.
rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage(
std::unique_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage(
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_pointer, u_pointer,
v_pointer));
// As the comparison standard, we convert a grayscale image (by setting both
// U and V channels to be 128) using an I420 converter.
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
rtc::scoped_ptr<uint8_t[]> uv(new uint8_t[uv_size + kAlignment]);
std::unique_ptr<uint8_t[]> uv(new uint8_t[uv_size + kAlignment]);
u_pointer = v_pointer = ALIGNP(uv.get(), kAlignment);
memset(u_pointer, 128, uv_size);
// Allocate space for the output image and generate the expected output.
rtc::scoped_ptr<uint8_t[]> argb_expected(
std::unique_ptr<uint8_t[]> argb_expected(
new uint8_t[kHeight * kWidth * 4 + kAlignment]);
rtc::scoped_ptr<uint8_t[]> argb_output(
std::unique_ptr<uint8_t[]> argb_output(
new uint8_t[kHeight * kWidth * 4 + kAlignment]);
uint8_t* argb_expected_pointer = ALIGNP(argb_expected.get(), kAlignment);
uint8_t* argb_pointer = ALIGNP(argb_output.get(), kAlignment);
@ -807,7 +807,7 @@ TEST_P(PlanarFunctionsTest, I400ToARGB) {
int v_pitch = (kWidth + 1) >> 1;
int block_size = 3;
// Generate a fake input image.
rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage(
std::unique_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage(
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_pointer, u_pointer,
v_pointer));
// As the comparison standard, we convert a grayscale image (by setting both
@ -815,17 +815,17 @@ TEST_P(PlanarFunctionsTest, I400ToARGB) {
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
// 1 byte extra if in the unaligned mode.
rtc::scoped_ptr<uint8_t[]> uv(new uint8_t[uv_size * 2 + kAlignment]);
std::unique_ptr<uint8_t[]> uv(new uint8_t[uv_size * 2 + kAlignment]);
u_pointer = ALIGNP(uv.get(), kAlignment);
v_pointer = u_pointer + uv_size;
memset(u_pointer, 128, uv_size);
memset(v_pointer, 128, uv_size);
// Allocate space for the output image and generate the expected output.
rtc::scoped_ptr<uint8_t[]> argb_expected(
std::unique_ptr<uint8_t[]> argb_expected(
new uint8_t[kHeight * kWidth * 4 + kAlignment]);
// 1 byte extra if in the misalinged mode.
rtc::scoped_ptr<uint8_t[]> argb_output(
std::unique_ptr<uint8_t[]> argb_output(
new uint8_t[kHeight * kWidth * 4 + kAlignment + unalignment]);
uint8_t* argb_expected_pointer = ALIGNP(argb_expected.get(), kAlignment);
uint8_t* argb_pointer = ALIGNP(argb_output.get(), kAlignment) + unalignment;
@ -856,14 +856,14 @@ TEST_P(PlanarFunctionsTest, ARGBToI400) {
uint8_t* argb_pointer = NULL;
int block_size = 3;
// Generate a fake input image.
rtc::scoped_ptr<uint8_t[]> argb_input(CreateFakeArgbTestingImage(
std::unique_ptr<uint8_t[]> argb_input(CreateFakeArgbTestingImage(
kHeight, kWidth, block_size, argb_pointer, FOURCC_ARGB));
// Generate the expected output. Only Y channel is used
rtc::scoped_ptr<uint8_t[]> yuv_expected(CreateFakeYuvTestingImage(
std::unique_ptr<uint8_t[]> yuv_expected(CreateFakeYuvTestingImage(
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_pointer, u_pointer,
v_pointer));
// Allocate space for the Y output.
rtc::scoped_ptr<uint8_t[]> y_output(
std::unique_ptr<uint8_t[]> y_output(
new uint8_t[kHeight * kWidth + kAlignment + unalignment]);
uint8_t* y_output_pointer = ALIGNP(y_output.get(), kAlignment) + unalignment;
@ -884,15 +884,15 @@ TEST_P(PlanarFunctionsTest, ARGBToI400) {
#define TEST_ARGB(SRC_NAME, FC_ID, BPP, BLOCK_SIZE) \
TEST_P(PlanarFunctionsTest, SRC_NAME##ToARGB) { \
int unalignment = GetParam(); /* Get the unalignment offset.*/ \
uint8_t* argb_expected_pointer = NULL, * src_pointer = NULL; \
uint8_t *argb_expected_pointer = NULL, *src_pointer = NULL; \
/* Generate a fake input image.*/ \
rtc::scoped_ptr<uint8_t[]> src_input(CreateFakeArgbTestingImage( \
std::unique_ptr<uint8_t[]> src_input(CreateFakeArgbTestingImage( \
kHeight, kWidth, BLOCK_SIZE, src_pointer, FOURCC_##FC_ID)); \
/* Generate the expected output.*/ \
rtc::scoped_ptr<uint8_t[]> argb_expected(CreateFakeArgbTestingImage( \
std::unique_ptr<uint8_t[]> argb_expected(CreateFakeArgbTestingImage( \
kHeight, kWidth, BLOCK_SIZE, argb_expected_pointer, FOURCC_ARGB)); \
/* Allocate space for the output; 1 byte extra if in the unaligned mode.*/ \
rtc::scoped_ptr<uint8_t[]> argb_output( \
std::unique_ptr<uint8_t[]> argb_output( \
new uint8_t[kHeight * kWidth * 4 + kAlignment + unalignment]); \
uint8_t* argb_pointer = \
ALIGNP(argb_output.get(), kAlignment) + unalignment; \

View File

@ -13,12 +13,12 @@
#include <list>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "webrtc/base/basictypes.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sigslotrepeater.h"
#include "webrtc/base/sslstreamadapter.h"
#include "webrtc/media/base/cryptoparams.h"
@ -167,10 +167,10 @@ class SrtpFilter {
State state_;
uint32_t signal_silent_time_in_ms_;
std::vector<CryptoParams> offer_params_;
rtc::scoped_ptr<SrtpSession> send_session_;
rtc::scoped_ptr<SrtpSession> recv_session_;
rtc::scoped_ptr<SrtpSession> send_rtcp_session_;
rtc::scoped_ptr<SrtpSession> recv_rtcp_session_;
std::unique_ptr<SrtpSession> send_session_;
std::unique_ptr<SrtpSession> recv_session_;
std::unique_ptr<SrtpSession> send_rtcp_session_;
std::unique_ptr<SrtpSession> recv_rtcp_session_;
CryptoParams applied_send_params_;
CryptoParams applied_recv_params_;
};
@ -229,7 +229,7 @@ class SrtpSession {
srtp_ctx_t* session_;
int rtp_auth_tag_len_;
int rtcp_auth_tag_len_;
rtc::scoped_ptr<SrtpStat> srtp_stat_;
std::unique_ptr<SrtpStat> srtp_stat_;
static bool inited_;
static rtc::GlobalLockPod lock_;
int last_send_seq_num_;

View File

@ -15,7 +15,6 @@
#include "webrtc/base/basictypes.h"
#include "webrtc/base/flags.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/media/base/testutils.h"
#if defined(_MSC_VER)
@ -26,7 +25,6 @@
using cricket::LoadPlanarYuvTestImage;
using cricket::DumpPlanarYuvTestImage;
using rtc::scoped_ptr;
DEFINE_bool(yuvscaler_dump, false,
"whether to write out scaled images for inspection");
@ -84,11 +82,11 @@ class YuvScalerTest : public testing::Test {
*error = 0.;
size_t isize = I420_SIZE(iw, ih);
size_t osize = I420_SIZE(ow, oh);
scoped_ptr<uint8_t[]> ibuffer(
std::unique_ptr<uint8_t[]> ibuffer(
new uint8_t[isize + kAlignment + memoffset]());
scoped_ptr<uint8_t[]> obuffer(
std::unique_ptr<uint8_t[]> obuffer(
new uint8_t[osize + kAlignment + memoffset]());
scoped_ptr<uint8_t[]> xbuffer(
std::unique_ptr<uint8_t[]> xbuffer(
new uint8_t[osize + kAlignment + memoffset]());
uint8_t* ibuf = ALIGNP(ibuffer.get(), kAlignment) + memoffset;
@ -192,8 +190,10 @@ TEST_F(YuvScalerTest, TestOffset16_10Copy) {
const int iw = 640, ih = 360;
const int ow = 640, oh = 480;
const int offset = (480 - 360) / 2;
scoped_ptr<uint8_t[]> ibuffer(new uint8_t[I420_SIZE(iw, ih) + kAlignment]);
scoped_ptr<uint8_t[]> obuffer(new uint8_t[I420_SIZE(ow, oh) + kAlignment]);
std::unique_ptr<uint8_t[]> ibuffer(
new uint8_t[I420_SIZE(iw, ih) + kAlignment]);
std::unique_ptr<uint8_t[]> obuffer(
new uint8_t[I420_SIZE(ow, oh) + kAlignment]);
uint8_t* ibuf = ALIGNP(ibuffer.get(), kAlignment);
uint8_t* obuf = ALIGNP(obuffer.get(), kAlignment);