Replace scoped_ptr with unique_ptr in webrtc/api/
But keep #including scoped_ptr.h in .h files, so as not to break
WebRTC users who expect those .h files to give them rtc::scoped_ptr.
BUG=webrtc:5520
Review URL: https://codereview.webrtc.org/1930463002
Cr-Commit-Position: refs/heads/master@{#12530}
diff --git a/webrtc/api/androidvideocapturer.cc b/webrtc/api/androidvideocapturer.cc
index e98a4be..ee5ef66 100644
--- a/webrtc/api/androidvideocapturer.cc
+++ b/webrtc/api/androidvideocapturer.cc
@@ -10,6 +10,8 @@
#include "webrtc/api/androidvideocapturer.h"
+#include <memory>
+
#include "webrtc/api/java/jni/native_handle_impl.h"
#include "webrtc/base/common.h"
#include "webrtc/base/timeutils.h"
@@ -70,11 +72,11 @@
RTC_CHECK(captured_frame == &captured_frame_);
RTC_CHECK(buffer_->native_handle() == nullptr);
- rtc::scoped_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame(
+ std::unique_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame(
ShallowCenterCrop(buffer_, dst_width, dst_height),
captured_frame->time_stamp, captured_frame->rotation));
// Caller takes ownership.
- // TODO(magjed): Change CreateAliasedFrame() to return a rtc::scoped_ptr.
+ // TODO(magjed): Change CreateAliasedFrame() to return a std::unique_ptr.
return apply_rotation_ ? frame->GetCopyWithRotationApplied()->Copy()
: frame.release();
}
diff --git a/webrtc/api/datachannel.cc b/webrtc/api/datachannel.cc
index 612d7e0..452e4b3 100644
--- a/webrtc/api/datachannel.cc
+++ b/webrtc/api/datachannel.cc
@@ -10,6 +10,7 @@
#include "webrtc/api/datachannel.h"
+#include <memory>
#include <string>
#include "webrtc/api/mediastreamprovider.h"
@@ -363,7 +364,7 @@
}
bool binary = (params.type == cricket::DMT_BINARY);
- rtc::scoped_ptr<DataBuffer> buffer(new DataBuffer(payload, binary));
+ std::unique_ptr<DataBuffer> buffer(new DataBuffer(payload, binary));
if (state_ == kOpen && observer_) {
observer_->OnMessage(*buffer.get());
} else {
@@ -494,7 +495,7 @@
}
while (!queued_received_data_.Empty()) {
- rtc::scoped_ptr<DataBuffer> buffer(queued_received_data_.Front());
+ std::unique_ptr<DataBuffer> buffer(queued_received_data_.Front());
observer_->OnMessage(*buffer);
queued_received_data_.Pop();
}
@@ -589,7 +590,7 @@
control_packets.Swap(&queued_control_data_);
while (!control_packets.Empty()) {
- rtc::scoped_ptr<DataBuffer> buf(control_packets.Front());
+ std::unique_ptr<DataBuffer> buf(control_packets.Front());
SendControlMessage(buf->data);
control_packets.Pop();
}
diff --git a/webrtc/api/datachannel_unittest.cc b/webrtc/api/datachannel_unittest.cc
index 5958ec0..d55ab57 100644
--- a/webrtc/api/datachannel_unittest.cc
+++ b/webrtc/api/datachannel_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/api/datachannel.h"
#include "webrtc/api/sctputils.h"
#include "webrtc/api/test/fakedatachannelprovider.h"
@@ -85,7 +87,7 @@
webrtc::InternalDataChannelInit init_;
FakeDataChannelProvider provider_;
- rtc::scoped_ptr<FakeDataChannelObserver> observer_;
+ std::unique_ptr<FakeDataChannelObserver> observer_;
rtc::scoped_refptr<DataChannel> webrtc_data_channel_;
};
diff --git a/webrtc/api/dtlsidentitystore.cc b/webrtc/api/dtlsidentitystore.cc
index a1105ed..bdccc10 100644
--- a/webrtc/api/dtlsidentitystore.cc
+++ b/webrtc/api/dtlsidentitystore.cc
@@ -74,7 +74,7 @@
case MSG_GENERATE_IDENTITY_RESULT:
RTC_DCHECK(signaling_thread_->IsCurrent());
{
- rtc::scoped_ptr<IdentityResultMessageData> pdata(
+ std::unique_ptr<IdentityResultMessageData> pdata(
static_cast<IdentityResultMessageData*>(msg->pdata));
if (store_) {
store_->OnIdentityGenerated(pdata->data()->key_type_,
@@ -131,7 +131,7 @@
RTC_DCHECK(signaling_thread_->IsCurrent());
switch (msg->message_id) {
case MSG_GENERATE_IDENTITY_RESULT: {
- rtc::scoped_ptr<IdentityResultMessageData> pdata(
+ std::unique_ptr<IdentityResultMessageData> pdata(
static_cast<IdentityResultMessageData*>(msg->pdata));
OnIdentityGenerated(pdata->data()->key_type_,
std::move(pdata->data()->identity_));
diff --git a/webrtc/api/dtmfsender_unittest.cc b/webrtc/api/dtmfsender_unittest.cc
index 0a944cb..e6fa7fc 100644
--- a/webrtc/api/dtmfsender_unittest.cc
+++ b/webrtc/api/dtmfsender_unittest.cc
@@ -10,6 +10,7 @@
#include "webrtc/api/dtmfsender.h"
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -214,8 +215,8 @@
}
rtc::scoped_refptr<AudioTrackInterface> track_;
- rtc::scoped_ptr<FakeDtmfObserver> observer_;
- rtc::scoped_ptr<FakeDtmfProvider> provider_;
+ std::unique_ptr<FakeDtmfObserver> observer_;
+ std::unique_ptr<FakeDtmfProvider> provider_;
rtc::scoped_refptr<DtmfSender> dtmf_;
};
diff --git a/webrtc/api/java/jni/androidmediadecoder_jni.cc b/webrtc/api/java/jni/androidmediadecoder_jni.cc
index c83be18..a0e5579 100644
--- a/webrtc/api/java/jni/androidmediadecoder_jni.cc
+++ b/webrtc/api/java/jni/androidmediadecoder_jni.cc
@@ -9,6 +9,7 @@
*/
#include <algorithm>
+#include <memory>
#include <vector>
// NOTICE: androidmediadecoder_jni.h must be included before
@@ -36,7 +37,6 @@
using rtc::Bind;
using rtc::Thread;
using rtc::ThreadManager;
-using rtc::scoped_ptr;
using webrtc::CodecSpecificInfo;
using webrtc::DecodedImageCallback;
@@ -137,7 +137,8 @@
// State that is constant for the lifetime of this object once the ctor
// returns.
- scoped_ptr<Thread> codec_thread_; // Thread on which to operate MediaCodec.
+ std::unique_ptr<Thread>
+ codec_thread_; // Thread on which to operate MediaCodec.
ScopedGlobalRef<jclass> j_media_codec_video_decoder_class_;
ScopedGlobalRef<jobject> j_media_codec_video_decoder_;
jmethodID j_init_decode_method_;
diff --git a/webrtc/api/java/jni/androidmediaencoder_jni.cc b/webrtc/api/java/jni/androidmediaencoder_jni.cc
index e88a94c..b7f2da4 100644
--- a/webrtc/api/java/jni/androidmediaencoder_jni.cc
+++ b/webrtc/api/java/jni/androidmediaencoder_jni.cc
@@ -13,6 +13,7 @@
#include "webrtc/api/java/jni/androidmediaencoder_jni.h"
#include <algorithm>
+#include <memory>
#include <list>
#include "third_party/libyuv/include/libyuv/convert.h"
@@ -37,7 +38,6 @@
using rtc::Bind;
using rtc::Thread;
using rtc::ThreadManager;
-using rtc::scoped_ptr;
using webrtc::CodecSpecificInfo;
using webrtc::EncodedImage;
@@ -182,7 +182,8 @@
// State that is constant for the lifetime of this object once the ctor
// returns.
- scoped_ptr<Thread> codec_thread_; // Thread on which to operate MediaCodec.
+ std::unique_ptr<Thread>
+ codec_thread_; // Thread on which to operate MediaCodec.
rtc::ThreadChecker codec_thread_checker_;
ScopedGlobalRef<jclass> j_media_codec_video_encoder_class_;
ScopedGlobalRef<jobject> j_media_codec_video_encoder_;
@@ -973,7 +974,7 @@
// Callback - return encoded frame.
int32_t callback_status = 0;
if (callback_) {
- scoped_ptr<webrtc::EncodedImage> image(
+ std::unique_ptr<webrtc::EncodedImage> image(
new webrtc::EncodedImage(payload, payload_size, payload_size));
image->_encodedWidth = width_;
image->_encodedHeight = height_;
diff --git a/webrtc/api/java/jni/androidvideocapturer_jni.h b/webrtc/api/java/jni/androidvideocapturer_jni.h
index 53f1803..eea56ad 100644
--- a/webrtc/api/java/jni/androidvideocapturer_jni.h
+++ b/webrtc/api/java/jni/androidvideocapturer_jni.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_API_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_
#define WEBRTC_API_JAVA_JNI_ANDROIDVIDEOCAPTURER_JNI_H_
+#include <memory>
#include <string>
#include "webrtc/api/androidvideocapturer.h"
@@ -87,7 +88,7 @@
webrtc::AndroidVideoCapturer* capturer_ GUARDED_BY(capturer_lock_);
// |invoker_| is used to communicate with |capturer_| on the thread Start() is
// called on.
- rtc::scoped_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_);
+ std::unique_ptr<rtc::GuardedAsyncInvoker> invoker_ GUARDED_BY(capturer_lock_);
static jobject application_context_;
diff --git a/webrtc/api/java/jni/native_handle_impl.cc b/webrtc/api/java/jni/native_handle_impl.cc
index d52584a..1990828 100644
--- a/webrtc/api/java/jni/native_handle_impl.cc
+++ b/webrtc/api/java/jni/native_handle_impl.cc
@@ -10,12 +10,13 @@
#include "webrtc/api/java/jni/native_handle_impl.h"
+#include <memory>
+
#include "webrtc/api/java/jni/jni_helpers.h"
#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/keep_ref_until_done.h"
#include "webrtc/base/logging.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/scoped_ref_ptr.h"
using webrtc::NativeHandleBuffer;
@@ -104,7 +105,7 @@
//
// TODO(nisse): Use an I420BufferPool. We then need to extend that
// class, and I420Buffer, to support our memory layout.
- rtc::scoped_ptr<uint8_t, webrtc::AlignedFreeDeleter> yuv_data(
+ std::unique_ptr<uint8_t, webrtc::AlignedFreeDeleter> yuv_data(
static_cast<uint8_t*>(webrtc::AlignedMalloc(size, kBufferAlignment)));
// See SurfaceTextureHelper.java for the required layout.
uint8_t* y_data = yuv_data.get();
diff --git a/webrtc/api/java/jni/peerconnection_jni.cc b/webrtc/api/java/jni/peerconnection_jni.cc
index b0757e2..228e5e1 100644
--- a/webrtc/api/java/jni/peerconnection_jni.cc
+++ b/webrtc/api/java/jni/peerconnection_jni.cc
@@ -80,7 +80,6 @@
using rtc::Bind;
using rtc::Thread;
using rtc::ThreadManager;
-using rtc::scoped_ptr;
using webrtc::AudioSourceInterface;
using webrtc::AudioTrackInterface;
using webrtc::AudioTrackVector;
@@ -427,7 +426,7 @@
// C++ -> Java remote streams. The stored jobects are global refs and must be
// manually deleted upon removal. Use DisposeRemoteStream().
NativeToJavaStreamsMap remote_streams_;
- scoped_ptr<ConstraintsWrapper> constraints_;
+ std::unique_ptr<ConstraintsWrapper> constraints_;
};
// Wrapper for a Java MediaConstraints object. Copies all needed data so when
@@ -549,7 +548,7 @@
}
private:
- scoped_ptr<ConstraintsWrapper> constraints_;
+ std::unique_ptr<ConstraintsWrapper> constraints_;
const ScopedGlobalRef<jobject> j_observer_global_;
const ScopedGlobalRef<jclass> j_observer_class_;
};
@@ -822,7 +821,7 @@
JOW(jlong, DataChannel_registerObserverNative)(
JNIEnv* jni, jobject j_dc, jobject j_observer) {
- scoped_ptr<DataChannelObserverWrapper> observer(
+ std::unique_ptr<DataChannelObserverWrapper> observer(
new DataChannelObserverWrapper(jni, j_observer));
ExtractNativeDC(jni, j_dc)->RegisterObserver(observer.get());
return jlongFromPointer(observer.release());
@@ -1067,8 +1066,8 @@
private:
void JavaCallbackOnFactoryThreads();
- const scoped_ptr<Thread> worker_thread_;
- const scoped_ptr<Thread> signaling_thread_;
+ const std::unique_ptr<Thread> worker_thread_;
+ const std::unique_ptr<Thread> signaling_thread_;
WebRtcVideoEncoderFactory* encoder_factory_;
WebRtcVideoDecoderFactory* decoder_factory_;
rtc::NetworkMonitorFactory* network_monitor_factory_;
@@ -1225,11 +1224,11 @@
rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
new rtc::RefCountedObject<AndroidVideoCapturerJni>(
jni, j_video_capturer, j_egl_context);
- rtc::scoped_ptr<cricket::VideoCapturer> capturer(
+ std::unique_ptr<cricket::VideoCapturer> capturer(
new webrtc::AndroidVideoCapturer(delegate));
// Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer,
// native factory and constraints.
- scoped_ptr<ConstraintsWrapper> constraints(
+ std::unique_ptr<ConstraintsWrapper> constraints(
new ConstraintsWrapper(jni, j_constraints));
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
@@ -1251,7 +1250,7 @@
JOW(jlong, PeerConnectionFactory_nativeCreateAudioSource)(
JNIEnv* jni, jclass, jlong native_factory, jobject j_constraints) {
- scoped_ptr<ConstraintsWrapper> constraints(
+ std::unique_ptr<ConstraintsWrapper> constraints(
new ConstraintsWrapper(jni, j_constraints));
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
@@ -1706,7 +1705,7 @@
jint j_sdp_mline_index, jstring j_candidate_sdp) {
std::string sdp_mid = JavaToStdString(jni, j_sdp_mid);
std::string sdp = JavaToStdString(jni, j_candidate_sdp);
- scoped_ptr<IceCandidateInterface> candidate(
+ std::unique_ptr<IceCandidateInterface> candidate(
webrtc::CreateIceCandidate(sdp_mid, j_sdp_mline_index, sdp, NULL));
return ExtractNativePC(jni, j_pc)->AddIceCandidate(candidate.get());
}
@@ -1871,7 +1870,7 @@
JOW(jlong, VideoRenderer_nativeWrapVideoRenderer)(
JNIEnv* jni, jclass, jobject j_callbacks) {
- scoped_ptr<JavaVideoRendererWrapper> renderer(
+ std::unique_ptr<JavaVideoRendererWrapper> renderer(
new JavaVideoRendererWrapper(jni, j_callbacks));
return (jlong)renderer.release();
}
@@ -1985,7 +1984,7 @@
JOW(jbyteArray, CallSessionFileRotatingLogSink_nativeGetLogData)(
JNIEnv* jni, jclass, jstring j_dirPath) {
std::string dir_path = JavaToStdString(jni, j_dirPath);
- rtc::scoped_ptr<rtc::CallSessionFileRotatingStream> stream(
+ std::unique_ptr<rtc::CallSessionFileRotatingStream> stream(
new rtc::CallSessionFileRotatingStream(dir_path));
if (!stream->Open()) {
LOG_V(rtc::LoggingSeverity::LS_WARNING) <<
@@ -2000,7 +1999,7 @@
}
size_t read = 0;
- rtc::scoped_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size)));
+ std::unique_ptr<jbyte> buffer(static_cast<jbyte*>(malloc(log_size)));
stream->ReadAll(buffer.get(), log_size, &read, nullptr);
jbyteArray result = jni->NewByteArray(read);
diff --git a/webrtc/api/jsepsessiondescription.cc b/webrtc/api/jsepsessiondescription.cc
index ee0a8e1..547a60f 100644
--- a/webrtc/api/jsepsessiondescription.cc
+++ b/webrtc/api/jsepsessiondescription.cc
@@ -10,12 +10,13 @@
#include "webrtc/api/jsepsessiondescription.h"
+#include <memory>
+
#include "webrtc/api/webrtcsdp.h"
#include "webrtc/base/arraysize.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/pc/mediasession.h"
-using rtc::scoped_ptr;
using cricket::SessionDescription;
namespace webrtc {
@@ -124,7 +125,7 @@
updated_candidate.set_password(transport_info->description.ice_pwd);
}
- scoped_ptr<JsepIceCandidate> updated_candidate_wrapper(
+ std::unique_ptr<JsepIceCandidate> updated_candidate_wrapper(
new JsepIceCandidate(candidate->sdp_mid(),
static_cast<int>(mediasection_index),
updated_candidate));
diff --git a/webrtc/api/jsepsessiondescription.h b/webrtc/api/jsepsessiondescription.h
index d4b4908..56dd806 100644
--- a/webrtc/api/jsepsessiondescription.h
+++ b/webrtc/api/jsepsessiondescription.h
@@ -13,6 +13,7 @@
#ifndef WEBRTC_API_JSEPSESSIONDESCRIPTION_H_
#define WEBRTC_API_JSEPSESSIONDESCRIPTION_H_
+#include <memory>
#include <string>
#include <vector>
@@ -75,7 +76,7 @@
static const int kMaxVideoCodecHeight;
private:
- rtc::scoped_ptr<cricket::SessionDescription> description_;
+ std::unique_ptr<cricket::SessionDescription> description_;
std::string session_id_;
std::string session_version_;
std::string type_;
diff --git a/webrtc/api/jsepsessiondescription_unittest.cc b/webrtc/api/jsepsessiondescription_unittest.cc
index 8f9fc54..6be590f 100644
--- a/webrtc/api/jsepsessiondescription_unittest.cc
+++ b/webrtc/api/jsepsessiondescription_unittest.cc
@@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include "webrtc/api/jsepicecandidate.h"
#include "webrtc/api/jsepsessiondescription.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/helpers.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/ssladapter.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/p2p/base/candidate.h"
@@ -27,7 +27,6 @@
using webrtc::JsepIceCandidate;
using webrtc::JsepSessionDescription;
using webrtc::SessionDescriptionInterface;
-using rtc::scoped_ptr;
static const char kCandidateUfrag[] = "ufrag";
static const char kCandidatePwd[] = "pwd";
@@ -41,11 +40,11 @@
static cricket::SessionDescription* CreateCricketSessionDescription() {
cricket::SessionDescription* desc(new cricket::SessionDescription());
// AudioContentDescription
- scoped_ptr<cricket::AudioContentDescription> audio(
+ std::unique_ptr<cricket::AudioContentDescription> audio(
new cricket::AudioContentDescription());
// VideoContentDescription
- scoped_ptr<cricket::VideoContentDescription> video(
+ std::unique_ptr<cricket::VideoContentDescription> video(
new cricket::VideoContentDescription());
audio->AddCodec(cricket::AudioCodec(103, "ISAC", 16000, 0, 0));
@@ -100,7 +99,7 @@
}
cricket::Candidate candidate_;
- rtc::scoped_ptr<JsepSessionDescription> jsep_desc_;
+ std::unique_ptr<JsepSessionDescription> jsep_desc_;
};
// Test that number_of_mediasections() returns the number of media contents in
@@ -204,7 +203,8 @@
TEST_F(JsepSessionDescriptionTest, SerializeDeserialize) {
std::string sdp = Serialize(jsep_desc_.get());
- scoped_ptr<SessionDescriptionInterface> parsed_jsep_desc(DeSerialize(sdp));
+ std::unique_ptr<SessionDescriptionInterface> parsed_jsep_desc(
+ DeSerialize(sdp));
EXPECT_EQ(2u, parsed_jsep_desc->number_of_mediasections());
std::string parsed_sdp = Serialize(parsed_jsep_desc.get());
@@ -222,7 +222,7 @@
std::string sdp_with_candidate = Serialize(jsep_desc_.get());
EXPECT_NE(sdp, sdp_with_candidate);
- scoped_ptr<SessionDescriptionInterface> parsed_jsep_desc(
+ std::unique_ptr<SessionDescriptionInterface> parsed_jsep_desc(
DeSerialize(sdp_with_candidate));
std::string parsed_sdp_with_candidate = Serialize(parsed_jsep_desc.get());
diff --git a/webrtc/api/mediacontroller.cc b/webrtc/api/mediacontroller.cc
index e276e0c..2e4501b 100644
--- a/webrtc/api/mediacontroller.cc
+++ b/webrtc/api/mediacontroller.cc
@@ -10,6 +10,8 @@
#include "webrtc/api/mediacontroller.h"
+#include <memory>
+
#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/constructormagic.h"
@@ -75,7 +77,7 @@
const cricket::MediaConfig media_config_;
cricket::ChannelManager* const channel_manager_;
webrtc::Call::Config call_config_;
- rtc::scoped_ptr<webrtc::Call> call_;
+ std::unique_ptr<webrtc::Call> call_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController);
};
diff --git a/webrtc/api/mediastream_unittest.cc b/webrtc/api/mediastream_unittest.cc
index dd63356..1881cce 100644
--- a/webrtc/api/mediastream_unittest.cc
+++ b/webrtc/api/mediastream_unittest.cc
@@ -18,7 +18,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/refcount.h"
-#include "webrtc/base/scoped_ptr.h"
static const char kStreamLabel1[] = "local_stream_1";
static const char kVideoTrackId[] = "dummy_video_cam_1";
diff --git a/webrtc/api/mediastreamprovider.h b/webrtc/api/mediastreamprovider.h
index f3bb3f4..eef9284 100644
--- a/webrtc/api/mediastreamprovider.h
+++ b/webrtc/api/mediastreamprovider.h
@@ -11,6 +11,8 @@
#ifndef WEBRTC_API_MEDIASTREAMPROVIDER_H_
#define WEBRTC_API_MEDIASTREAMPROVIDER_H_
+#include <memory>
+
#include "webrtc/api/rtpsenderinterface.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/scoped_ptr.h"
@@ -60,7 +62,7 @@
// passed to the provider.
virtual void SetRawAudioSink(
uint32_t ssrc,
- rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) = 0;
+ std::unique_ptr<webrtc::AudioSinkInterface> sink) = 0;
virtual RtpParameters GetAudioRtpParameters(uint32_t ssrc) const = 0;
virtual bool SetAudioRtpParameters(uint32_t ssrc,
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index 70a386e..7f1f452 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -526,8 +526,8 @@
bool PeerConnection::Initialize(
const PeerConnectionInterface::RTCConfiguration& configuration,
- rtc::scoped_ptr<cricket::PortAllocator> allocator,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<cricket::PortAllocator> allocator,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) {
TRACE_EVENT0("webrtc", "PeerConnection::Initialize");
RTC_DCHECK(observer != nullptr);
@@ -628,7 +628,7 @@
&PeerConnection::OnVideoTrackAdded);
observer->SignalVideoTrackRemoved.connect(
this, &PeerConnection::OnVideoTrackRemoved);
- stream_observers_.push_back(rtc::scoped_ptr<MediaStreamObserver>(observer));
+ stream_observers_.push_back(std::unique_ptr<MediaStreamObserver>(observer));
for (const auto& track : local_stream->GetAudioTracks()) {
OnAudioTrackAdded(track.get(), local_stream);
@@ -655,7 +655,7 @@
stream_observers_.erase(
std::remove_if(
stream_observers_.begin(), stream_observers_.end(),
- [local_stream](const rtc::scoped_ptr<MediaStreamObserver>& observer) {
+ [local_stream](const std::unique_ptr<MediaStreamObserver>& observer) {
return observer->stream()->label().compare(local_stream->label()) ==
0;
}),
@@ -835,7 +835,7 @@
TRACE_EVENT0("webrtc", "PeerConnection::CreateDataChannel");
bool first_datachannel = !HasDataChannels();
- rtc::scoped_ptr<InternalDataChannelInit> internal_config;
+ std::unique_ptr<InternalDataChannelInit> internal_config;
if (config) {
internal_config.reset(new InternalDataChannelInit(*config));
}
diff --git a/webrtc/api/peerconnection.h b/webrtc/api/peerconnection.h
index 1574af6..b557715 100644
--- a/webrtc/api/peerconnection.h
+++ b/webrtc/api/peerconnection.h
@@ -13,6 +13,7 @@
#include <string>
#include <map>
+#include <memory>
#include <vector>
#include "webrtc/api/dtlsidentitystore.h"
@@ -69,8 +70,8 @@
bool Initialize(
const PeerConnectionInterface::RTCConfiguration& configuration,
- rtc::scoped_ptr<cricket::PortAllocator> allocator,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<cricket::PortAllocator> allocator,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer);
rtc::scoped_refptr<StreamCollectionInterface> local_streams() override;
@@ -365,15 +366,15 @@
IceConnectionState ice_connection_state_;
IceGatheringState ice_gathering_state_;
- rtc::scoped_ptr<cricket::PortAllocator> port_allocator_;
- rtc::scoped_ptr<MediaControllerInterface> media_controller_;
+ std::unique_ptr<cricket::PortAllocator> port_allocator_;
+ std::unique_ptr<MediaControllerInterface> media_controller_;
// Streams added via AddStream.
rtc::scoped_refptr<StreamCollection> local_streams_;
// Streams created as a result of SetRemoteDescription.
rtc::scoped_refptr<StreamCollection> remote_streams_;
- std::vector<rtc::scoped_ptr<MediaStreamObserver>> stream_observers_;
+ std::vector<std::unique_ptr<MediaStreamObserver>> stream_observers_;
// These lists store track info seen in local/remote descriptions.
TrackInfos remote_audio_tracks_;
@@ -392,12 +393,12 @@
std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_;
std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_;
- // The session_ scoped_ptr is declared at the bottom of PeerConnection
+ // The session_ unique_ptr is declared at the bottom of PeerConnection
// because its destruction fires signals (such as VoiceChannelDestroyed)
// which will trigger some final actions in PeerConnection...
- rtc::scoped_ptr<WebRtcSession> session_;
+ std::unique_ptr<WebRtcSession> session_;
// ... But stats_ depends on session_ so it should be destroyed even earlier.
- rtc::scoped_ptr<StatsCollector> stats_;
+ std::unique_ptr<StatsCollector> stats_;
};
} // namespace webrtc
diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc
index 156605c..521486f 100644
--- a/webrtc/api/peerconnection_unittest.cc
+++ b/webrtc/api/peerconnection_unittest.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <list>
#include <map>
+#include <memory>
#include <utility>
#include <vector>
@@ -31,7 +32,6 @@
#include "webrtc/api/test/mockpeerconnectionobservers.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/physicalsocketserver.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/ssladapter.h"
#include "webrtc/base/sslstreamadapter.h"
#include "webrtc/base/thread.h"
@@ -154,7 +154,7 @@
const std::string& id,
const MediaConstraintsInterface* constraints,
const PeerConnectionFactory::Options* options,
- rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store,
bool prefer_constraint_apis,
rtc::Thread* worker_thread) {
PeerConnectionTestClient* client(new PeerConnectionTestClient(id));
@@ -171,7 +171,7 @@
const MediaConstraintsInterface* constraints,
const PeerConnectionFactory::Options* options,
rtc::Thread* worker_thread) {
- rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
+ std::unique_ptr<FakeDtlsIdentityStore> dtls_identity_store(
rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
: nullptr);
@@ -184,7 +184,7 @@
const std::string& id,
const PeerConnectionFactory::Options* options,
rtc::Thread* worker_thread) {
- rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
+ std::unique_ptr<FakeDtlsIdentityStore> dtls_identity_store(
rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
: nullptr);
@@ -199,7 +199,7 @@
void Negotiate() { Negotiate(true, true); }
void Negotiate(bool audio, bool video) {
- rtc::scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer));
if (offer->description()->GetContentByName("audio")) {
@@ -231,7 +231,7 @@
int sdp_mline_index,
const std::string& msg) override {
LOG(INFO) << id_ << "ReceiveIceMessage";
- rtc::scoped_ptr<webrtc::IceCandidateInterface> candidate(
+ std::unique_ptr<webrtc::IceCandidateInterface> candidate(
webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, msg, nullptr));
EXPECT_TRUE(pc()->AddIceCandidate(candidate.get()));
}
@@ -549,7 +549,7 @@
// Verify the CreateDtmfSender interface
void VerifyDtmf() {
- rtc::scoped_ptr<DummyDtmfObserver> observer(new DummyDtmfObserver());
+ std::unique_ptr<DummyDtmfObserver> observer(new DummyDtmfObserver());
rtc::scoped_refptr<DtmfSenderInterface> dtmf_sender;
// We can't create a DTMF sender with an invalid audio track or a non local
@@ -804,7 +804,7 @@
bool Init(
const MediaConstraintsInterface* constraints,
const PeerConnectionFactory::Options* options,
- rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store,
bool prefer_constraint_apis,
rtc::Thread* worker_thread) {
EXPECT_TRUE(!peer_connection_);
@@ -814,7 +814,7 @@
}
prefer_constraint_apis_ = prefer_constraint_apis;
- rtc::scoped_ptr<cricket::PortAllocator> port_allocator(
+ std::unique_ptr<cricket::PortAllocator> port_allocator(
new cricket::FakePortAllocator(worker_thread, nullptr));
fake_audio_capture_module_ = FakeAudioCaptureModule::Create();
@@ -838,9 +838,9 @@
}
rtc::scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(
- rtc::scoped_ptr<cricket::PortAllocator> port_allocator,
+ std::unique_ptr<cricket::PortAllocator> port_allocator,
const MediaConstraintsInterface* constraints,
- rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) {
+ std::unique_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) {
// CreatePeerConnection with RTCConfiguration.
webrtc::PeerConnectionInterface::RTCConfiguration config;
webrtc::PeerConnectionInterface::IceServer ice_server;
@@ -858,10 +858,10 @@
// If we are not sending any streams ourselves it is time to add some.
AddMediaStream(true, true);
}
- rtc::scoped_ptr<SessionDescriptionInterface> desc(
+ std::unique_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription("offer", msg, nullptr));
EXPECT_TRUE(DoSetRemoteDescription(desc.release()));
- rtc::scoped_ptr<SessionDescriptionInterface> answer;
+ std::unique_ptr<SessionDescriptionInterface> answer;
EXPECT_TRUE(DoCreateAnswer(&answer));
std::string sdp;
EXPECT_TRUE(answer->ToString(&sdp));
@@ -874,12 +874,12 @@
void HandleIncomingAnswer(const std::string& msg) {
LOG(INFO) << id_ << "HandleIncomingAnswer";
- rtc::scoped_ptr<SessionDescriptionInterface> desc(
+ std::unique_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription("answer", msg, nullptr));
EXPECT_TRUE(DoSetRemoteDescription(desc.release()));
}
- bool DoCreateOfferAnswer(rtc::scoped_ptr<SessionDescriptionInterface>* desc,
+ bool DoCreateOfferAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
bool offer) {
rtc::scoped_refptr<MockCreateSessionDescriptionObserver>
observer(new rtc::RefCountedObject<
@@ -905,11 +905,11 @@
return observer->result();
}
- bool DoCreateOffer(rtc::scoped_ptr<SessionDescriptionInterface>* desc) {
+ bool DoCreateOffer(std::unique_ptr<SessionDescriptionInterface>* desc) {
return DoCreateOfferAnswer(desc, true);
}
- bool DoCreateAnswer(rtc::scoped_ptr<SessionDescriptionInterface>* desc) {
+ bool DoCreateAnswer(std::unique_ptr<SessionDescriptionInterface>* desc) {
return DoCreateOfferAnswer(desc, false);
}
@@ -982,10 +982,10 @@
// Needed to keep track of number of frames sent.
rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
// Needed to keep track of number of frames received.
- std::map<std::string, rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer>>
+ std::map<std::string, std::unique_ptr<webrtc::FakeVideoTrackRenderer>>
fake_video_renderers_;
// Needed to ensure frames aren't received for removed tracks.
- std::vector<rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer>>
+ std::vector<std::unique_ptr<webrtc::FakeVideoTrackRenderer>>
removed_fake_video_renderers_;
// Needed to keep track of number of frames received when external decoder
// used.
@@ -1002,7 +1002,7 @@
std::vector<cricket::FakeVideoCapturer*> video_capturers_;
webrtc::VideoRotation capture_rotation_ = webrtc::kVideoRotation_0;
// |local_video_renderer_| attached to the first created local video track.
- rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer> local_video_renderer_;
+ std::unique_ptr<webrtc::FakeVideoTrackRenderer> local_video_renderer_;
webrtc::FakeConstraints offer_answer_constraints_;
PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options_;
@@ -1016,7 +1016,7 @@
bool remove_cvo_ = false;
rtc::scoped_refptr<DataChannelInterface> data_channel_;
- rtc::scoped_ptr<MockDataChannelObserver> data_observer_;
+ std::unique_ptr<MockDataChannelObserver> data_observer_;
};
class P2PTestConductor : public testing::Test {
@@ -1253,7 +1253,7 @@
setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
true);
- rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
+ std::unique_ptr<FakeDtlsIdentityStore> dtls_identity_store(
rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
: nullptr);
dtls_identity_store->use_alternate_key();
@@ -1305,11 +1305,11 @@
// |worker_thread_| is used by both |initiating_client_| and
// |receiving_client_|. Must be destroyed last.
rtc::Thread worker_thread_;
- rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
- rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
+ std::unique_ptr<rtc::PhysicalSocketServer> pss_;
+ std::unique_ptr<rtc::VirtualSocketServer> ss_;
rtc::SocketServerScope ss_scope_;
- rtc::scoped_ptr<PeerConnectionTestClient> initiating_client_;
- rtc::scoped_ptr<PeerConnectionTestClient> receiving_client_;
+ std::unique_ptr<PeerConnectionTestClient> initiating_client_;
+ std::unique_ptr<PeerConnectionTestClient> receiving_client_;
bool prefer_constraint_apis_ = true;
};
@@ -1405,7 +1405,7 @@
// Keeping the original peer around which will still send packets to the
// receiving client. These SRTP packets will be dropped.
- rtc::scoped_ptr<PeerConnectionTestClient> original_peer(
+ std::unique_ptr<PeerConnectionTestClient> original_peer(
set_initializing_client(CreateDtlsClientWithAlternateKey()));
original_peer->pc()->Close();
@@ -1443,7 +1443,7 @@
// Keeping the original peer around which will still send packets to the
// receiving client. These SRTP packets will be dropped.
- rtc::scoped_ptr<PeerConnectionTestClient> original_peer(
+ std::unique_ptr<PeerConnectionTestClient> original_peer(
set_receiving_client(CreateDtlsClientWithAlternateKey()));
original_peer->pc()->Close();
diff --git a/webrtc/api/peerconnectionendtoend_unittest.cc b/webrtc/api/peerconnectionendtoend_unittest.cc
index 20df17b..95369b1 100644
--- a/webrtc/api/peerconnectionendtoend_unittest.cc
+++ b/webrtc/api/peerconnectionendtoend_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/api/test/peerconnectiontestwrapper.h"
// Notice that mockpeerconnectionobservers.h must be included after the above!
#include "webrtc/api/test/mockpeerconnectionobservers.h"
@@ -112,10 +114,10 @@
// Tests that |dc1| and |dc2| can send to and receive from each other.
void TestDataChannelSendAndReceive(
DataChannelInterface* dc1, DataChannelInterface* dc2) {
- rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc1_observer(
+ std::unique_ptr<webrtc::MockDataChannelObserver> dc1_observer(
new webrtc::MockDataChannelObserver(dc1));
- rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc2_observer(
+ std::unique_ptr<webrtc::MockDataChannelObserver> dc2_observer(
new webrtc::MockDataChannelObserver(dc2));
static const std::string kDummyData = "abcdefg";
@@ -294,10 +296,10 @@
WaitForDataChannelsToOpen(caller_dc_1, callee_signaled_data_channels_, 0);
WaitForDataChannelsToOpen(caller_dc_2, callee_signaled_data_channels_, 1);
- rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc_1_observer(
+ std::unique_ptr<webrtc::MockDataChannelObserver> dc_1_observer(
new webrtc::MockDataChannelObserver(callee_signaled_data_channels_[0]));
- rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc_2_observer(
+ std::unique_ptr<webrtc::MockDataChannelObserver> dc_2_observer(
new webrtc::MockDataChannelObserver(callee_signaled_data_channels_[1]));
const std::string message_1 = "hello 1";
diff --git a/webrtc/api/peerconnectionfactory.cc b/webrtc/api/peerconnectionfactory.cc
index 8e1ece6..ff8098c 100644
--- a/webrtc/api/peerconnectionfactory.cc
+++ b/webrtc/api/peerconnectionfactory.cc
@@ -249,8 +249,8 @@
PeerConnectionFactory::CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration_in,
const MediaConstraintsInterface* constraints,
- rtc::scoped_ptr<cricket::PortAllocator> allocator,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<cricket::PortAllocator> allocator,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) {
RTC_DCHECK(signaling_thread_->IsCurrent());
@@ -265,8 +265,8 @@
rtc::scoped_refptr<PeerConnectionInterface>
PeerConnectionFactory::CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
- rtc::scoped_ptr<cricket::PortAllocator> allocator,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<cricket::PortAllocator> allocator,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) {
RTC_DCHECK(signaling_thread_->IsCurrent());
diff --git a/webrtc/api/peerconnectionfactory.h b/webrtc/api/peerconnectionfactory.h
index b47f75a..995c760 100644
--- a/webrtc/api/peerconnectionfactory.h
+++ b/webrtc/api/peerconnectionfactory.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_API_PEERCONNECTIONFACTORY_H_
#define WEBRTC_API_PEERCONNECTIONFACTORY_H_
+#include <memory>
#include <string>
#include "webrtc/api/dtlsidentitystore.h"
@@ -42,14 +43,14 @@
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
const MediaConstraintsInterface* constraints,
- rtc::scoped_ptr<cricket::PortAllocator> allocator,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<cricket::PortAllocator> allocator,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) override;
virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
- rtc::scoped_ptr<cricket::PortAllocator> allocator,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<cricket::PortAllocator> allocator,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) override;
bool Initialize();
@@ -112,17 +113,15 @@
Options options_;
// External Audio device used for audio playback.
rtc::scoped_refptr<AudioDeviceModule> default_adm_;
- rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
+ std::unique_ptr<cricket::ChannelManager> channel_manager_;
// External Video encoder factory. This can be NULL if the client has not
// injected any. In that case, video engine will use the internal SW encoder.
- rtc::scoped_ptr<cricket::WebRtcVideoEncoderFactory>
- video_encoder_factory_;
+ std::unique_ptr<cricket::WebRtcVideoEncoderFactory> video_encoder_factory_;
// External Video decoder factory. This can be NULL if the client has not
// injected any. In that case, video engine will use the internal SW decoder.
- rtc::scoped_ptr<cricket::WebRtcVideoDecoderFactory>
- video_decoder_factory_;
- rtc::scoped_ptr<rtc::BasicNetworkManager> default_network_manager_;
- rtc::scoped_ptr<rtc::BasicPacketSocketFactory> default_socket_factory_;
+ std::unique_ptr<cricket::WebRtcVideoDecoderFactory> video_decoder_factory_;
+ std::unique_ptr<rtc::BasicNetworkManager> default_network_manager_;
+ std::unique_ptr<rtc::BasicPacketSocketFactory> default_socket_factory_;
rtc::scoped_refptr<RefCountedDtlsIdentityStore> dtls_identity_store_;
};
diff --git a/webrtc/api/peerconnectionfactory_unittest.cc b/webrtc/api/peerconnectionfactory_unittest.cc
index 254e4e0..e7859d0 100644
--- a/webrtc/api/peerconnectionfactory_unittest.cc
+++ b/webrtc/api/peerconnectionfactory_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include <utility>
@@ -19,7 +20,6 @@
#include "webrtc/api/test/fakedtlsidentitystore.h"
#include "webrtc/api/test/fakevideotrackrenderer.h"
#include "webrtc/base/gunit.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread.h"
#include "webrtc/media/base/fakevideocapturer.h"
#include "webrtc/media/engine/webrtccommon.h"
@@ -122,7 +122,7 @@
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory_;
NullPeerConnectionObserver observer_;
- rtc::scoped_ptr<cricket::FakePortAllocator> port_allocator_;
+ std::unique_ptr<cricket::FakePortAllocator> port_allocator_;
// Since the PC owns the port allocator after it's been initialized,
// this should only be used when known to be safe.
cricket::FakePortAllocator* raw_port_allocator_;
@@ -141,7 +141,7 @@
NullPeerConnectionObserver observer;
webrtc::PeerConnectionInterface::RTCConfiguration config;
- rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
+ std::unique_ptr<FakeDtlsIdentityStore> dtls_identity_store(
new FakeDtlsIdentityStore());
rtc::scoped_refptr<PeerConnectionInterface> pc(factory->CreatePeerConnection(
config, nullptr, nullptr, std::move(dtls_identity_store), &observer));
@@ -162,7 +162,7 @@
ice_server.uri = kTurnIceServerWithTransport;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
new FakeDtlsIdentityStore());
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
config, nullptr, std::move(port_allocator_),
@@ -192,7 +192,7 @@
ice_server.urls.push_back(kTurnIceServerWithTransport);
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
new FakeDtlsIdentityStore());
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
config, nullptr, std::move(port_allocator_),
@@ -221,7 +221,7 @@
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
new FakeDtlsIdentityStore());
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
config, nullptr, std::move(port_allocator_),
@@ -242,7 +242,7 @@
ice_server.uri = kTurnIceServerWithTransport;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
new FakeDtlsIdentityStore());
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
config, nullptr, std::move(port_allocator_),
@@ -267,7 +267,7 @@
ice_server.uri = kSecureTurnIceServerWithoutTransportAndPortParam;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
new FakeDtlsIdentityStore());
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
config, nullptr, std::move(port_allocator_),
@@ -302,7 +302,7 @@
ice_server.uri = kTurnIceServerWithIPv6Address;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store(
new FakeDtlsIdentityStore());
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
config, nullptr, std::move(port_allocator_),
diff --git a/webrtc/api/peerconnectionfactoryproxy.h b/webrtc/api/peerconnectionfactoryproxy.h
index ef47cdb..f60f9e9 100644
--- a/webrtc/api/peerconnectionfactoryproxy.h
+++ b/webrtc/api/peerconnectionfactoryproxy.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_
#define WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_
+#include <memory>
#include <string>
#include <utility>
@@ -22,13 +23,13 @@
BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory)
PROXY_METHOD1(void, SetOptions, const Options&)
- // Can't use PROXY_METHOD5 because scoped_ptr must be moved.
- // TODO(tommi,hbos): Use of templates to support scoped_ptr?
+ // Can't use PROXY_METHOD5 because unique_ptr must be moved.
+ // TODO(tommi,hbos): Use of templates to support unique_ptr?
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& a1,
const MediaConstraintsInterface* a2,
- rtc::scoped_ptr<cricket::PortAllocator> a3,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> a4,
+ std::unique_ptr<cricket::PortAllocator> a3,
+ std::unique_ptr<DtlsIdentityStoreInterface> a4,
PeerConnectionObserver* a5) override {
return signaling_thread_
->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>(
@@ -37,8 +38,8 @@
}
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& a1,
- rtc::scoped_ptr<cricket::PortAllocator> a3,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> a4,
+ std::unique_ptr<cricket::PortAllocator> a3,
+ std::unique_ptr<DtlsIdentityStoreInterface> a4,
PeerConnectionObserver* a5) override {
return signaling_thread_
->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>(
@@ -77,8 +78,8 @@
cricket::PortAllocator* a3,
DtlsIdentityStoreInterface* a4,
PeerConnectionObserver* a5) {
- rtc::scoped_ptr<cricket::PortAllocator> ptr_a3(a3);
- rtc::scoped_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
+ std::unique_ptr<cricket::PortAllocator> ptr_a3(a3);
+ std::unique_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3),
std::move(ptr_a4), a5);
}
@@ -88,8 +89,8 @@
cricket::PortAllocator* a3,
DtlsIdentityStoreInterface* a4,
PeerConnectionObserver* a5) {
- rtc::scoped_ptr<cricket::PortAllocator> ptr_a3(a3);
- rtc::scoped_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
+ std::unique_ptr<cricket::PortAllocator> ptr_a3(a3);
+ std::unique_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
return c_->CreatePeerConnection(a1, std::move(ptr_a3), std::move(ptr_a4),
a5);
}
diff --git a/webrtc/api/peerconnectioninterface.h b/webrtc/api/peerconnectioninterface.h
index 59bc160..94d2c00 100644
--- a/webrtc/api/peerconnectioninterface.h
+++ b/webrtc/api/peerconnectioninterface.h
@@ -51,6 +51,7 @@
#ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_
#define WEBRTC_API_PEERCONNECTIONINTERFACE_H_
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -591,14 +592,14 @@
virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
const MediaConstraintsInterface* constraints,
- rtc::scoped_ptr<cricket::PortAllocator> allocator,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<cricket::PortAllocator> allocator,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) = 0;
virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
- rtc::scoped_ptr<cricket::PortAllocator> allocator,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<cricket::PortAllocator> allocator,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
PeerConnectionObserver* observer) = 0;
virtual rtc::scoped_refptr<MediaStreamInterface>
diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc
index 14a0679..738b736 100644
--- a/webrtc/api/peerconnectioninterface_unittest.cc
+++ b/webrtc/api/peerconnectioninterface_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include <utility>
@@ -32,7 +33,6 @@
#include "webrtc/api/videocapturertracksource.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/gunit.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/ssladapter.h"
#include "webrtc/base/sslstreamadapter.h"
#include "webrtc/base/stringutils.h"
@@ -239,7 +239,6 @@
return; \
}
-using rtc::scoped_ptr;
using rtc::scoped_refptr;
using ::testing::Exactly;
using webrtc::AudioSourceInterface;
@@ -504,7 +503,7 @@
scoped_refptr<PeerConnectionInterface> pc_;
PeerConnectionInterface::SignalingState state_;
- scoped_ptr<IceCandidateInterface> last_candidate_;
+ std::unique_ptr<IceCandidateInterface> last_candidate_;
scoped_refptr<DataChannelInterface> last_datachannel_;
rtc::scoped_refptr<StreamCollection> remote_streams_;
bool renegotiation_needed_ = false;
@@ -551,7 +550,7 @@
config.servers.push_back(server);
}
- rtc::scoped_ptr<cricket::FakePortAllocator> port_allocator(
+ std::unique_ptr<cricket::FakePortAllocator> port_allocator(
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
port_allocator_ = port_allocator.get();
@@ -566,7 +565,7 @@
webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false);
}
- scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store;
+ std::unique_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store;
bool dtls;
if (FindConstraint(constraints,
webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
@@ -668,7 +667,7 @@
observer_.renegotiation_needed_ = false;
}
- bool DoCreateOfferAnswer(rtc::scoped_ptr<SessionDescriptionInterface>* desc,
+ bool DoCreateOfferAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
bool offer,
MediaConstraintsInterface* constraints) {
rtc::scoped_refptr<MockCreateSessionDescriptionObserver>
@@ -684,12 +683,12 @@
return observer->result();
}
- bool DoCreateOffer(rtc::scoped_ptr<SessionDescriptionInterface>* desc,
+ bool DoCreateOffer(std::unique_ptr<SessionDescriptionInterface>* desc,
MediaConstraintsInterface* constraints) {
return DoCreateOfferAnswer(desc, true, constraints);
}
- bool DoCreateAnswer(rtc::scoped_ptr<SessionDescriptionInterface>* desc,
+ bool DoCreateAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
MediaConstraintsInterface* constraints) {
return DoCreateOfferAnswer(desc, false, constraints);
}
@@ -750,7 +749,7 @@
}
void CreateOfferAsRemoteDescription() {
- rtc::scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
std::string sdp;
EXPECT_TRUE(offer->ToString(&sdp));
@@ -770,7 +769,7 @@
}
void CreateAnswerAsLocalDescription() {
- scoped_ptr<SessionDescriptionInterface> answer;
+ std::unique_ptr<SessionDescriptionInterface> answer;
ASSERT_TRUE(DoCreateAnswer(&answer, nullptr));
// TODO(perkj): Currently SetLocalDescription fails if any parameters in an
@@ -790,7 +789,7 @@
}
void CreatePrAnswerAsLocalDescription() {
- scoped_ptr<SessionDescriptionInterface> answer;
+ std::unique_ptr<SessionDescriptionInterface> answer;
ASSERT_TRUE(DoCreateAnswer(&answer, nullptr));
std::string sdp;
@@ -810,7 +809,7 @@
}
void CreateOfferAsLocalDescription() {
- rtc::scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
// TODO(perkj): Currently SetLocalDescription fails if any parameters in an
// audio codec change, even if the parameter has nothing to do with
@@ -880,7 +879,7 @@
// corresponding SessionDescriptionInterface. The SessionDescriptionInterface
// is returned and the MediaStream is stored in
// |reference_collection_|
- rtc::scoped_ptr<SessionDescriptionInterface>
+ std::unique_ptr<SessionDescriptionInterface>
CreateSessionDescriptionAndReference(size_t number_of_audio_tracks,
size_t number_of_video_tracks) {
EXPECT_LE(number_of_audio_tracks, 2u);
@@ -915,7 +914,7 @@
AddVideoTrack(kVideoTracks[1], stream);
}
- return rtc::scoped_ptr<SessionDescriptionInterface>(
+ return std::unique_ptr<SessionDescriptionInterface>(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
sdp_ms1, nullptr));
}
@@ -980,7 +979,7 @@
TEST_F(PeerConnectionInterfaceTest, AddedStreamsPresentInOffer) {
CreatePeerConnection();
AddAudioVideoStream(kStreamLabel1, "audio_track", "video_track");
- scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
const cricket::ContentInfo* audio_content =
@@ -1055,7 +1054,7 @@
EXPECT_EQ(video_track, video_sender->track());
// Now create an offer and check for the senders.
- scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
const cricket::ContentInfo* audio_content =
@@ -1193,13 +1192,13 @@
EXPECT_FALSE(pc_->AddIceCandidate(observer_.last_candidate_.get()));
// SetRemoteDescription takes ownership of offer.
- rtc::scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
AddVideoStream(kStreamLabel1);
EXPECT_TRUE(DoCreateOffer(&offer, nullptr));
EXPECT_TRUE(DoSetRemoteDescription(offer.release()));
// SetLocalDescription takes ownership of answer.
- rtc::scoped_ptr<SessionDescriptionInterface> answer;
+ std::unique_ptr<SessionDescriptionInterface> answer;
EXPECT_TRUE(DoCreateAnswer(&answer, nullptr));
EXPECT_TRUE(DoSetLocalDescription(answer.release()));
@@ -1214,7 +1213,7 @@
TEST_F(PeerConnectionInterfaceTest, CreateOfferAnswerWithInvalidStream) {
CreatePeerConnection();
// Create a regular offer for the CreateAnswer test later.
- rtc::scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
EXPECT_TRUE(DoCreateOffer(&offer, nullptr));
EXPECT_TRUE(offer);
offer.reset();
@@ -1226,7 +1225,7 @@
EXPECT_FALSE(DoCreateOffer(&offer, nullptr));
// Test CreateAnswer
- rtc::scoped_ptr<SessionDescriptionInterface> answer;
+ std::unique_ptr<SessionDescriptionInterface> answer;
EXPECT_FALSE(DoCreateAnswer(&answer, nullptr));
}
@@ -1238,7 +1237,7 @@
AddAudioVideoStream(kStreamLabel1, "audio_label", "video_label");
// Test CreateOffer
- scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
int audio_ssrc = 0;
int video_ssrc = 0;
@@ -1250,7 +1249,7 @@
// Test CreateAnswer
EXPECT_TRUE(DoSetRemoteDescription(offer.release()));
- scoped_ptr<SessionDescriptionInterface> answer;
+ std::unique_ptr<SessionDescriptionInterface> answer;
ASSERT_TRUE(DoCreateAnswer(&answer, nullptr));
audio_ssrc = 0;
video_ssrc = 0;
@@ -1276,7 +1275,7 @@
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
stream->AddTrack(video_track.get());
- scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
const cricket::MediaContentDescription* video_desc =
@@ -1296,7 +1295,7 @@
// Remove the video track.
stream->RemoveTrack(stream->GetVideoTracks()[0]);
- scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
const cricket::MediaContentDescription* video_desc =
@@ -1310,7 +1309,7 @@
CreatePeerConnection();
pc_->CreateSender("video", kStreamLabel1);
- scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
const cricket::MediaContentDescription* video_desc =
@@ -1373,9 +1372,9 @@
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
- rtc::scoped_ptr<MockDataChannelObserver> observer1(
+ std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
- rtc::scoped_ptr<MockDataChannelObserver> observer2(
+ std::unique_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
EXPECT_EQ(DataChannelInterface::kConnecting, data1->state());
@@ -1420,9 +1419,9 @@
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
- rtc::scoped_ptr<MockDataChannelObserver> observer1(
+ std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
- rtc::scoped_ptr<MockDataChannelObserver> observer2(
+ std::unique_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
EXPECT_EQ(DataChannelInterface::kConnecting, data1->state());
@@ -1447,7 +1446,7 @@
CreatePeerConnection(&constraints);
scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
- rtc::scoped_ptr<MockDataChannelObserver> observer1(
+ std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
CreateOfferReceiveAnswerWithoutSsrc();
@@ -1662,9 +1661,9 @@
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
- rtc::scoped_ptr<MockDataChannelObserver> observer1(
+ std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
- rtc::scoped_ptr<MockDataChannelObserver> observer2(
+ std::unique_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
CreateOfferReceiveAnswer();
@@ -1769,7 +1768,7 @@
// At this point we should be receiving stream 1, but not sending anything.
// A new offer should be recvonly.
- rtc::scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
DoCreateOffer(&offer, nullptr);
const cricket::ContentInfo* video_content =
@@ -1801,7 +1800,7 @@
// At this point we should be receiving stream 1, but not sending anything.
// A new offer would be recvonly, but we'll set the "no receive" constraints
// to make it inactive.
- rtc::scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
FakeConstraints offer_constraints;
offer_constraints.AddMandatory(
webrtc::MediaConstraintsInterface::kOfferToReceiveVideo, false);
@@ -1896,9 +1895,9 @@
EXPECT_TRUE(pc_->local_description() != NULL);
EXPECT_TRUE(pc_->remote_description() != NULL);
- rtc::scoped_ptr<SessionDescriptionInterface> offer;
+ std::unique_ptr<SessionDescriptionInterface> offer;
EXPECT_TRUE(DoCreateOffer(&offer, nullptr));
- rtc::scoped_ptr<SessionDescriptionInterface> answer;
+ std::unique_ptr<SessionDescriptionInterface> answer;
EXPECT_TRUE(DoCreateAnswer(&answer, nullptr));
std::string sdp;
@@ -1959,14 +1958,14 @@
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
true);
CreatePeerConnection(&constraints);
- rtc::scoped_ptr<SessionDescriptionInterface> desc_ms1 =
+ std::unique_ptr<SessionDescriptionInterface> desc_ms1 =
CreateSessionDescriptionAndReference(1, 1);
EXPECT_TRUE(DoSetRemoteDescription(desc_ms1.release()));
EXPECT_TRUE(CompareStreamCollections(observer_.remote_streams(),
reference_collection_));
// Add extra audio and video tracks to the same MediaStream.
- rtc::scoped_ptr<SessionDescriptionInterface> desc_ms1_two_tracks =
+ std::unique_ptr<SessionDescriptionInterface> desc_ms1_two_tracks =
CreateSessionDescriptionAndReference(2, 2);
EXPECT_TRUE(DoSetRemoteDescription(desc_ms1_two_tracks.release()));
EXPECT_TRUE(CompareStreamCollections(observer_.remote_streams(),
@@ -1979,7 +1978,7 @@
EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, video_track2->state());
// Remove the extra audio and video tracks.
- rtc::scoped_ptr<SessionDescriptionInterface> desc_ms2 =
+ std::unique_ptr<SessionDescriptionInterface> desc_ms2 =
CreateSessionDescriptionAndReference(1, 1);
MockTrackObserver audio_track_observer(audio_track2);
MockTrackObserver video_track_observer(video_track2);
@@ -2018,7 +2017,7 @@
remote_stream->GetAudioTracks()[0];
EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, remote_audio->state());
- rtc::scoped_ptr<SessionDescriptionInterface> local_answer;
+ std::unique_ptr<SessionDescriptionInterface> local_answer;
EXPECT_TRUE(DoCreateAnswer(&local_answer, nullptr));
cricket::ContentInfo* video_info =
local_answer->description()->GetContentByName("video");
@@ -2028,7 +2027,7 @@
EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, remote_audio->state());
// Now create an offer where we reject both video and audio.
- rtc::scoped_ptr<SessionDescriptionInterface> local_offer;
+ std::unique_ptr<SessionDescriptionInterface> local_offer;
EXPECT_TRUE(DoCreateOffer(&local_offer, nullptr));
video_info = local_offer->description()->GetContentByName("video");
ASSERT_TRUE(video_info != nullptr);
@@ -2057,7 +2056,7 @@
remote_stream->RemoveTrack(remote_stream->GetVideoTracks()[0]);
remote_stream->RemoveTrack(remote_stream->GetAudioTracks()[0]);
- rtc::scoped_ptr<SessionDescriptionInterface> local_answer(
+ std::unique_ptr<SessionDescriptionInterface> local_answer(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kAnswer,
kSdpStringWithStream1, nullptr));
cricket::ContentInfo* video_info =
@@ -2231,10 +2230,10 @@
CreatePeerConnection(&constraints);
// Create an offer just to ensure we have an identity before we manually
// call SetLocalDescription.
- rtc::scoped_ptr<SessionDescriptionInterface> throwaway;
+ std::unique_ptr<SessionDescriptionInterface> throwaway;
ASSERT_TRUE(DoCreateOffer(&throwaway, nullptr));
- rtc::scoped_ptr<SessionDescriptionInterface> desc_1 =
+ std::unique_ptr<SessionDescriptionInterface> desc_1 =
CreateSessionDescriptionAndReference(2, 2);
pc_->AddStream(reference_collection_->at(0));
@@ -2248,7 +2247,7 @@
// Remove an audio and video track.
pc_->RemoveStream(reference_collection_->at(0));
- rtc::scoped_ptr<SessionDescriptionInterface> desc_2 =
+ std::unique_ptr<SessionDescriptionInterface> desc_2 =
CreateSessionDescriptionAndReference(1, 1);
pc_->AddStream(reference_collection_->at(0));
EXPECT_TRUE(DoSetLocalDescription(desc_2.release()));
@@ -2270,10 +2269,10 @@
CreatePeerConnection(&constraints);
// Create an offer just to ensure we have an identity before we manually
// call SetLocalDescription.
- rtc::scoped_ptr<SessionDescriptionInterface> throwaway;
+ std::unique_ptr<SessionDescriptionInterface> throwaway;
ASSERT_TRUE(DoCreateOffer(&throwaway, nullptr));
- rtc::scoped_ptr<SessionDescriptionInterface> desc_1 =
+ std::unique_ptr<SessionDescriptionInterface> desc_1 =
CreateSessionDescriptionAndReference(2, 2);
EXPECT_TRUE(DoSetLocalDescription(desc_1.release()));
@@ -2299,10 +2298,10 @@
CreatePeerConnection(&constraints);
// Create an offer just to ensure we have an identity before we manually
// call SetLocalDescription.
- rtc::scoped_ptr<SessionDescriptionInterface> throwaway;
+ std::unique_ptr<SessionDescriptionInterface> throwaway;
ASSERT_TRUE(DoCreateOffer(&throwaway, nullptr));
- rtc::scoped_ptr<SessionDescriptionInterface> desc =
+ std::unique_ptr<SessionDescriptionInterface> desc =
CreateSessionDescriptionAndReference(1, 1);
std::string sdp;
desc->ToString(&sdp);
@@ -2323,7 +2322,7 @@
ssrc_to = "a=ssrc:98";
rtc::replace_substrs(ssrc_org.c_str(), ssrc_org.length(), ssrc_to.c_str(),
ssrc_to.length(), &sdp);
- rtc::scoped_ptr<SessionDescriptionInterface> updated_desc(
+ std::unique_ptr<SessionDescriptionInterface> updated_desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer, sdp,
nullptr));
@@ -2346,10 +2345,10 @@
CreatePeerConnection(&constraints);
// Create an offer just to ensure we have an identity before we manually
// call SetLocalDescription.
- rtc::scoped_ptr<SessionDescriptionInterface> throwaway;
+ std::unique_ptr<SessionDescriptionInterface> throwaway;
ASSERT_TRUE(DoCreateOffer(&throwaway, nullptr));
- rtc::scoped_ptr<SessionDescriptionInterface> desc =
+ std::unique_ptr<SessionDescriptionInterface> desc =
CreateSessionDescriptionAndReference(1, 1);
std::string sdp;
desc->ToString(&sdp);
@@ -2372,7 +2371,7 @@
rtc::replace_substrs(kStreams[0], strlen(kStreams[0]), kStreams[1],
strlen(kStreams[1]), &sdp);
- rtc::scoped_ptr<SessionDescriptionInterface> updated_desc(
+ std::unique_ptr<SessionDescriptionInterface> updated_desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer, sdp,
nullptr));
diff --git a/webrtc/api/proxy.h b/webrtc/api/proxy.h
index 663e6c8..2df85c4 100644
--- a/webrtc/api/proxy.h
+++ b/webrtc/api/proxy.h
@@ -47,6 +47,8 @@
#ifndef WEBRTC_API_PROXY_H_
#define WEBRTC_API_PROXY_H_
+#include <memory>
+
#include "webrtc/base/event.h"
#include "webrtc/base/thread.h"
@@ -117,7 +119,7 @@
private:
void OnMessage(rtc::Message*) { proxy_->OnMessage(NULL); e_->Set(); }
- rtc::scoped_ptr<rtc::Event> e_;
+ std::unique_ptr<rtc::Event> e_;
rtc::MessageHandler* proxy_;
};
diff --git a/webrtc/api/proxy_unittest.cc b/webrtc/api/proxy_unittest.cc
index 557c85b..931ba28 100644
--- a/webrtc/api/proxy_unittest.cc
+++ b/webrtc/api/proxy_unittest.cc
@@ -10,12 +10,12 @@
#include "webrtc/api/proxy.h"
+#include <memory>
#include <string>
#include "testing/gmock/include/gmock/gmock.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/refcount.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread.h"
using ::testing::_;
@@ -98,7 +98,7 @@
}
protected:
- rtc::scoped_ptr<rtc::Thread> signaling_thread_;
+ std::unique_ptr<rtc::Thread> signaling_thread_;
rtc::scoped_refptr<FakeInterface> fake_signaling_proxy_;
rtc::scoped_refptr<Fake> fake_;
};
@@ -175,7 +175,7 @@
}
protected:
- rtc::scoped_ptr<rtc::Thread> worker_thread_;
+ std::unique_ptr<rtc::Thread> worker_thread_;
rtc::scoped_refptr<FakeInterface> fake_proxy_;
};
diff --git a/webrtc/api/remoteaudiosource.cc b/webrtc/api/remoteaudiosource.cc
index 23cd65c..2d0785a 100644
--- a/webrtc/api/remoteaudiosource.cc
+++ b/webrtc/api/remoteaudiosource.cc
@@ -12,6 +12,7 @@
#include <algorithm>
#include <functional>
+#include <memory>
#include <utility>
#include "webrtc/api/mediastreamprovider.h"
@@ -81,7 +82,7 @@
// we register for callbacks here and not on demand in AddSink.
if (provider) { // May be null in tests.
provider->SetRawAudioSink(
- ssrc, rtc::scoped_ptr<AudioSinkInterface>(new Sink(this)));
+ ssrc, std::unique_ptr<AudioSinkInterface>(new Sink(this)));
}
}
diff --git a/webrtc/api/rtpsender.h b/webrtc/api/rtpsender.h
index 3919e07..fe61cbd 100644
--- a/webrtc/api/rtpsender.h
+++ b/webrtc/api/rtpsender.h
@@ -15,6 +15,7 @@
#ifndef WEBRTC_API_RTPSENDER_H_
#define WEBRTC_API_RTPSENDER_H_
+#include <memory>
#include <string>
#include "webrtc/api/mediastreamprovider.h"
@@ -119,7 +120,7 @@
// Used to pass the data callback from the |track_| to the other end of
// cricket::AudioSource.
- rtc::scoped_ptr<LocalAudioSinkAdapter> sink_adapter_;
+ std::unique_ptr<LocalAudioSinkAdapter> sink_adapter_;
};
class VideoRtpSender : public ObserverInterface,
diff --git a/webrtc/api/rtpsenderreceiver_unittest.cc b/webrtc/api/rtpsenderreceiver_unittest.cc
index 188264e..4cd1425 100644
--- a/webrtc/api/rtpsenderreceiver_unittest.cc
+++ b/webrtc/api/rtpsenderreceiver_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include <utility>
@@ -58,12 +59,12 @@
bool(uint32_t ssrc, const RtpParameters&));
void SetRawAudioSink(uint32_t,
- rtc::scoped_ptr<AudioSinkInterface> sink) override {
+ std::unique_ptr<AudioSinkInterface> sink) override {
sink_ = std::move(sink);
}
private:
- rtc::scoped_ptr<AudioSinkInterface> sink_;
+ std::unique_ptr<AudioSinkInterface> sink_;
};
// Helper class to test RtpSender/RtpReceiver.
diff --git a/webrtc/api/statscollector_unittest.cc b/webrtc/api/statscollector_unittest.cc
index 8effb92..760db0f 100644
--- a/webrtc/api/statscollector_unittest.cc
+++ b/webrtc/api/statscollector_unittest.cc
@@ -33,7 +33,6 @@
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/pc/channelmanager.h"
-using rtc::scoped_ptr;
using testing::_;
using testing::DoAll;
using testing::Field;
@@ -672,7 +671,7 @@
void TestCertificateReports(
const rtc::FakeSSLCertificate& local_cert,
const std::vector<std::string>& local_ders,
- rtc::scoped_ptr<rtc::FakeSSLCertificate> remote_cert,
+ std::unique_ptr<rtc::FakeSSLCertificate> remote_cert,
const std::vector<std::string>& remote_ders) {
StatsCollectorForTest stats(&pc_);
@@ -758,8 +757,8 @@
}
cricket::FakeMediaEngine* media_engine_;
- rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
- rtc::scoped_ptr<webrtc::MediaControllerInterface> media_controller_;
+ std::unique_ptr<cricket::ChannelManager> channel_manager_;
+ std::unique_ptr<webrtc::MediaControllerInterface> media_controller_;
MockWebRtcSession session_;
MockPeerConnection pc_;
FakeDataChannelProvider data_channel_provider_;
@@ -1340,7 +1339,7 @@
remote_ders[1] = "non-";
remote_ders[2] = "intersecting";
remote_ders[3] = "set";
- rtc::scoped_ptr<rtc::FakeSSLCertificate> remote_cert(
+ std::unique_ptr<rtc::FakeSSLCertificate> remote_cert(
new rtc::FakeSSLCertificate(DersToPems(remote_ders)));
TestCertificateReports(local_cert, local_ders, std::move(remote_cert),
@@ -1356,7 +1355,7 @@
// Build remote certificate.
std::string remote_der = "This is somebody else's der.";
- rtc::scoped_ptr<rtc::FakeSSLCertificate> remote_cert(
+ std::unique_ptr<rtc::FakeSSLCertificate> remote_cert(
new rtc::FakeSSLCertificate(DerToPem(remote_der)));
TestCertificateReports(local_cert, std::vector<std::string>(1, local_der),
@@ -1446,7 +1445,7 @@
transport_stats;
// Fake transport object.
- rtc::scoped_ptr<cricket::FakeTransport> transport(
+ std::unique_ptr<cricket::FakeTransport> transport(
new cricket::FakeTransport(transport_stats.transport_name));
// Configure MockWebRtcSession
@@ -1480,7 +1479,7 @@
// Build a remote certificate with an unsupported digest algorithm.
std::string remote_der = "This is somebody else's der.";
- rtc::scoped_ptr<rtc::FakeSSLCertificate> remote_cert(
+ std::unique_ptr<rtc::FakeSSLCertificate> remote_cert(
new rtc::FakeSSLCertificate(DerToPem(remote_der)));
remote_cert->set_digest_algorithm("foobar");
diff --git a/webrtc/api/test/fakeaudiocapturemodule.h b/webrtc/api/test/fakeaudiocapturemodule.h
index 9200bdf..30ad3f8 100644
--- a/webrtc/api/test/fakeaudiocapturemodule.h
+++ b/webrtc/api/test/fakeaudiocapturemodule.h
@@ -20,6 +20,8 @@
#ifndef WEBRTC_API_TEST_FAKEAUDIOCAPTUREMODULE_H_
#define WEBRTC_API_TEST_FAKEAUDIOCAPTUREMODULE_H_
+#include <memory>
+
#include "webrtc/base/basictypes.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/messagehandler.h"
@@ -247,7 +249,7 @@
bool started_;
uint32_t next_frame_time_;
- rtc::scoped_ptr<rtc::Thread> process_thread_;
+ std::unique_ptr<rtc::Thread> process_thread_;
// Buffer for storing samples received from the webrtc::AudioTransport.
char rec_buffer_[kNumberSamples * kNumberBytesPerSample];
diff --git a/webrtc/api/test/mockpeerconnectionobservers.h b/webrtc/api/test/mockpeerconnectionobservers.h
index bd593c2..39a8f01 100644
--- a/webrtc/api/test/mockpeerconnectionobservers.h
+++ b/webrtc/api/test/mockpeerconnectionobservers.h
@@ -13,6 +13,7 @@
#ifndef WEBRTC_API_TEST_MOCKPEERCONNECTIONOBSERVERS_H_
#define WEBRTC_API_TEST_MOCKPEERCONNECTIONOBSERVERS_H_
+#include <memory>
#include <string>
#include "webrtc/api/datachannelinterface.h"
@@ -44,7 +45,7 @@
private:
bool called_;
bool result_;
- rtc::scoped_ptr<SessionDescriptionInterface> desc_;
+ std::unique_ptr<SessionDescriptionInterface> desc_;
};
class MockSetSessionDescriptionObserver
diff --git a/webrtc/api/test/peerconnectiontestwrapper.cc b/webrtc/api/test/peerconnectiontestwrapper.cc
index 038980c..717c48a 100644
--- a/webrtc/api/test/peerconnectiontestwrapper.cc
+++ b/webrtc/api/test/peerconnectiontestwrapper.cc
@@ -55,7 +55,7 @@
bool PeerConnectionTestWrapper::CreatePc(
const MediaConstraintsInterface* constraints) {
- rtc::scoped_ptr<cricket::PortAllocator> port_allocator(
+ std::unique_ptr<cricket::PortAllocator> port_allocator(
new cricket::FakePortAllocator(worker_thread_, nullptr));
fake_audio_capture_module_ = FakeAudioCaptureModule::Create();
@@ -75,9 +75,9 @@
webrtc::PeerConnectionInterface::IceServer ice_server;
ice_server.uri = "stun:stun.l.google.com:19302";
config.servers.push_back(ice_server);
- rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store(
- rtc::SSLStreamAdapter::HaveDtlsSrtp() ?
- new FakeDtlsIdentityStore() : nullptr);
+ std::unique_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store(
+ rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
+ : nullptr);
peer_connection_ = peer_connection_factory_->CreatePeerConnection(
config, constraints, std::move(port_allocator),
std::move(dtls_identity_store), this);
@@ -118,7 +118,7 @@
void PeerConnectionTestWrapper::OnSuccess(SessionDescriptionInterface* desc) {
// This callback should take the ownership of |desc|.
- rtc::scoped_ptr<SessionDescriptionInterface> owned_desc(desc);
+ std::unique_ptr<SessionDescriptionInterface> owned_desc(desc);
std::string sdp;
EXPECT_TRUE(desc->ToString(&sdp));
@@ -183,7 +183,7 @@
void PeerConnectionTestWrapper::AddIceCandidate(const std::string& sdp_mid,
int sdp_mline_index,
const std::string& candidate) {
- rtc::scoped_ptr<webrtc::IceCandidateInterface> owned_candidate(
+ std::unique_ptr<webrtc::IceCandidateInterface> owned_candidate(
webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, candidate, NULL));
EXPECT_TRUE(peer_connection_->AddIceCandidate(owned_candidate.get()));
}
diff --git a/webrtc/api/test/peerconnectiontestwrapper.h b/webrtc/api/test/peerconnectiontestwrapper.h
index f744b57..7a9bea4 100644
--- a/webrtc/api/test/peerconnectiontestwrapper.h
+++ b/webrtc/api/test/peerconnectiontestwrapper.h
@@ -11,6 +11,8 @@
#ifndef WEBRTC_API_TEST_PEERCONNECTIONTESTWRAPPER_H_
#define WEBRTC_API_TEST_PEERCONNECTIONTESTWRAPPER_H_
+#include <memory>
+
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/test/fakeaudiocapturemodule.h"
#include "webrtc/api/test/fakeconstraints.h"
@@ -94,7 +96,7 @@
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
peer_connection_factory_;
rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
- rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer> renderer_;
+ std::unique_ptr<webrtc::FakeVideoTrackRenderer> renderer_;
};
#endif // WEBRTC_API_TEST_PEERCONNECTIONTESTWRAPPER_H_
diff --git a/webrtc/api/videocapturertracksource.h b/webrtc/api/videocapturertracksource.h
index 2eb7b50..fa4ef07 100644
--- a/webrtc/api/videocapturertracksource.h
+++ b/webrtc/api/videocapturertracksource.h
@@ -11,6 +11,8 @@
#ifndef WEBRTC_API_VIDEOCAPTURERTRACKSOURCE_H_
#define WEBRTC_API_VIDEOCAPTURERTRACKSOURCE_H_
+#include <memory>
+
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/videotracksource.h"
#include "webrtc/base/asyncinvoker.h"
@@ -73,7 +75,7 @@
rtc::Thread* signaling_thread_;
rtc::Thread* worker_thread_;
rtc::AsyncInvoker invoker_;
- rtc::scoped_ptr<cricket::VideoCapturer> video_capturer_;
+ std::unique_ptr<cricket::VideoCapturer> video_capturer_;
bool started_;
cricket::VideoFormat format_;
rtc::Optional<bool> needs_denoising_;
diff --git a/webrtc/api/videocapturertracksource_unittest.cc b/webrtc/api/videocapturertracksource_unittest.cc
index 6b0d07b..90d2cd2 100644
--- a/webrtc/api/videocapturertracksource_unittest.cc
+++ b/webrtc/api/videocapturertracksource_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include <vector>
@@ -109,7 +110,7 @@
protected:
VideoCapturerTrackSourceTest() { InitCapturer(false); }
void InitCapturer(bool is_screencast) {
- capturer_cleanup_ = rtc::scoped_ptr<TestVideoCapturer>(
+ capturer_cleanup_ = std::unique_ptr<TestVideoCapturer>(
new TestVideoCapturer(is_screencast));
capturer_ = capturer_cleanup_.get();
}
@@ -132,10 +133,10 @@
source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants());
}
- rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_;
+ std::unique_ptr<TestVideoCapturer> capturer_cleanup_;
TestVideoCapturer* capturer_;
cricket::FakeVideoRenderer renderer_;
- rtc::scoped_ptr<StateObserver> state_observer_;
+ std::unique_ptr<StateObserver> state_observer_;
rtc::scoped_refptr<VideoTrackSourceInterface> source_;
};
diff --git a/webrtc/api/videotrack_unittest.cc b/webrtc/api/videotrack_unittest.cc
index b1cd0a6..0b67c77 100644
--- a/webrtc/api/videotrack_unittest.cc
+++ b/webrtc/api/videotrack_unittest.cc
@@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <string>
#include "webrtc/api/test/fakevideotrackrenderer.h"
#include "webrtc/api/videocapturertracksource.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/gunit.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/media/base/fakevideocapturer.h"
#include "webrtc/media/base/fakemediaengine.h"
#include "webrtc/media/engine/webrtcvideoframe.h"
@@ -55,14 +55,14 @@
// frames to the source.
TEST_F(VideoTrackTest, RenderVideo) {
// FakeVideoTrackRenderer register itself to |video_track_|
- rtc::scoped_ptr<FakeVideoTrackRenderer> renderer_1(
+ std::unique_ptr<FakeVideoTrackRenderer> renderer_1(
new FakeVideoTrackRenderer(video_track_.get()));
capturer_.CaptureFrame();
EXPECT_EQ(1, renderer_1->num_rendered_frames());
// FakeVideoTrackRenderer register itself to |video_track_|
- rtc::scoped_ptr<FakeVideoTrackRenderer> renderer_2(
+ std::unique_ptr<FakeVideoTrackRenderer> renderer_2(
new FakeVideoTrackRenderer(video_track_.get()));
capturer_.CaptureFrame();
EXPECT_EQ(2, renderer_1->num_rendered_frames());
@@ -75,7 +75,7 @@
// Test that disabling the track results in blacked out frames.
TEST_F(VideoTrackTest, DisableTrackBlackout) {
- rtc::scoped_ptr<FakeVideoTrackRenderer> renderer(
+ std::unique_ptr<FakeVideoTrackRenderer> renderer(
new FakeVideoTrackRenderer(video_track_.get()));
capturer_.CaptureFrame();
diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc
index 10f9922..b86d903 100644
--- a/webrtc/api/webrtcsdp.cc
+++ b/webrtc/api/webrtcsdp.cc
@@ -13,7 +13,9 @@
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
+
#include <algorithm>
+#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
@@ -2307,7 +2309,7 @@
session_td.ice_mode, session_td.connection_role,
session_td.identity_fingerprint.get());
- rtc::scoped_ptr<MediaContentDescription> content;
+ std::unique_ptr<MediaContentDescription> content;
std::string content_name;
if (HasAttribute(line, kMediaTypeVideo)) {
content.reset(ParseContentDescription<VideoContentDescription>(
diff --git a/webrtc/api/webrtcsdp_unittest.cc b/webrtc/api/webrtcsdp_unittest.cc
index f222b3f..4bc84fd 100644
--- a/webrtc/api/webrtcsdp_unittest.cc
+++ b/webrtc/api/webrtcsdp_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -20,7 +21,6 @@
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/messagedigest.h"
-#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/sslfingerprint.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
@@ -1394,8 +1394,7 @@
}
void AddSctpDataChannel() {
- rtc::scoped_ptr<DataContentDescription> data(
- new DataContentDescription());
+ std::unique_ptr<DataContentDescription> data(new DataContentDescription());
data_desc_ = data.get();
data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp);
DataCodec codec(cricket::kGoogleSctpDataCodecId,
@@ -1408,8 +1407,7 @@
}
void AddRtpDataChannel() {
- rtc::scoped_ptr<DataContentDescription> data(
- new DataContentDescription());
+ std::unique_ptr<DataContentDescription> data(new DataContentDescription());
data_desc_ = data.get();
data_desc_->AddCodec(DataCodec(101, "google-data"));
@@ -1679,7 +1677,7 @@
VideoContentDescription* video_desc_;
DataContentDescription* data_desc_;
Candidates candidates_;
- rtc::scoped_ptr<IceCandidateInterface> jcandidate_;
+ std::unique_ptr<IceCandidateInterface> jcandidate_;
JsepSessionDescription jdesc_;
};
@@ -2082,8 +2080,8 @@
"", "", LOCAL_PORT_TYPE, kCandidateGeneration,
kCandidateFoundation1);
candidate.set_tcptype(cricket::TCPTYPE_ACTIVE_STR);
- rtc::scoped_ptr<IceCandidateInterface> jcandidate(
- new JsepIceCandidate(std::string("audio_content_name"), 0, candidate));
+ std::unique_ptr<IceCandidateInterface> jcandidate(
+ new JsepIceCandidate(std::string("audio_content_name"), 0, candidate));
std::string message = webrtc::SdpSerializeCandidate(*jcandidate);
EXPECT_EQ(std::string(kSdpTcpActiveCandidate), message);
@@ -2405,8 +2403,8 @@
rtc::SocketAddress("192.168.1.5", 9), kCandidatePriority,
"", "", LOCAL_PORT_TYPE, kCandidateGeneration,
kCandidateFoundation1);
- rtc::scoped_ptr<IceCandidateInterface> jcandidate_template(
- new JsepIceCandidate(std::string("audio_content_name"), 0, candidate));
+ std::unique_ptr<IceCandidateInterface> jcandidate_template(
+ new JsepIceCandidate(std::string("audio_content_name"), 0, candidate));
EXPECT_TRUE(jcandidate.candidate().IsEquivalent(
jcandidate_template->candidate()));
sdp = kSdpTcpPassiveCandidate;
diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc
index 1cf7924..9f84840 100644
--- a/webrtc/api/webrtcsession.cc
+++ b/webrtc/api/webrtcsession.cc
@@ -528,7 +528,7 @@
bool WebRtcSession::Initialize(
const PeerConnectionFactoryInterface::Options& options,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
const PeerConnectionInterface::RTCConfiguration& rtc_configuration) {
bundle_policy_ = rtc_configuration.bundle_policy;
rtcp_mux_policy_ = rtc_configuration.rtcp_mux_policy;
@@ -675,7 +675,7 @@
ASSERT(signaling_thread()->IsCurrent());
// Takes the ownership of |desc| regardless of the result.
- rtc::scoped_ptr<SessionDescriptionInterface> desc_temp(desc);
+ std::unique_ptr<SessionDescriptionInterface> desc_temp(desc);
// Validate SDP.
if (!ValidateSessionDescription(desc, cricket::CS_LOCAL, err_desc)) {
@@ -731,14 +731,14 @@
ASSERT(signaling_thread()->IsCurrent());
// Takes the ownership of |desc| regardless of the result.
- rtc::scoped_ptr<SessionDescriptionInterface> desc_temp(desc);
+ std::unique_ptr<SessionDescriptionInterface> desc_temp(desc);
// Validate SDP.
if (!ValidateSessionDescription(desc, cricket::CS_REMOTE, err_desc)) {
return false;
}
- rtc::scoped_ptr<SessionDescriptionInterface> old_remote_desc(
+ std::unique_ptr<SessionDescriptionInterface> old_remote_desc(
remote_desc_.release());
remote_desc_.reset(desc_temp.release());
@@ -1236,7 +1236,7 @@
}
void WebRtcSession::SetRawAudioSink(uint32_t ssrc,
- rtc::scoped_ptr<AudioSinkInterface> sink) {
+ std::unique_ptr<AudioSinkInterface> sink) {
ASSERT(signaling_thread()->IsCurrent());
if (!voice_channel_)
return;
diff --git a/webrtc/api/webrtcsession.h b/webrtc/api/webrtcsession.h
index 08938fc..89b77bb 100644
--- a/webrtc/api/webrtcsession.h
+++ b/webrtc/api/webrtcsession.h
@@ -153,7 +153,7 @@
bool Initialize(
const PeerConnectionFactoryInterface::Options& options,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
// Deletes the voice, video and data channel and changes the session state
// to STATE_CLOSED.
@@ -244,7 +244,7 @@
cricket::AudioSource* source) override;
void SetAudioPlayoutVolume(uint32_t ssrc, double volume) override;
void SetRawAudioSink(uint32_t ssrc,
- rtc::scoped_ptr<AudioSinkInterface> sink) override;
+ std::unique_ptr<AudioSinkInterface> sink) override;
RtpParameters GetAudioRtpParameters(uint32_t ssrc) const override;
bool SetAudioRtpParameters(uint32_t ssrc,
@@ -479,17 +479,17 @@
const std::string sid_;
bool initial_offerer_ = false;
- rtc::scoped_ptr<cricket::TransportController> transport_controller_;
+ std::unique_ptr<cricket::TransportController> transport_controller_;
MediaControllerInterface* media_controller_;
- rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_;
- rtc::scoped_ptr<cricket::VideoChannel> video_channel_;
- rtc::scoped_ptr<cricket::DataChannel> data_channel_;
+ std::unique_ptr<cricket::VoiceChannel> voice_channel_;
+ std::unique_ptr<cricket::VideoChannel> video_channel_;
+ std::unique_ptr<cricket::DataChannel> data_channel_;
cricket::ChannelManager* channel_manager_;
IceObserver* ice_observer_;
PeerConnectionInterface::IceConnectionState ice_connection_state_;
bool ice_connection_receiving_;
- rtc::scoped_ptr<SessionDescriptionInterface> local_desc_;
- rtc::scoped_ptr<SessionDescriptionInterface> remote_desc_;
+ std::unique_ptr<SessionDescriptionInterface> local_desc_;
+ std::unique_ptr<SessionDescriptionInterface> remote_desc_;
// If the remote peer is using a older version of implementation.
bool older_version_remote_peer_;
bool dtls_enabled_;
@@ -504,8 +504,7 @@
// List of content names for which the remote side triggered an ICE restart.
std::set<std::string> pending_ice_restarts_;
- rtc::scoped_ptr<WebRtcSessionDescriptionFactory>
- webrtc_session_desc_factory_;
+ std::unique_ptr<WebRtcSessionDescriptionFactory> webrtc_session_desc_factory_;
// Member variables for caching global options.
cricket::AudioOptions audio_options_;
diff --git a/webrtc/api/webrtcsession_unittest.cc b/webrtc/api/webrtcsession_unittest.cc
index 4cb6cc4..24e830e 100644
--- a/webrtc/api/webrtcsession_unittest.cc
+++ b/webrtc/api/webrtcsession_unittest.cc
@@ -56,7 +56,6 @@
using cricket::FakeVoiceMediaChannel;
using cricket::TransportInfo;
using rtc::SocketAddress;
-using rtc::scoped_ptr;
using rtc::Thread;
using webrtc::CreateSessionDescription;
using webrtc::CreateSessionDescriptionObserver;
@@ -298,7 +297,7 @@
~WebRtcSessionCreateSDPObserverForTest() {}
private:
- rtc::scoped_ptr<SessionDescriptionInterface> description_;
+ std::unique_ptr<SessionDescriptionInterface> description_;
State state_;
};
@@ -376,7 +375,7 @@
// used if provided, otherwise one will be generated using the
// |dtls_identity_store|.
void Init(
- rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) {
+ std::unique_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) {
ASSERT_TRUE(session_.get() == NULL);
session_.reset(new WebRtcSessionForTest(
media_controller_.get(), rtc::Thread::Current(), rtc::Thread::Current(),
@@ -428,7 +427,7 @@
// Successfully init with DTLS; with a certificate generated and supplied or
// with a store that generates it for us.
void InitWithDtls(RTCCertificateGenerationMethod cert_gen_method) {
- rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store;
+ std::unique_ptr<FakeDtlsIdentityStore> dtls_identity_store;
if (cert_gen_method == ALREADY_GENERATED) {
configuration_.certificates.push_back(
FakeDtlsIdentityStore::GenerateCertificate());
@@ -443,7 +442,7 @@
// Init with DTLS with a store that will fail to generate a certificate.
void InitWithDtlsIdentityGenFail() {
- rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
+ std::unique_ptr<FakeDtlsIdentityStore> dtls_identity_store(
new FakeDtlsIdentityStore());
dtls_identity_store->set_should_fail(true);
Init(std::move(dtls_identity_store));
@@ -727,12 +726,12 @@
cricket::MediaSessionOptions options;
options.recv_video = true;
options.bundle_enabled = true;
- scoped_ptr<JsepSessionDescription> offer(
+ std::unique_ptr<JsepSessionDescription> offer(
CreateRemoteOffer(options, cricket::SEC_REQUIRED));
ASSERT_TRUE(offer.get() != NULL);
VerifyCryptoParams(offer->description());
SetRemoteDescriptionWithoutError(offer.release());
- scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
ASSERT_TRUE(answer.get() != NULL);
VerifyCryptoParams(answer->description());
}
@@ -931,7 +930,7 @@
options.recv_video = true;
options.bundle_enabled = true;
- rtc::scoped_ptr<SessionDescriptionInterface> temp_offer(
+ std::unique_ptr<SessionDescriptionInterface> temp_offer(
CreateRemoteOffer(options, cricket::SEC_ENABLED));
*nodtls_answer =
@@ -1070,7 +1069,7 @@
// and answer.
SetLocalDescriptionWithoutError(offer);
- rtc::scoped_ptr<SessionDescriptionInterface> answer(
+ std::unique_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(session_->local_description()));
std::string sdp;
EXPECT_TRUE(answer->ToString(&sdp));
@@ -1371,8 +1370,8 @@
SetFactoryDtlsSrtp();
if (type == CreateSessionDescriptionRequest::kAnswer) {
cricket::MediaSessionOptions options;
- scoped_ptr<JsepSessionDescription> offer(
- CreateRemoteOffer(options, cricket::SEC_DISABLED));
+ std::unique_ptr<JsepSessionDescription> offer(
+ CreateRemoteOffer(options, cricket::SEC_DISABLED));
ASSERT_TRUE(offer.get() != NULL);
SetRemoteDescriptionWithoutError(offer.release());
}
@@ -1418,23 +1417,23 @@
cricket::FakeMediaEngine* media_engine_;
cricket::FakeDataEngine* data_engine_;
- rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
+ std::unique_ptr<cricket::ChannelManager> channel_manager_;
cricket::FakeCall fake_call_;
- rtc::scoped_ptr<webrtc::MediaControllerInterface> media_controller_;
- rtc::scoped_ptr<cricket::TransportDescriptionFactory> tdesc_factory_;
- rtc::scoped_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_;
- rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
- rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
- rtc::scoped_ptr<rtc::FirewallSocketServer> fss_;
+ std::unique_ptr<webrtc::MediaControllerInterface> media_controller_;
+ std::unique_ptr<cricket::TransportDescriptionFactory> tdesc_factory_;
+ std::unique_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_;
+ std::unique_ptr<rtc::PhysicalSocketServer> pss_;
+ std::unique_ptr<rtc::VirtualSocketServer> vss_;
+ std::unique_ptr<rtc::FirewallSocketServer> fss_;
rtc::SocketServerScope ss_scope_;
rtc::SocketAddress stun_socket_addr_;
- rtc::scoped_ptr<cricket::TestStunServer> stun_server_;
+ std::unique_ptr<cricket::TestStunServer> stun_server_;
cricket::TestTurnServer turn_server_;
rtc::FakeNetworkManager network_manager_;
- rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_;
+ std::unique_ptr<cricket::BasicPortAllocator> allocator_;
PeerConnectionFactoryInterface::Options options_;
PeerConnectionInterface::RTCConfiguration configuration_;
- rtc::scoped_ptr<WebRtcSessionForTest> session_;
+ std::unique_ptr<WebRtcSessionForTest> session_;
MockIceObserver observer_;
cricket::FakeVideoMediaChannel* video_channel_;
cricket::FakeVoiceMediaChannel* voice_channel_;
@@ -1872,7 +1871,7 @@
SessionDescriptionInterface* offer = CreateOffer();
cricket::MediaSessionOptions options;
options.recv_video = true;
- rtc::scoped_ptr<SessionDescriptionInterface> temp_offer(
+ std::unique_ptr<SessionDescriptionInterface> temp_offer(
CreateRemoteOffer(options, cricket::SEC_ENABLED));
JsepSessionDescription* answer =
CreateRemoteAnswer(temp_offer.get(), options, cricket::SEC_ENABLED);
@@ -2098,7 +2097,7 @@
TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) {
Init();
SendNothing();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
SessionDescriptionInterface* answer =
CreateRemoteAnswer(offer.get());
@@ -2109,7 +2108,7 @@
TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) {
Init();
SendNothing();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
SessionDescriptionInterface* answer =
CreateRemoteAnswer(offer.get());
@@ -2348,7 +2347,7 @@
EXPECT_TRUE_WAIT(0u < observer_.mline_0_candidates_.size(),
kIceCandidatesTimeout);
- rtc::scoped_ptr<SessionDescriptionInterface> local_offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> local_offer(CreateOffer());
ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL);
EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count());
@@ -2366,7 +2365,7 @@
TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
Init();
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
// CreateOffer creates session description with the content names "audio" and
// "video". Goal is to modify these content names and verify transport
@@ -2415,7 +2414,7 @@
// the send streams when no constraints have been set.
TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) {
Init();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
ASSERT_TRUE(offer != NULL);
const cricket::ContentInfo* content =
@@ -2431,7 +2430,7 @@
Init();
// Test Audio only offer.
SendAudioOnlyStream2();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
@@ -2456,8 +2455,7 @@
options.offer_to_receive_audio = 0;
options.offer_to_receive_video = 0;
- rtc::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(options));
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer(options));
ASSERT_TRUE(offer != NULL);
const cricket::ContentInfo* content =
@@ -2475,8 +2473,7 @@
options.offer_to_receive_audio =
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
- rtc::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(options));
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer(options));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
@@ -2496,8 +2493,7 @@
options.offer_to_receive_video =
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
- rtc::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(options));
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer(options));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
@@ -2534,9 +2530,9 @@
TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraintsOrStreams) {
Init();
// Create a remote offer with audio and video content.
- rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
ASSERT_TRUE(content != NULL);
@@ -2554,13 +2550,12 @@
// Create a remote offer with audio only.
cricket::MediaSessionOptions options;
- rtc::scoped_ptr<JsepSessionDescription> offer(
- CreateRemoteOffer(options));
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer(options));
ASSERT_TRUE(cricket::GetFirstVideoContent(offer->description()) == NULL);
ASSERT_TRUE(cricket::GetFirstAudioContent(offer->description()) != NULL);
SetRemoteDescriptionWithoutError(offer.release());
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
ASSERT_TRUE(content != NULL);
@@ -2574,11 +2569,11 @@
TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) {
Init();
// Create a remote offer with audio and video content.
- rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
// Test with a stream with tracks.
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
ASSERT_TRUE(content != NULL);
@@ -2594,13 +2589,13 @@
TEST_F(WebRtcSessionTest, CreateAnswerWithConstraintsWithoutStreams) {
Init();
// Create a remote offer with audio and video content.
- rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
cricket::MediaSessionOptions session_options;
session_options.recv_audio = false;
session_options.recv_video = false;
- rtc::scoped_ptr<SessionDescriptionInterface> answer(
+ std::unique_ptr<SessionDescriptionInterface> answer(
CreateAnswer(session_options));
const cricket::ContentInfo* content =
@@ -2618,7 +2613,7 @@
TEST_F(WebRtcSessionTest, CreateAnswerWithConstraints) {
Init();
// Create a remote offer with audio and video content.
- rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
cricket::MediaSessionOptions options;
@@ -2627,7 +2622,7 @@
// Test with a stream with tracks.
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(options));
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer(options));
// TODO(perkj): Should the direction be set to SEND_ONLY?
const cricket::ContentInfo* content =
@@ -2649,8 +2644,7 @@
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
options.voice_activity_detection = false;
- rtc::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(options));
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer(options));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
@@ -2662,12 +2656,12 @@
AddCNCodecs();
Init();
// Create a remote offer with audio and video content.
- rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
cricket::MediaSessionOptions options;
options.vad_enabled = false;
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(options));
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer(options));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
ASSERT_TRUE(content != NULL);
@@ -2789,10 +2783,10 @@
TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) {
Init();
SendAudioVideoStream1();
- scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
VerifyCryptoParams(offer->description());
SetRemoteDescriptionWithoutError(offer.release());
- scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
VerifyCryptoParams(answer->description());
}
@@ -2800,7 +2794,7 @@
options_.disable_encryption = true;
Init();
SendAudioVideoStream1();
- scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
VerifyNoCryptoParams(offer->description(), false);
}
@@ -2819,7 +2813,7 @@
TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) {
Init();
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
std::string sdp;
RemoveIceUfragPwdLines(offer.get(), &sdp);
@@ -2832,7 +2826,7 @@
// no a=ice-ufrag and a=ice-pwd lines are present in the SDP.
TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) {
Init();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
std::string sdp;
RemoveIceUfragPwdLines(offer.get(), &sdp);
SessionDescriptionInterface* modified_offer =
@@ -2845,7 +2839,7 @@
TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) {
Init();
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
// Modifying ice ufrag and pwd in local offer with strings smaller than the
// recommended values of 4 and 22 bytes respectively.
SetIceUfragPwd(offer.get(), "ice", "icepwd");
@@ -2862,7 +2856,7 @@
// too short ice ufrag and pwd strings.
TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionInvalidIceCredentials) {
Init();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
// Modifying ice ufrag and pwd in remote offer with strings smaller than the
// recommended values of 4 and 22 bytes respectively.
SetIceUfragPwd(offer.get(), "ice", "icepwd");
@@ -2880,7 +2874,7 @@
Init();
// Create the first offer.
- scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
SetIceUfragPwd(offer.get(), "0123456789012345", "abcdefghijklmnopqrstuvwx");
cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000),
0, "", "", "relay", 0, "");
@@ -2925,7 +2919,7 @@
SetLocalDescriptionWithoutError(offer);
// Create the first answer.
- scoped_ptr<JsepSessionDescription> answer(CreateRemoteAnswer(offer));
+ std::unique_ptr<JsepSessionDescription> answer(CreateRemoteAnswer(offer));
answer->set_type(JsepSessionDescription::kPrAnswer);
SetIceUfragPwd(answer.get(), "0123456789012345", "abcdefghijklmnopqrstuvwx");
cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000),
@@ -3092,7 +3086,7 @@
SendAudioVideoStream2();
// Remove BUNDLE from the answer.
- rtc::scoped_ptr<SessionDescriptionInterface> answer(
+ std::unique_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(session_->local_description()));
cricket::SessionDescription* answer_copy = answer->description()->Copy();
answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
@@ -3178,7 +3172,7 @@
SendAudioVideoStream2();
// Remove BUNDLE from the answer.
- rtc::scoped_ptr<SessionDescriptionInterface> answer(
+ std::unique_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(session_->local_description()));
cricket::SessionDescription* answer_copy = answer->description()->Copy();
answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
@@ -3216,7 +3210,7 @@
SendAudioVideoStream1();
// Remove BUNDLE from the offer.
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
cricket::SessionDescription* offer_copy = offer->description()->Copy();
offer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
JsepSessionDescription* modified_offer =
@@ -3269,7 +3263,7 @@
SendAudioVideoStream2();
// Remove BUNDLE from the answer.
- rtc::scoped_ptr<SessionDescriptionInterface> answer(
+ std::unique_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(session_->local_description()));
cricket::SessionDescription* answer_copy = answer->description()->Copy();
answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
@@ -3427,7 +3421,7 @@
cricket::AudioOptions options;
options.echo_cancellation = rtc::Optional<bool>(true);
- rtc::scoped_ptr<FakeAudioSource> source(new FakeAudioSource());
+ std::unique_ptr<FakeAudioSource> source(new FakeAudioSource());
session_->SetAudioSend(send_ssrc, false, options, source.get());
EXPECT_TRUE(channel->IsStreamMuted(send_ssrc));
EXPECT_EQ(rtc::Optional<bool>(), channel->options().echo_cancellation);
@@ -3449,7 +3443,7 @@
ASSERT_EQ(1u, channel->send_streams().size());
uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
- rtc::scoped_ptr<FakeAudioSource> source(new FakeAudioSource());
+ std::unique_ptr<FakeAudioSource> source(new FakeAudioSource());
cricket::AudioOptions options;
session_->SetAudioSend(send_ssrc, true, options, source.get());
EXPECT_TRUE(source->sink() != nullptr);
@@ -3589,7 +3583,7 @@
SendAudioVideoStream1();
SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
- rtc::scoped_ptr<SessionDescriptionInterface> answer(
+ std::unique_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(session_->local_description()));
cricket::SessionDescription* answer_copy = answer->description()->Copy();
@@ -3686,7 +3680,7 @@
TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) {
Init();
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
// Making sure SetLocalDescription correctly sets crypto value in
// SessionDescription object after de-serialization of sdp string. The value
@@ -3705,7 +3699,7 @@
options_.disable_encryption = true;
Init();
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
// Making sure SetLocalDescription correctly sets crypto value in
// SessionDescription object after de-serialization of sdp string. The value
@@ -3725,12 +3719,11 @@
Init();
cricket::MediaSessionOptions options;
options.recv_video = true;
- rtc::scoped_ptr<JsepSessionDescription> offer(
- CreateRemoteOffer(options));
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer(options));
SetRemoteDescriptionWithoutError(offer.release());
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
SetLocalDescriptionWithoutError(answer.release());
// Receive an offer with new ufrag and password.
@@ -3738,18 +3731,18 @@
session_->local_description()->description()->contents()) {
options.transport_options[content.name].ice_restart = true;
}
- rtc::scoped_ptr<JsepSessionDescription> updated_offer1(
+ std::unique_ptr<JsepSessionDescription> updated_offer1(
CreateRemoteOffer(options, session_->remote_description()));
SetRemoteDescriptionWithoutError(updated_offer1.release());
- rtc::scoped_ptr<SessionDescriptionInterface> updated_answer1(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> updated_answer1(CreateAnswer());
EXPECT_FALSE(IceUfragPwdEqual(updated_answer1->description(),
session_->local_description()->description()));
// Even a second answer (created before the description is set) should have
// a new ufrag/password.
- rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> updated_answer2(CreateAnswer());
EXPECT_FALSE(IceUfragPwdEqual(updated_answer2->description(),
session_->local_description()->description()));
@@ -3768,34 +3761,34 @@
options.recv_audio = true;
options.recv_video = true;
// Create an offer with audio and video.
- rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer(options));
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer(options));
SetIceUfragPwd(offer.get(), "original_ufrag", "original_password12345");
SetRemoteDescriptionWithoutError(offer.release());
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
SetLocalDescriptionWithoutError(answer.release());
// Receive an offer with a new ufrag but stale password.
- rtc::scoped_ptr<JsepSessionDescription> ufrag_changed_offer(
+ std::unique_ptr<JsepSessionDescription> ufrag_changed_offer(
CreateRemoteOffer(options, session_->remote_description()));
SetIceUfragPwd(ufrag_changed_offer.get(), "modified_ufrag",
"original_password12345");
SetRemoteDescriptionWithoutError(ufrag_changed_offer.release());
- rtc::scoped_ptr<SessionDescriptionInterface> updated_answer1(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> updated_answer1(CreateAnswer());
EXPECT_FALSE(IceUfragPwdEqual(updated_answer1->description(),
session_->local_description()->description()));
SetLocalDescriptionWithoutError(updated_answer1.release());
// Receive an offer with a new password but stale ufrag.
- rtc::scoped_ptr<JsepSessionDescription> password_changed_offer(
+ std::unique_ptr<JsepSessionDescription> password_changed_offer(
CreateRemoteOffer(options, session_->remote_description()));
SetIceUfragPwd(password_changed_offer.get(), "modified_ufrag",
"modified_password12345");
SetRemoteDescriptionWithoutError(password_changed_offer.release());
- rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> updated_answer2(CreateAnswer());
EXPECT_FALSE(IceUfragPwdEqual(updated_answer2->description(),
session_->local_description()->description()));
SetLocalDescriptionWithoutError(updated_answer2.release());
@@ -3807,20 +3800,19 @@
Init();
cricket::MediaSessionOptions options;
options.recv_video = true;
- rtc::scoped_ptr<JsepSessionDescription> offer(
- CreateRemoteOffer(options));
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer(options));
SetRemoteDescriptionWithoutError(offer.release());
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
SetLocalDescriptionWithoutError(answer.release());
// Receive an offer without changed ufrag or password.
- rtc::scoped_ptr<JsepSessionDescription> updated_offer2(
+ std::unique_ptr<JsepSessionDescription> updated_offer2(
CreateRemoteOffer(options, session_->remote_description()));
SetRemoteDescriptionWithoutError(updated_offer2.release());
- rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> updated_answer2(CreateAnswer());
EXPECT_TRUE(IceUfragPwdEqual(updated_answer2->description(),
session_->local_description()->description()));
@@ -3837,7 +3829,7 @@
options.recv_video = true;
options.recv_audio = true;
options.bundle_enabled = false;
- rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer(options));
+ std::unique_ptr<JsepSessionDescription> offer(CreateRemoteOffer(options));
SetIceUfragPwd(offer.get(), cricket::MEDIA_TYPE_AUDIO, "aaaa",
"aaaaaaaaaaaaaaaaaaaaaa");
@@ -3846,18 +3838,18 @@
SetRemoteDescriptionWithoutError(offer.release());
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
SetLocalDescriptionWithoutError(answer.release());
// Receive an offer with new ufrag and password, but only for the video media
// section.
- rtc::scoped_ptr<JsepSessionDescription> updated_offer(
+ std::unique_ptr<JsepSessionDescription> updated_offer(
CreateRemoteOffer(options, session_->remote_description()));
SetIceUfragPwd(updated_offer.get(), cricket::MEDIA_TYPE_VIDEO, "cccc",
"cccccccccccccccccccccc");
SetRemoteDescriptionWithoutError(updated_offer.release());
- rtc::scoped_ptr<SessionDescriptionInterface> updated_answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> updated_answer(CreateAnswer());
EXPECT_TRUE(IceUfragPwdEqual(updated_answer->description(),
session_->local_description()->description(),
@@ -3950,7 +3942,7 @@
InitWithDtls(GetParam());
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL);
EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL);
}
@@ -3968,7 +3960,7 @@
SetRemoteDescriptionWithoutError(offer);
// Verifies the answer contains SCTP.
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
EXPECT_TRUE(answer != NULL);
EXPECT_TRUE(answer->description()->GetContentByName("data") != NULL);
EXPECT_TRUE(answer->description()->GetTransportInfoByName("data") != NULL);
@@ -4100,7 +4092,7 @@
EXPECT_TRUE(session_->waiting_for_certificate_for_testing());
SendAudioVideoStream1();
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
EXPECT_TRUE(offer != NULL);
VerifyNoCryptoParams(offer->description(), true);
@@ -4117,12 +4109,12 @@
cricket::MediaSessionOptions options;
options.recv_video = true;
- scoped_ptr<JsepSessionDescription> offer(
- CreateRemoteOffer(options, cricket::SEC_DISABLED));
+ std::unique_ptr<JsepSessionDescription> offer(
+ CreateRemoteOffer(options, cricket::SEC_DISABLED));
ASSERT_TRUE(offer.get() != NULL);
SetRemoteDescriptionWithoutError(offer.release());
- rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer());
+ std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
EXPECT_TRUE(answer != NULL);
VerifyNoCryptoParams(answer->description(), true);
VerifyFingerprintStatus(answer->description(), true);
@@ -4137,7 +4129,7 @@
EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000);
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
EXPECT_TRUE(offer != NULL);
}
@@ -4149,7 +4141,7 @@
EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000);
- rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+ std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
EXPECT_TRUE(offer == NULL);
}
diff --git a/webrtc/api/webrtcsessiondescriptionfactory.cc b/webrtc/api/webrtcsessiondescriptionfactory.cc
index 584125f..e88262f 100644
--- a/webrtc/api/webrtcsessiondescriptionfactory.cc
+++ b/webrtc/api/webrtcsessiondescriptionfactory.cc
@@ -64,7 +64,7 @@
rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserver> observer;
std::string error;
- rtc::scoped_ptr<webrtc::SessionDescriptionInterface> description;
+ std::unique_ptr<webrtc::SessionDescriptionInterface> description;
};
} // namespace
@@ -127,7 +127,7 @@
WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
const rtc::scoped_refptr<WebRtcIdentityRequestObserver>&
identity_request_observer,
WebRtcSession* session,
@@ -168,7 +168,7 @@
WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
WebRtcSession* session,
const std::string& session_id)
: WebRtcSessionDescriptionFactory(
diff --git a/webrtc/api/webrtcsessiondescriptionfactory.h b/webrtc/api/webrtcsessiondescriptionfactory.h
index 8d04bf1..17e2ddd 100644
--- a/webrtc/api/webrtcsessiondescriptionfactory.h
+++ b/webrtc/api/webrtcsessiondescriptionfactory.h
@@ -85,7 +85,7 @@
WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
WebRtcSession* session,
const std::string& session_id);
@@ -133,7 +133,7 @@
WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
- rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
+ std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
const rtc::scoped_refptr<WebRtcIdentityRequestObserver>&
identity_request_observer,
WebRtcSession* session,
@@ -164,7 +164,7 @@
cricket::TransportDescriptionFactory transport_desc_factory_;
cricket::MediaSessionDescriptionFactory session_desc_factory_;
uint64_t session_version_;
- const rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store_;
+ const std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store_;
const rtc::scoped_refptr<WebRtcIdentityRequestObserver>
identity_request_observer_;
// TODO(jiayl): remove the dependency on session once bug 2264 is fixed.