From d1fe281e12efd938683eae470bf01ce0d5ed3f9d Mon Sep 17 00:00:00 2001 From: kwiberg Date: Wed, 27 Apr 2016 06:47:29 -0700 Subject: [PATCH] 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} --- webrtc/api/androidvideocapturer.cc | 6 +- webrtc/api/datachannel.cc | 7 +- webrtc/api/datachannel_unittest.cc | 4 +- webrtc/api/dtlsidentitystore.cc | 4 +- webrtc/api/dtmfsender_unittest.cc | 5 +- .../api/java/jni/androidmediadecoder_jni.cc | 5 +- .../api/java/jni/androidmediaencoder_jni.cc | 7 +- .../api/java/jni/androidvideocapturer_jni.h | 3 +- webrtc/api/java/jni/native_handle_impl.cc | 5 +- webrtc/api/java/jni/peerconnection_jni.cc | 25 ++- webrtc/api/jsepsessiondescription.cc | 5 +- webrtc/api/jsepsessiondescription.h | 3 +- webrtc/api/jsepsessiondescription_unittest.cc | 14 +- webrtc/api/mediacontroller.cc | 4 +- webrtc/api/mediastream_unittest.cc | 1 - webrtc/api/mediastreamprovider.h | 4 +- webrtc/api/peerconnection.cc | 10 +- webrtc/api/peerconnection.h | 17 +- webrtc/api/peerconnection_unittest.cc | 56 +++--- webrtc/api/peerconnectionendtoend_unittest.cc | 10 +- webrtc/api/peerconnectionfactory.cc | 8 +- webrtc/api/peerconnectionfactory.h | 21 +- webrtc/api/peerconnectionfactory_unittest.cc | 18 +- webrtc/api/peerconnectionfactoryproxy.h | 21 +- webrtc/api/peerconnectioninterface.h | 9 +- .../api/peerconnectioninterface_unittest.cc | 105 +++++----- webrtc/api/proxy.h | 4 +- webrtc/api/proxy_unittest.cc | 6 +- webrtc/api/remoteaudiosource.cc | 3 +- webrtc/api/rtpsender.h | 3 +- webrtc/api/rtpsenderreceiver_unittest.cc | 5 +- webrtc/api/statscollector_unittest.cc | 15 +- webrtc/api/test/fakeaudiocapturemodule.h | 4 +- webrtc/api/test/mockpeerconnectionobservers.h | 3 +- webrtc/api/test/peerconnectiontestwrapper.cc | 12 +- webrtc/api/test/peerconnectiontestwrapper.h | 4 +- webrtc/api/videocapturertracksource.h | 4 +- .../api/videocapturertracksource_unittest.cc | 7 +- webrtc/api/videotrack_unittest.cc | 8 +- webrtc/api/webrtcsdp.cc | 4 +- webrtc/api/webrtcsdp_unittest.cc | 18 +- webrtc/api/webrtcsession.cc | 10 +- webrtc/api/webrtcsession.h | 19 +- webrtc/api/webrtcsession_unittest.cc | 184 +++++++++--------- webrtc/api/webrtcsessiondescriptionfactory.cc | 6 +- webrtc/api/webrtcsessiondescriptionfactory.h | 6 +- 46 files changed, 361 insertions(+), 341 deletions(-) diff --git a/webrtc/api/androidvideocapturer.cc b/webrtc/api/androidvideocapturer.cc index e98a4be573..ee5ef665d9 100644 --- a/webrtc/api/androidvideocapturer.cc +++ b/webrtc/api/androidvideocapturer.cc @@ -10,6 +10,8 @@ #include "webrtc/api/androidvideocapturer.h" +#include + #include "webrtc/api/java/jni/native_handle_impl.h" #include "webrtc/base/common.h" #include "webrtc/base/timeutils.h" @@ -70,11 +72,11 @@ class AndroidVideoCapturer::FrameFactory : public cricket::VideoFrameFactory { RTC_CHECK(captured_frame == &captured_frame_); RTC_CHECK(buffer_->native_handle() == nullptr); - rtc::scoped_ptr frame(new cricket::WebRtcVideoFrame( + std::unique_ptr 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 612d7e0b38..452e4b3961 100644 --- a/webrtc/api/datachannel.cc +++ b/webrtc/api/datachannel.cc @@ -10,6 +10,7 @@ #include "webrtc/api/datachannel.h" +#include #include #include "webrtc/api/mediastreamprovider.h" @@ -363,7 +364,7 @@ void DataChannel::OnDataReceived(cricket::DataChannel* channel, } bool binary = (params.type == cricket::DMT_BINARY); - rtc::scoped_ptr buffer(new DataBuffer(payload, binary)); + std::unique_ptr buffer(new DataBuffer(payload, binary)); if (state_ == kOpen && observer_) { observer_->OnMessage(*buffer.get()); } else { @@ -494,7 +495,7 @@ void DataChannel::DeliverQueuedReceivedData() { } while (!queued_received_data_.Empty()) { - rtc::scoped_ptr buffer(queued_received_data_.Front()); + std::unique_ptr buffer(queued_received_data_.Front()); observer_->OnMessage(*buffer); queued_received_data_.Pop(); } @@ -589,7 +590,7 @@ void DataChannel::SendQueuedControlMessages() { control_packets.Swap(&queued_control_data_); while (!control_packets.Empty()) { - rtc::scoped_ptr buf(control_packets.Front()); + std::unique_ptr 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 5958ec02f8..d55ab57b64 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 + #include "webrtc/api/datachannel.h" #include "webrtc/api/sctputils.h" #include "webrtc/api/test/fakedatachannelprovider.h" @@ -85,7 +87,7 @@ class SctpDataChannelTest : public testing::Test { webrtc::InternalDataChannelInit init_; FakeDataChannelProvider provider_; - rtc::scoped_ptr observer_; + std::unique_ptr observer_; rtc::scoped_refptr webrtc_data_channel_; }; diff --git a/webrtc/api/dtlsidentitystore.cc b/webrtc/api/dtlsidentitystore.cc index a1105ed6d0..bdccc10c1b 100644 --- a/webrtc/api/dtlsidentitystore.cc +++ b/webrtc/api/dtlsidentitystore.cc @@ -74,7 +74,7 @@ class DtlsIdentityStoreImpl::WorkerTask : public sigslot::has_slots<>, case MSG_GENERATE_IDENTITY_RESULT: RTC_DCHECK(signaling_thread_->IsCurrent()); { - rtc::scoped_ptr pdata( + std::unique_ptr pdata( static_cast(msg->pdata)); if (store_) { store_->OnIdentityGenerated(pdata->data()->key_type_, @@ -131,7 +131,7 @@ void DtlsIdentityStoreImpl::OnMessage(rtc::Message* msg) { RTC_DCHECK(signaling_thread_->IsCurrent()); switch (msg->message_id) { case MSG_GENERATE_IDENTITY_RESULT: { - rtc::scoped_ptr pdata( + std::unique_ptr pdata( static_cast(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 0a944cb160..e6fa7fc5f0 100644 --- a/webrtc/api/dtmfsender_unittest.cc +++ b/webrtc/api/dtmfsender_unittest.cc @@ -10,6 +10,7 @@ #include "webrtc/api/dtmfsender.h" +#include #include #include #include @@ -214,8 +215,8 @@ class DtmfSenderTest : public testing::Test { } rtc::scoped_refptr track_; - rtc::scoped_ptr observer_; - rtc::scoped_ptr provider_; + std::unique_ptr observer_; + std::unique_ptr provider_; rtc::scoped_refptr dtmf_; }; diff --git a/webrtc/api/java/jni/androidmediadecoder_jni.cc b/webrtc/api/java/jni/androidmediadecoder_jni.cc index c83be1818f..a0e5579c37 100644 --- a/webrtc/api/java/jni/androidmediadecoder_jni.cc +++ b/webrtc/api/java/jni/androidmediadecoder_jni.cc @@ -9,6 +9,7 @@ */ #include +#include #include // 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 @@ class MediaCodecVideoDecoder : public webrtc::VideoDecoder, // State that is constant for the lifetime of this object once the ctor // returns. - scoped_ptr codec_thread_; // Thread on which to operate MediaCodec. + std::unique_ptr + codec_thread_; // Thread on which to operate MediaCodec. ScopedGlobalRef j_media_codec_video_decoder_class_; ScopedGlobalRef 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 e88a94ce7f..b7f2da4750 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 +#include #include #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 @@ class MediaCodecVideoEncoder : public webrtc::VideoEncoder, // State that is constant for the lifetime of this object once the ctor // returns. - scoped_ptr codec_thread_; // Thread on which to operate MediaCodec. + std::unique_ptr + codec_thread_; // Thread on which to operate MediaCodec. rtc::ThreadChecker codec_thread_checker_; ScopedGlobalRef j_media_codec_video_encoder_class_; ScopedGlobalRef j_media_codec_video_encoder_; @@ -973,7 +974,7 @@ bool MediaCodecVideoEncoder::DeliverPendingOutputs(JNIEnv* jni) { // Callback - return encoded frame. int32_t callback_status = 0; if (callback_) { - scoped_ptr image( + std::unique_ptr 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 53f180338c..eea56adb3e 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 #include #include "webrtc/api/androidvideocapturer.h" @@ -87,7 +88,7 @@ class AndroidVideoCapturerJni : public webrtc::AndroidVideoCapturerDelegate { webrtc::AndroidVideoCapturer* capturer_ GUARDED_BY(capturer_lock_); // |invoker_| is used to communicate with |capturer_| on the thread Start() is // called on. - rtc::scoped_ptr invoker_ GUARDED_BY(capturer_lock_); + std::unique_ptr 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 d52584acfe..1990828fa0 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 + #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 @@ AndroidTextureBuffer::NativeToI420Buffer() { // // TODO(nisse): Use an I420BufferPool. We then need to extend that // class, and I420Buffer, to support our memory layout. - rtc::scoped_ptr yuv_data( + std::unique_ptr yuv_data( static_cast(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 b0757e20bc..228e5e1ab1 100644 --- a/webrtc/api/java/jni/peerconnection_jni.cc +++ b/webrtc/api/java/jni/peerconnection_jni.cc @@ -80,7 +80,6 @@ using cricket::WebRtcVideoEncoderFactory; 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 @@ class PCOJava : public PeerConnectionObserver { // C++ -> Java remote streams. The stored jobects are global refs and must be // manually deleted upon removal. Use DisposeRemoteStream(). NativeToJavaStreamsMap remote_streams_; - scoped_ptr constraints_; + std::unique_ptr constraints_; }; // Wrapper for a Java MediaConstraints object. Copies all needed data so when @@ -549,7 +548,7 @@ class SdpObserverWrapper : public T { } private: - scoped_ptr constraints_; + std::unique_ptr constraints_; const ScopedGlobalRef j_observer_global_; const ScopedGlobalRef j_observer_class_; }; @@ -822,7 +821,7 @@ static DataChannelInterface* ExtractNativeDC(JNIEnv* jni, jobject j_dc) { JOW(jlong, DataChannel_registerObserverNative)( JNIEnv* jni, jobject j_dc, jobject j_observer) { - scoped_ptr observer( + std::unique_ptr observer( new DataChannelObserverWrapper(jni, j_observer)); ExtractNativeDC(jni, j_dc)->RegisterObserver(observer.get()); return jlongFromPointer(observer.release()); @@ -1067,8 +1066,8 @@ class OwnedFactoryAndThreads { private: void JavaCallbackOnFactoryThreads(); - const scoped_ptr worker_thread_; - const scoped_ptr signaling_thread_; + const std::unique_ptr worker_thread_; + const std::unique_ptr signaling_thread_; WebRtcVideoEncoderFactory* encoder_factory_; WebRtcVideoDecoderFactory* decoder_factory_; rtc::NetworkMonitorFactory* network_monitor_factory_; @@ -1225,11 +1224,11 @@ JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)( rtc::scoped_refptr delegate = new rtc::RefCountedObject( jni, j_video_capturer, j_egl_context); - rtc::scoped_ptr capturer( + std::unique_ptr capturer( new webrtc::AndroidVideoCapturer(delegate)); // Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer, // native factory and constraints. - scoped_ptr constraints( + std::unique_ptr constraints( new ConstraintsWrapper(jni, j_constraints)); rtc::scoped_refptr factory( factoryFromJava(native_factory)); @@ -1251,7 +1250,7 @@ JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)( JOW(jlong, PeerConnectionFactory_nativeCreateAudioSource)( JNIEnv* jni, jclass, jlong native_factory, jobject j_constraints) { - scoped_ptr constraints( + std::unique_ptr constraints( new ConstraintsWrapper(jni, j_constraints)); rtc::scoped_refptr factory( factoryFromJava(native_factory)); @@ -1706,7 +1705,7 @@ JOW(jboolean, PeerConnection_nativeAddIceCandidate)( 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 candidate( + std::unique_ptr candidate( webrtc::CreateIceCandidate(sdp_mid, j_sdp_mline_index, sdp, NULL)); return ExtractNativePC(jni, j_pc)->AddIceCandidate(candidate.get()); } @@ -1871,7 +1870,7 @@ JOW(jobject, MediaSource_nativeState)(JNIEnv* jni, jclass, jlong j_p) { JOW(jlong, VideoRenderer_nativeWrapVideoRenderer)( JNIEnv* jni, jclass, jobject j_callbacks) { - scoped_ptr renderer( + std::unique_ptr renderer( new JavaVideoRendererWrapper(jni, j_callbacks)); return (jlong)renderer.release(); } @@ -1985,7 +1984,7 @@ JOW(void, CallSessionFileRotatingLogSink_nativeDeleteSink)( JOW(jbyteArray, CallSessionFileRotatingLogSink_nativeGetLogData)( JNIEnv* jni, jclass, jstring j_dirPath) { std::string dir_path = JavaToStdString(jni, j_dirPath); - rtc::scoped_ptr stream( + std::unique_ptr stream( new rtc::CallSessionFileRotatingStream(dir_path)); if (!stream->Open()) { LOG_V(rtc::LoggingSeverity::LS_WARNING) << @@ -2000,7 +1999,7 @@ JOW(jbyteArray, CallSessionFileRotatingLogSink_nativeGetLogData)( } size_t read = 0; - rtc::scoped_ptr buffer(static_cast(malloc(log_size))); + std::unique_ptr buffer(static_cast(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 ee0a8e14eb..547a60f1c3 100644 --- a/webrtc/api/jsepsessiondescription.cc +++ b/webrtc/api/jsepsessiondescription.cc @@ -10,12 +10,13 @@ #include "webrtc/api/jsepsessiondescription.h" +#include + #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 @@ bool JsepSessionDescription::AddCandidate( updated_candidate.set_password(transport_info->description.ice_pwd); } - scoped_ptr updated_candidate_wrapper( + std::unique_ptr updated_candidate_wrapper( new JsepIceCandidate(candidate->sdp_mid(), static_cast(mediasection_index), updated_candidate)); diff --git a/webrtc/api/jsepsessiondescription.h b/webrtc/api/jsepsessiondescription.h index d4b4908b23..56dd806110 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 #include #include @@ -75,7 +76,7 @@ class JsepSessionDescription : public SessionDescriptionInterface { static const int kMaxVideoCodecHeight; private: - rtc::scoped_ptr description_; + std::unique_ptr 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 8f9fc5427f..6be590faf4 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 #include #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::IceCandidateInterface; 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 const char kCandidatePwdVideo[] = "pwd_video"; static cricket::SessionDescription* CreateCricketSessionDescription() { cricket::SessionDescription* desc(new cricket::SessionDescription()); // AudioContentDescription - scoped_ptr audio( + std::unique_ptr audio( new cricket::AudioContentDescription()); // VideoContentDescription - scoped_ptr video( + std::unique_ptr video( new cricket::VideoContentDescription()); audio->AddCodec(cricket::AudioCodec(103, "ISAC", 16000, 0, 0)); @@ -100,7 +99,7 @@ class JsepSessionDescriptionTest : public testing::Test { } cricket::Candidate candidate_; - rtc::scoped_ptr jsep_desc_; + std::unique_ptr jsep_desc_; }; // Test that number_of_mediasections() returns the number of media contents in @@ -204,7 +203,8 @@ TEST_F(JsepSessionDescriptionTest, AddCandidateDuplicates) { TEST_F(JsepSessionDescriptionTest, SerializeDeserialize) { std::string sdp = Serialize(jsep_desc_.get()); - scoped_ptr parsed_jsep_desc(DeSerialize(sdp)); + std::unique_ptr 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 @@ TEST_F(JsepSessionDescriptionTest, SerializeDeserializeWithCandidates) { std::string sdp_with_candidate = Serialize(jsep_desc_.get()); EXPECT_NE(sdp, sdp_with_candidate); - scoped_ptr parsed_jsep_desc( + std::unique_ptr 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 e276e0cdd5..2e4501b3f1 100644 --- a/webrtc/api/mediacontroller.cc +++ b/webrtc/api/mediacontroller.cc @@ -10,6 +10,8 @@ #include "webrtc/api/mediacontroller.h" +#include + #include "webrtc/base/bind.h" #include "webrtc/base/checks.h" #include "webrtc/base/constructormagic.h" @@ -75,7 +77,7 @@ class MediaController : public webrtc::MediaControllerInterface, const cricket::MediaConfig media_config_; cricket::ChannelManager* const channel_manager_; webrtc::Call::Config call_config_; - rtc::scoped_ptr call_; + std::unique_ptr call_; RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); }; diff --git a/webrtc/api/mediastream_unittest.cc b/webrtc/api/mediastream_unittest.cc index dd63356e92..1881cceeb0 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 f3bb3f49f3..eef92846cb 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 + #include "webrtc/api/rtpsenderinterface.h" #include "webrtc/base/basictypes.h" #include "webrtc/base/scoped_ptr.h" @@ -60,7 +62,7 @@ class AudioProviderInterface { // passed to the provider. virtual void SetRawAudioSink( uint32_t ssrc, - rtc::scoped_ptr sink) = 0; + std::unique_ptr 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 70a386ec14..7f1f452378 100644 --- a/webrtc/api/peerconnection.cc +++ b/webrtc/api/peerconnection.cc @@ -526,8 +526,8 @@ PeerConnection::~PeerConnection() { bool PeerConnection::Initialize( const PeerConnectionInterface::RTCConfiguration& configuration, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr allocator, + std::unique_ptr dtls_identity_store, PeerConnectionObserver* observer) { TRACE_EVENT0("webrtc", "PeerConnection::Initialize"); RTC_DCHECK(observer != nullptr); @@ -628,7 +628,7 @@ bool PeerConnection::AddStream(MediaStreamInterface* local_stream) { &PeerConnection::OnVideoTrackAdded); observer->SignalVideoTrackRemoved.connect( this, &PeerConnection::OnVideoTrackRemoved); - stream_observers_.push_back(rtc::scoped_ptr(observer)); + stream_observers_.push_back(std::unique_ptr(observer)); for (const auto& track : local_stream->GetAudioTracks()) { OnAudioTrackAdded(track.get(), local_stream); @@ -655,7 +655,7 @@ void PeerConnection::RemoveStream(MediaStreamInterface* local_stream) { stream_observers_.erase( std::remove_if( stream_observers_.begin(), stream_observers_.end(), - [local_stream](const rtc::scoped_ptr& observer) { + [local_stream](const std::unique_ptr& observer) { return observer->stream()->label().compare(local_stream->label()) == 0; }), @@ -835,7 +835,7 @@ PeerConnection::CreateDataChannel( TRACE_EVENT0("webrtc", "PeerConnection::CreateDataChannel"); bool first_datachannel = !HasDataChannels(); - rtc::scoped_ptr internal_config; + std::unique_ptr internal_config; if (config) { internal_config.reset(new InternalDataChannelInit(*config)); } diff --git a/webrtc/api/peerconnection.h b/webrtc/api/peerconnection.h index 1574af60c5..b5577157a6 100644 --- a/webrtc/api/peerconnection.h +++ b/webrtc/api/peerconnection.h @@ -13,6 +13,7 @@ #include #include +#include #include #include "webrtc/api/dtlsidentitystore.h" @@ -69,8 +70,8 @@ class PeerConnection : public PeerConnectionInterface, bool Initialize( const PeerConnectionInterface::RTCConfiguration& configuration, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr allocator, + std::unique_ptr dtls_identity_store, PeerConnectionObserver* observer); rtc::scoped_refptr local_streams() override; @@ -365,15 +366,15 @@ class PeerConnection : public PeerConnectionInterface, IceConnectionState ice_connection_state_; IceGatheringState ice_gathering_state_; - rtc::scoped_ptr port_allocator_; - rtc::scoped_ptr media_controller_; + std::unique_ptr port_allocator_; + std::unique_ptr media_controller_; // Streams added via AddStream. rtc::scoped_refptr local_streams_; // Streams created as a result of SetRemoteDescription. rtc::scoped_refptr remote_streams_; - std::vector> stream_observers_; + std::vector> stream_observers_; // These lists store track info seen in local/remote descriptions. TrackInfos remote_audio_tracks_; @@ -392,12 +393,12 @@ class PeerConnection : public PeerConnectionInterface, std::vector> senders_; std::vector> 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 session_; + std::unique_ptr session_; // ... But stats_ depends on session_ so it should be destroyed even earlier. - rtc::scoped_ptr stats_; + std::unique_ptr stats_; }; } // namespace webrtc diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc index 156605c9b9..521486f98b 100644 --- a/webrtc/api/peerconnection_unittest.cc +++ b/webrtc/api/peerconnection_unittest.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -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 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, const std::string& id, const MediaConstraintsInterface* constraints, const PeerConnectionFactory::Options* options, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr dtls_identity_store, bool prefer_constraint_apis, rtc::Thread* worker_thread) { PeerConnectionTestClient* client(new PeerConnectionTestClient(id)); @@ -171,7 +171,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, const MediaConstraintsInterface* constraints, const PeerConnectionFactory::Options* options, rtc::Thread* worker_thread) { - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() : nullptr); @@ -184,7 +184,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, const std::string& id, const PeerConnectionFactory::Options* options, rtc::Thread* worker_thread) { - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() : nullptr); @@ -199,7 +199,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, void Negotiate() { Negotiate(true, true); } void Negotiate(bool audio, bool video) { - rtc::scoped_ptr offer; + std::unique_ptr offer; ASSERT_TRUE(DoCreateOffer(&offer)); if (offer->description()->GetContentByName("audio")) { @@ -231,7 +231,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, int sdp_mline_index, const std::string& msg) override { LOG(INFO) << id_ << "ReceiveIceMessage"; - rtc::scoped_ptr candidate( + std::unique_ptr candidate( webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, msg, nullptr)); EXPECT_TRUE(pc()->AddIceCandidate(candidate.get())); } @@ -549,7 +549,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, // Verify the CreateDtmfSender interface void VerifyDtmf() { - rtc::scoped_ptr observer(new DummyDtmfObserver()); + std::unique_ptr observer(new DummyDtmfObserver()); rtc::scoped_refptr dtmf_sender; // We can't create a DTMF sender with an invalid audio track or a non local @@ -804,7 +804,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, bool Init( const MediaConstraintsInterface* constraints, const PeerConnectionFactory::Options* options, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr dtls_identity_store, bool prefer_constraint_apis, rtc::Thread* worker_thread) { EXPECT_TRUE(!peer_connection_); @@ -814,7 +814,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, } prefer_constraint_apis_ = prefer_constraint_apis; - rtc::scoped_ptr port_allocator( + std::unique_ptr port_allocator( new cricket::FakePortAllocator(worker_thread, nullptr)); fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); @@ -838,9 +838,9 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, } rtc::scoped_refptr CreatePeerConnection( - rtc::scoped_ptr port_allocator, + std::unique_ptr port_allocator, const MediaConstraintsInterface* constraints, - rtc::scoped_ptr dtls_identity_store) { + std::unique_ptr dtls_identity_store) { // CreatePeerConnection with RTCConfiguration. webrtc::PeerConnectionInterface::RTCConfiguration config; webrtc::PeerConnectionInterface::IceServer ice_server; @@ -858,10 +858,10 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, // If we are not sending any streams ourselves it is time to add some. AddMediaStream(true, true); } - rtc::scoped_ptr desc( + std::unique_ptr desc( webrtc::CreateSessionDescription("offer", msg, nullptr)); EXPECT_TRUE(DoSetRemoteDescription(desc.release())); - rtc::scoped_ptr answer; + std::unique_ptr answer; EXPECT_TRUE(DoCreateAnswer(&answer)); std::string sdp; EXPECT_TRUE(answer->ToString(&sdp)); @@ -874,12 +874,12 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, void HandleIncomingAnswer(const std::string& msg) { LOG(INFO) << id_ << "HandleIncomingAnswer"; - rtc::scoped_ptr desc( + std::unique_ptr desc( webrtc::CreateSessionDescription("answer", msg, nullptr)); EXPECT_TRUE(DoSetRemoteDescription(desc.release())); } - bool DoCreateOfferAnswer(rtc::scoped_ptr* desc, + bool DoCreateOfferAnswer(std::unique_ptr* desc, bool offer) { rtc::scoped_refptr observer(new rtc::RefCountedObject< @@ -905,11 +905,11 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, return observer->result(); } - bool DoCreateOffer(rtc::scoped_ptr* desc) { + bool DoCreateOffer(std::unique_ptr* desc) { return DoCreateOfferAnswer(desc, true); } - bool DoCreateAnswer(rtc::scoped_ptr* desc) { + bool DoCreateAnswer(std::unique_ptr* desc) { return DoCreateOfferAnswer(desc, false); } @@ -982,10 +982,10 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, // Needed to keep track of number of frames sent. rtc::scoped_refptr fake_audio_capture_module_; // Needed to keep track of number of frames received. - std::map> + std::map> fake_video_renderers_; // Needed to ensure frames aren't received for removed tracks. - std::vector> + std::vector> removed_fake_video_renderers_; // Needed to keep track of number of frames received when external decoder // used. @@ -1002,7 +1002,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, std::vector video_capturers_; webrtc::VideoRotation capture_rotation_ = webrtc::kVideoRotation_0; // |local_video_renderer_| attached to the first created local video track. - rtc::scoped_ptr local_video_renderer_; + std::unique_ptr local_video_renderer_; webrtc::FakeConstraints offer_answer_constraints_; PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options_; @@ -1016,7 +1016,7 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, bool remove_cvo_ = false; rtc::scoped_refptr data_channel_; - rtc::scoped_ptr data_observer_; + std::unique_ptr data_observer_; }; class P2PTestConductor : public testing::Test { @@ -1253,7 +1253,7 @@ class P2PTestConductor : public testing::Test { setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, true); - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore() : nullptr); dtls_identity_store->use_alternate_key(); @@ -1305,11 +1305,11 @@ class P2PTestConductor : public testing::Test { // |worker_thread_| is used by both |initiating_client_| and // |receiving_client_|. Must be destroyed last. rtc::Thread worker_thread_; - rtc::scoped_ptr pss_; - rtc::scoped_ptr ss_; + std::unique_ptr pss_; + std::unique_ptr ss_; rtc::SocketServerScope ss_scope_; - rtc::scoped_ptr initiating_client_; - rtc::scoped_ptr receiving_client_; + std::unique_ptr initiating_client_; + std::unique_ptr receiving_client_; bool prefer_constraint_apis_ = true; }; @@ -1405,7 +1405,7 @@ TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCallee) { // Keeping the original peer around which will still send packets to the // receiving client. These SRTP packets will be dropped. - rtc::scoped_ptr original_peer( + std::unique_ptr original_peer( set_initializing_client(CreateDtlsClientWithAlternateKey())); original_peer->pc()->Close(); @@ -1443,7 +1443,7 @@ TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCaller) { // Keeping the original peer around which will still send packets to the // receiving client. These SRTP packets will be dropped. - rtc::scoped_ptr original_peer( + std::unique_ptr 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 20df17bc63..95369b15c0 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 + #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 @@ class PeerConnectionEndToEndTest // Tests that |dc1| and |dc2| can send to and receive from each other. void TestDataChannelSendAndReceive( DataChannelInterface* dc1, DataChannelInterface* dc2) { - rtc::scoped_ptr dc1_observer( + std::unique_ptr dc1_observer( new webrtc::MockDataChannelObserver(dc1)); - rtc::scoped_ptr dc2_observer( + std::unique_ptr dc2_observer( new webrtc::MockDataChannelObserver(dc2)); static const std::string kDummyData = "abcdefg"; @@ -294,10 +296,10 @@ TEST_F(PeerConnectionEndToEndTest, WaitForDataChannelsToOpen(caller_dc_1, callee_signaled_data_channels_, 0); WaitForDataChannelsToOpen(caller_dc_2, callee_signaled_data_channels_, 1); - rtc::scoped_ptr dc_1_observer( + std::unique_ptr dc_1_observer( new webrtc::MockDataChannelObserver(callee_signaled_data_channels_[0])); - rtc::scoped_ptr dc_2_observer( + std::unique_ptr 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 8e1ece6c65..ff8098cd57 100644 --- a/webrtc/api/peerconnectionfactory.cc +++ b/webrtc/api/peerconnectionfactory.cc @@ -249,8 +249,8 @@ rtc::scoped_refptr PeerConnectionFactory::CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& configuration_in, const MediaConstraintsInterface* constraints, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr allocator, + std::unique_ptr dtls_identity_store, PeerConnectionObserver* observer) { RTC_DCHECK(signaling_thread_->IsCurrent()); @@ -265,8 +265,8 @@ PeerConnectionFactory::CreatePeerConnection( rtc::scoped_refptr PeerConnectionFactory::CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& configuration, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr allocator, + std::unique_ptr dtls_identity_store, PeerConnectionObserver* observer) { RTC_DCHECK(signaling_thread_->IsCurrent()); diff --git a/webrtc/api/peerconnectionfactory.h b/webrtc/api/peerconnectionfactory.h index b47f75a7ce..995c760cb4 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 #include #include "webrtc/api/dtlsidentitystore.h" @@ -42,14 +43,14 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface { rtc::scoped_refptr CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& configuration, const MediaConstraintsInterface* constraints, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr allocator, + std::unique_ptr dtls_identity_store, PeerConnectionObserver* observer) override; virtual rtc::scoped_refptr CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& configuration, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr allocator, + std::unique_ptr dtls_identity_store, PeerConnectionObserver* observer) override; bool Initialize(); @@ -112,17 +113,15 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface { Options options_; // External Audio device used for audio playback. rtc::scoped_refptr default_adm_; - rtc::scoped_ptr channel_manager_; + std::unique_ptr 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 - video_encoder_factory_; + std::unique_ptr 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 - video_decoder_factory_; - rtc::scoped_ptr default_network_manager_; - rtc::scoped_ptr default_socket_factory_; + std::unique_ptr video_decoder_factory_; + std::unique_ptr default_network_manager_; + std::unique_ptr default_socket_factory_; rtc::scoped_refptr dtls_identity_store_; }; diff --git a/webrtc/api/peerconnectionfactory_unittest.cc b/webrtc/api/peerconnectionfactory_unittest.cc index 254e4e0a02..e7859d0081 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 #include #include @@ -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 @@ class PeerConnectionFactoryTest : public testing::Test { rtc::scoped_refptr factory_; NullPeerConnectionObserver observer_; - rtc::scoped_ptr port_allocator_; + std::unique_ptr 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 @@ TEST(PeerConnectionFactoryTestInternal, CreatePCUsingInternalModules) { NullPeerConnectionObserver observer; webrtc::PeerConnectionInterface::RTCConfiguration config; - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( new FakeDtlsIdentityStore()); rtc::scoped_refptr pc(factory->CreatePeerConnection( config, nullptr, nullptr, std::move(dtls_identity_store), &observer)); @@ -162,7 +162,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) { ice_server.uri = kTurnIceServerWithTransport; ice_server.password = kTurnPassword; config.servers.push_back(ice_server); - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( new FakeDtlsIdentityStore()); rtc::scoped_refptr pc(factory_->CreatePeerConnection( config, nullptr, std::move(port_allocator_), @@ -192,7 +192,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) { ice_server.urls.push_back(kTurnIceServerWithTransport); ice_server.password = kTurnPassword; config.servers.push_back(ice_server); - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( new FakeDtlsIdentityStore()); rtc::scoped_refptr pc(factory_->CreatePeerConnection( config, nullptr, std::move(port_allocator_), @@ -221,7 +221,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingNoUsernameInUri) { ice_server.username = kTurnUsername; ice_server.password = kTurnPassword; config.servers.push_back(ice_server); - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( new FakeDtlsIdentityStore()); rtc::scoped_refptr pc(factory_->CreatePeerConnection( config, nullptr, std::move(port_allocator_), @@ -242,7 +242,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingTurnUrlWithTransportParam) { ice_server.uri = kTurnIceServerWithTransport; ice_server.password = kTurnPassword; config.servers.push_back(ice_server); - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( new FakeDtlsIdentityStore()); rtc::scoped_refptr pc(factory_->CreatePeerConnection( config, nullptr, std::move(port_allocator_), @@ -267,7 +267,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingSecureTurnUrl) { ice_server.uri = kSecureTurnIceServerWithoutTransportAndPortParam; ice_server.password = kTurnPassword; config.servers.push_back(ice_server); - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( new FakeDtlsIdentityStore()); rtc::scoped_refptr pc(factory_->CreatePeerConnection( config, nullptr, std::move(port_allocator_), @@ -302,7 +302,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIPLiteralAddress) { ice_server.uri = kTurnIceServerWithIPv6Address; ice_server.password = kTurnPassword; config.servers.push_back(ice_server); - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( new FakeDtlsIdentityStore()); rtc::scoped_refptr pc(factory_->CreatePeerConnection( config, nullptr, std::move(port_allocator_), diff --git a/webrtc/api/peerconnectionfactoryproxy.h b/webrtc/api/peerconnectionfactoryproxy.h index ef47cdb869..f60f9e9c65 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 #include #include @@ -22,13 +23,13 @@ namespace webrtc { 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 CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& a1, const MediaConstraintsInterface* a2, - rtc::scoped_ptr a3, - rtc::scoped_ptr a4, + std::unique_ptr a3, + std::unique_ptr a4, PeerConnectionObserver* a5) override { return signaling_thread_ ->Invoke>( @@ -37,8 +38,8 @@ BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory) } rtc::scoped_refptr CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& a1, - rtc::scoped_ptr a3, - rtc::scoped_ptr a4, + std::unique_ptr a3, + std::unique_ptr a4, PeerConnectionObserver* a5) override { return signaling_thread_ ->Invoke>( @@ -77,8 +78,8 @@ BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory) cricket::PortAllocator* a3, DtlsIdentityStoreInterface* a4, PeerConnectionObserver* a5) { - rtc::scoped_ptr ptr_a3(a3); - rtc::scoped_ptr ptr_a4(a4); + std::unique_ptr ptr_a3(a3); + std::unique_ptr ptr_a4(a4); return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3), std::move(ptr_a4), a5); } @@ -88,8 +89,8 @@ BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory) cricket::PortAllocator* a3, DtlsIdentityStoreInterface* a4, PeerConnectionObserver* a5) { - rtc::scoped_ptr ptr_a3(a3); - rtc::scoped_ptr ptr_a4(a4); + std::unique_ptr ptr_a3(a3); + std::unique_ptr 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 59bc160014..94d2c001e3 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 #include #include #include @@ -591,14 +592,14 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface { virtual rtc::scoped_refptr CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& configuration, const MediaConstraintsInterface* constraints, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr allocator, + std::unique_ptr dtls_identity_store, PeerConnectionObserver* observer) = 0; virtual rtc::scoped_refptr CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& configuration, - rtc::scoped_ptr allocator, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr allocator, + std::unique_ptr dtls_identity_store, PeerConnectionObserver* observer) = 0; virtual rtc::scoped_refptr diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc index 14a067995b..738b736dd8 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 #include #include @@ -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 @@ static const char kSdpStringMs1Video1[] = return; \ } -using rtc::scoped_ptr; using rtc::scoped_refptr; using ::testing::Exactly; using webrtc::AudioSourceInterface; @@ -504,7 +503,7 @@ class MockPeerConnectionObserver : public PeerConnectionObserver { scoped_refptr pc_; PeerConnectionInterface::SignalingState state_; - scoped_ptr last_candidate_; + std::unique_ptr last_candidate_; scoped_refptr last_datachannel_; rtc::scoped_refptr remote_streams_; bool renegotiation_needed_ = false; @@ -551,7 +550,7 @@ class PeerConnectionInterfaceTest : public testing::Test { config.servers.push_back(server); } - rtc::scoped_ptr port_allocator( + std::unique_ptr port_allocator( new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr)); port_allocator_ = port_allocator.get(); @@ -566,7 +565,7 @@ class PeerConnectionInterfaceTest : public testing::Test { webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); } - scoped_ptr dtls_identity_store; + std::unique_ptr dtls_identity_store; bool dtls; if (FindConstraint(constraints, webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, @@ -668,7 +667,7 @@ class PeerConnectionInterfaceTest : public testing::Test { observer_.renegotiation_needed_ = false; } - bool DoCreateOfferAnswer(rtc::scoped_ptr* desc, + bool DoCreateOfferAnswer(std::unique_ptr* desc, bool offer, MediaConstraintsInterface* constraints) { rtc::scoped_refptr @@ -684,12 +683,12 @@ class PeerConnectionInterfaceTest : public testing::Test { return observer->result(); } - bool DoCreateOffer(rtc::scoped_ptr* desc, + bool DoCreateOffer(std::unique_ptr* desc, MediaConstraintsInterface* constraints) { return DoCreateOfferAnswer(desc, true, constraints); } - bool DoCreateAnswer(rtc::scoped_ptr* desc, + bool DoCreateAnswer(std::unique_ptr* desc, MediaConstraintsInterface* constraints) { return DoCreateOfferAnswer(desc, false, constraints); } @@ -750,7 +749,7 @@ class PeerConnectionInterfaceTest : public testing::Test { } void CreateOfferAsRemoteDescription() { - rtc::scoped_ptr offer; + std::unique_ptr offer; ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); std::string sdp; EXPECT_TRUE(offer->ToString(&sdp)); @@ -770,7 +769,7 @@ class PeerConnectionInterfaceTest : public testing::Test { } void CreateAnswerAsLocalDescription() { - scoped_ptr answer; + std::unique_ptr answer; ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); // TODO(perkj): Currently SetLocalDescription fails if any parameters in an @@ -790,7 +789,7 @@ class PeerConnectionInterfaceTest : public testing::Test { } void CreatePrAnswerAsLocalDescription() { - scoped_ptr answer; + std::unique_ptr answer; ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); std::string sdp; @@ -810,7 +809,7 @@ class PeerConnectionInterfaceTest : public testing::Test { } void CreateOfferAsLocalDescription() { - rtc::scoped_ptr offer; + std::unique_ptr 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 @@ class PeerConnectionInterfaceTest : public testing::Test { // corresponding SessionDescriptionInterface. The SessionDescriptionInterface // is returned and the MediaStream is stored in // |reference_collection_| - rtc::scoped_ptr + std::unique_ptr CreateSessionDescriptionAndReference(size_t number_of_audio_tracks, size_t number_of_video_tracks) { EXPECT_LE(number_of_audio_tracks, 2u); @@ -915,7 +914,7 @@ class PeerConnectionInterfaceTest : public testing::Test { AddVideoTrack(kVideoTracks[1], stream); } - return rtc::scoped_ptr( + return std::unique_ptr( webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer, sdp_ms1, nullptr)); } @@ -980,7 +979,7 @@ TEST_F(PeerConnectionInterfaceTest, AddStreams) { TEST_F(PeerConnectionInterfaceTest, AddedStreamsPresentInOffer) { CreatePeerConnection(); AddAudioVideoStream(kStreamLabel1, "audio_track", "video_track"); - scoped_ptr offer; + std::unique_ptr offer; ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); const cricket::ContentInfo* audio_content = @@ -1055,7 +1054,7 @@ TEST_F(PeerConnectionInterfaceTest, AddTrackRemoveTrack) { EXPECT_EQ(video_track, video_sender->track()); // Now create an offer and check for the senders. - scoped_ptr offer; + std::unique_ptr offer; ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); const cricket::ContentInfo* audio_content = @@ -1193,13 +1192,13 @@ TEST_F(PeerConnectionInterfaceTest, IceCandidates) { EXPECT_FALSE(pc_->AddIceCandidate(observer_.last_candidate_.get())); // SetRemoteDescription takes ownership of offer. - rtc::scoped_ptr offer; + std::unique_ptr offer; AddVideoStream(kStreamLabel1); EXPECT_TRUE(DoCreateOffer(&offer, nullptr)); EXPECT_TRUE(DoSetRemoteDescription(offer.release())); // SetLocalDescription takes ownership of answer. - rtc::scoped_ptr answer; + std::unique_ptr answer; EXPECT_TRUE(DoCreateAnswer(&answer, nullptr)); EXPECT_TRUE(DoSetLocalDescription(answer.release())); @@ -1214,7 +1213,7 @@ TEST_F(PeerConnectionInterfaceTest, IceCandidates) { TEST_F(PeerConnectionInterfaceTest, CreateOfferAnswerWithInvalidStream) { CreatePeerConnection(); // Create a regular offer for the CreateAnswer test later. - rtc::scoped_ptr offer; + std::unique_ptr offer; EXPECT_TRUE(DoCreateOffer(&offer, nullptr)); EXPECT_TRUE(offer); offer.reset(); @@ -1226,7 +1225,7 @@ TEST_F(PeerConnectionInterfaceTest, CreateOfferAnswerWithInvalidStream) { EXPECT_FALSE(DoCreateOffer(&offer, nullptr)); // Test CreateAnswer - rtc::scoped_ptr answer; + std::unique_ptr answer; EXPECT_FALSE(DoCreateAnswer(&answer, nullptr)); } @@ -1238,7 +1237,7 @@ TEST_F(PeerConnectionInterfaceTest, SsrcInOfferAnswer) { AddAudioVideoStream(kStreamLabel1, "audio_label", "video_label"); // Test CreateOffer - scoped_ptr offer; + std::unique_ptr offer; ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); int audio_ssrc = 0; int video_ssrc = 0; @@ -1250,7 +1249,7 @@ TEST_F(PeerConnectionInterfaceTest, SsrcInOfferAnswer) { // Test CreateAnswer EXPECT_TRUE(DoSetRemoteDescription(offer.release())); - scoped_ptr answer; + std::unique_ptr answer; ASSERT_TRUE(DoCreateAnswer(&answer, nullptr)); audio_ssrc = 0; video_ssrc = 0; @@ -1276,7 +1275,7 @@ TEST_F(PeerConnectionInterfaceTest, AddTrackAfterAddStream) { pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer()))); stream->AddTrack(video_track.get()); - scoped_ptr offer; + std::unique_ptr offer; ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); const cricket::MediaContentDescription* video_desc = @@ -1296,7 +1295,7 @@ TEST_F(PeerConnectionInterfaceTest, RemoveTrackAfterAddStream) { // Remove the video track. stream->RemoveTrack(stream->GetVideoTracks()[0]); - scoped_ptr offer; + std::unique_ptr offer; ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); const cricket::MediaContentDescription* video_desc = @@ -1310,7 +1309,7 @@ TEST_F(PeerConnectionInterfaceTest, CreateSenderWithStream) { CreatePeerConnection(); pc_->CreateSender("video", kStreamLabel1); - scoped_ptr offer; + std::unique_ptr offer; ASSERT_TRUE(DoCreateOffer(&offer, nullptr)); const cricket::MediaContentDescription* video_desc = @@ -1373,9 +1372,9 @@ TEST_F(PeerConnectionInterfaceTest, TestDataChannel) { scoped_refptr data2 = pc_->CreateDataChannel("test2", NULL); ASSERT_TRUE(data1 != NULL); - rtc::scoped_ptr observer1( + std::unique_ptr observer1( new MockDataChannelObserver(data1)); - rtc::scoped_ptr observer2( + std::unique_ptr observer2( new MockDataChannelObserver(data2)); EXPECT_EQ(DataChannelInterface::kConnecting, data1->state()); @@ -1420,9 +1419,9 @@ TEST_F(PeerConnectionInterfaceTest, TestSendBinaryOnRtpDataChannel) { scoped_refptr data2 = pc_->CreateDataChannel("test2", NULL); ASSERT_TRUE(data1 != NULL); - rtc::scoped_ptr observer1( + std::unique_ptr observer1( new MockDataChannelObserver(data1)); - rtc::scoped_ptr observer2( + std::unique_ptr observer2( new MockDataChannelObserver(data2)); EXPECT_EQ(DataChannelInterface::kConnecting, data1->state()); @@ -1447,7 +1446,7 @@ TEST_F(PeerConnectionInterfaceTest, TestSendOnlyDataChannel) { CreatePeerConnection(&constraints); scoped_refptr data1 = pc_->CreateDataChannel("test1", NULL); - rtc::scoped_ptr observer1( + std::unique_ptr observer1( new MockDataChannelObserver(data1)); CreateOfferReceiveAnswerWithoutSsrc(); @@ -1662,9 +1661,9 @@ TEST_F(PeerConnectionInterfaceTest, DataChannelCloseWhenPeerConnectionClose) { scoped_refptr data2 = pc_->CreateDataChannel("test2", NULL); ASSERT_TRUE(data1 != NULL); - rtc::scoped_ptr observer1( + std::unique_ptr observer1( new MockDataChannelObserver(data1)); - rtc::scoped_ptr observer2( + std::unique_ptr observer2( new MockDataChannelObserver(data2)); CreateOfferReceiveAnswer(); @@ -1769,7 +1768,7 @@ TEST_F(PeerConnectionInterfaceTest, CreateSubsequentRecvOnlyOffer) { // At this point we should be receiving stream 1, but not sending anything. // A new offer should be recvonly. - rtc::scoped_ptr offer; + std::unique_ptr offer; DoCreateOffer(&offer, nullptr); const cricket::ContentInfo* video_content = @@ -1801,7 +1800,7 @@ TEST_F(PeerConnectionInterfaceTest, CreateSubsequentInactiveOffer) { // 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 offer; + std::unique_ptr offer; FakeConstraints offer_constraints; offer_constraints.AddMandatory( webrtc::MediaConstraintsInterface::kOfferToReceiveVideo, false); @@ -1896,9 +1895,9 @@ TEST_F(PeerConnectionInterfaceTest, CloseAndTestMethods) { EXPECT_TRUE(pc_->local_description() != NULL); EXPECT_TRUE(pc_->remote_description() != NULL); - rtc::scoped_ptr offer; + std::unique_ptr offer; EXPECT_TRUE(DoCreateOffer(&offer, nullptr)); - rtc::scoped_ptr answer; + std::unique_ptr answer; EXPECT_TRUE(DoCreateAnswer(&answer, nullptr)); std::string sdp; @@ -1959,14 +1958,14 @@ TEST_F(PeerConnectionInterfaceTest, constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, true); CreatePeerConnection(&constraints); - rtc::scoped_ptr desc_ms1 = + std::unique_ptr 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 desc_ms1_two_tracks = + std::unique_ptr 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 @@ TEST_F(PeerConnectionInterfaceTest, EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, video_track2->state()); // Remove the extra audio and video tracks. - rtc::scoped_ptr desc_ms2 = + std::unique_ptr desc_ms2 = CreateSessionDescriptionAndReference(1, 1); MockTrackObserver audio_track_observer(audio_track2); MockTrackObserver video_track_observer(video_track2); @@ -2018,7 +2017,7 @@ TEST_F(PeerConnectionInterfaceTest, RejectMediaContent) { remote_stream->GetAudioTracks()[0]; EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, remote_audio->state()); - rtc::scoped_ptr local_answer; + std::unique_ptr local_answer; EXPECT_TRUE(DoCreateAnswer(&local_answer, nullptr)); cricket::ContentInfo* video_info = local_answer->description()->GetContentByName("video"); @@ -2028,7 +2027,7 @@ TEST_F(PeerConnectionInterfaceTest, RejectMediaContent) { EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, remote_audio->state()); // Now create an offer where we reject both video and audio. - rtc::scoped_ptr local_offer; + std::unique_ptr local_offer; EXPECT_TRUE(DoCreateOffer(&local_offer, nullptr)); video_info = local_offer->description()->GetContentByName("video"); ASSERT_TRUE(video_info != nullptr); @@ -2057,7 +2056,7 @@ TEST_F(PeerConnectionInterfaceTest, RemoveTrackThenRejectMediaContent) { remote_stream->RemoveTrack(remote_stream->GetVideoTracks()[0]); remote_stream->RemoveTrack(remote_stream->GetAudioTracks()[0]); - rtc::scoped_ptr local_answer( + std::unique_ptr local_answer( webrtc::CreateSessionDescription(SessionDescriptionInterface::kAnswer, kSdpStringWithStream1, nullptr)); cricket::ContentInfo* video_info = @@ -2231,10 +2230,10 @@ TEST_F(PeerConnectionInterfaceTest, LocalDescriptionChanged) { CreatePeerConnection(&constraints); // Create an offer just to ensure we have an identity before we manually // call SetLocalDescription. - rtc::scoped_ptr throwaway; + std::unique_ptr throwaway; ASSERT_TRUE(DoCreateOffer(&throwaway, nullptr)); - rtc::scoped_ptr desc_1 = + std::unique_ptr desc_1 = CreateSessionDescriptionAndReference(2, 2); pc_->AddStream(reference_collection_->at(0)); @@ -2248,7 +2247,7 @@ TEST_F(PeerConnectionInterfaceTest, LocalDescriptionChanged) { // Remove an audio and video track. pc_->RemoveStream(reference_collection_->at(0)); - rtc::scoped_ptr desc_2 = + std::unique_ptr desc_2 = CreateSessionDescriptionAndReference(1, 1); pc_->AddStream(reference_collection_->at(0)); EXPECT_TRUE(DoSetLocalDescription(desc_2.release())); @@ -2270,10 +2269,10 @@ TEST_F(PeerConnectionInterfaceTest, CreatePeerConnection(&constraints); // Create an offer just to ensure we have an identity before we manually // call SetLocalDescription. - rtc::scoped_ptr throwaway; + std::unique_ptr throwaway; ASSERT_TRUE(DoCreateOffer(&throwaway, nullptr)); - rtc::scoped_ptr desc_1 = + std::unique_ptr desc_1 = CreateSessionDescriptionAndReference(2, 2); EXPECT_TRUE(DoSetLocalDescription(desc_1.release())); @@ -2299,10 +2298,10 @@ TEST_F(PeerConnectionInterfaceTest, CreatePeerConnection(&constraints); // Create an offer just to ensure we have an identity before we manually // call SetLocalDescription. - rtc::scoped_ptr throwaway; + std::unique_ptr throwaway; ASSERT_TRUE(DoCreateOffer(&throwaway, nullptr)); - rtc::scoped_ptr desc = + std::unique_ptr desc = CreateSessionDescriptionAndReference(1, 1); std::string sdp; desc->ToString(&sdp); @@ -2323,7 +2322,7 @@ TEST_F(PeerConnectionInterfaceTest, 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 updated_desc( + std::unique_ptr updated_desc( webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer, sdp, nullptr)); @@ -2346,10 +2345,10 @@ TEST_F(PeerConnectionInterfaceTest, CreatePeerConnection(&constraints); // Create an offer just to ensure we have an identity before we manually // call SetLocalDescription. - rtc::scoped_ptr throwaway; + std::unique_ptr throwaway; ASSERT_TRUE(DoCreateOffer(&throwaway, nullptr)); - rtc::scoped_ptr desc = + std::unique_ptr desc = CreateSessionDescriptionAndReference(1, 1); std::string sdp; desc->ToString(&sdp); @@ -2372,7 +2371,7 @@ TEST_F(PeerConnectionInterfaceTest, rtc::replace_substrs(kStreams[0], strlen(kStreams[0]), kStreams[1], strlen(kStreams[1]), &sdp); - rtc::scoped_ptr updated_desc( + std::unique_ptr updated_desc( webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer, sdp, nullptr)); diff --git a/webrtc/api/proxy.h b/webrtc/api/proxy.h index 663e6c8873..2df85c4bf4 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 + #include "webrtc/base/event.h" #include "webrtc/base/thread.h" @@ -117,7 +119,7 @@ class SynchronousMethodCall private: void OnMessage(rtc::Message*) { proxy_->OnMessage(NULL); e_->Set(); } - rtc::scoped_ptr e_; + std::unique_ptr e_; rtc::MessageHandler* proxy_; }; diff --git a/webrtc/api/proxy_unittest.cc b/webrtc/api/proxy_unittest.cc index 557c85bf11..931ba28eba 100644 --- a/webrtc/api/proxy_unittest.cc +++ b/webrtc/api/proxy_unittest.cc @@ -10,12 +10,12 @@ #include "webrtc/api/proxy.h" +#include #include #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 @@ class SignalingProxyTest : public testing::Test { } protected: - rtc::scoped_ptr signaling_thread_; + std::unique_ptr signaling_thread_; rtc::scoped_refptr fake_signaling_proxy_; rtc::scoped_refptr fake_; }; @@ -175,7 +175,7 @@ class ProxyTest : public SignalingProxyTest { } protected: - rtc::scoped_ptr worker_thread_; + std::unique_ptr worker_thread_; rtc::scoped_refptr fake_proxy_; }; diff --git a/webrtc/api/remoteaudiosource.cc b/webrtc/api/remoteaudiosource.cc index 23cd65cbd8..2d0785a08f 100644 --- a/webrtc/api/remoteaudiosource.cc +++ b/webrtc/api/remoteaudiosource.cc @@ -12,6 +12,7 @@ #include #include +#include #include #include "webrtc/api/mediastreamprovider.h" @@ -81,7 +82,7 @@ void RemoteAudioSource::Initialize(uint32_t ssrc, // we register for callbacks here and not on demand in AddSink. if (provider) { // May be null in tests. provider->SetRawAudioSink( - ssrc, rtc::scoped_ptr(new Sink(this))); + ssrc, std::unique_ptr(new Sink(this))); } } diff --git a/webrtc/api/rtpsender.h b/webrtc/api/rtpsender.h index 3919e070dc..fe61cbde76 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 #include #include "webrtc/api/mediastreamprovider.h" @@ -119,7 +120,7 @@ class AudioRtpSender : public ObserverInterface, // Used to pass the data callback from the |track_| to the other end of // cricket::AudioSource. - rtc::scoped_ptr sink_adapter_; + std::unique_ptr sink_adapter_; }; class VideoRtpSender : public ObserverInterface, diff --git a/webrtc/api/rtpsenderreceiver_unittest.cc b/webrtc/api/rtpsenderreceiver_unittest.cc index 188264e7b2..4cd142567a 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 #include #include @@ -58,12 +59,12 @@ class MockAudioProvider : public AudioProviderInterface { bool(uint32_t ssrc, const RtpParameters&)); void SetRawAudioSink(uint32_t, - rtc::scoped_ptr sink) override { + std::unique_ptr sink) override { sink_ = std::move(sink); } private: - rtc::scoped_ptr sink_; + std::unique_ptr sink_; }; // Helper class to test RtpSender/RtpReceiver. diff --git a/webrtc/api/statscollector_unittest.cc b/webrtc/api/statscollector_unittest.cc index 8effb92242..760db0f231 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 @@ class StatsCollectorTest : public testing::Test { void TestCertificateReports( const rtc::FakeSSLCertificate& local_cert, const std::vector& local_ders, - rtc::scoped_ptr remote_cert, + std::unique_ptr remote_cert, const std::vector& remote_ders) { StatsCollectorForTest stats(&pc_); @@ -758,8 +757,8 @@ class StatsCollectorTest : public testing::Test { } cricket::FakeMediaEngine* media_engine_; - rtc::scoped_ptr channel_manager_; - rtc::scoped_ptr media_controller_; + std::unique_ptr channel_manager_; + std::unique_ptr media_controller_; MockWebRtcSession session_; MockPeerConnection pc_; FakeDataChannelProvider data_channel_provider_; @@ -1340,7 +1339,7 @@ TEST_F(StatsCollectorTest, ChainedCertificateReportsCreated) { remote_ders[1] = "non-"; remote_ders[2] = "intersecting"; remote_ders[3] = "set"; - rtc::scoped_ptr remote_cert( + std::unique_ptr remote_cert( new rtc::FakeSSLCertificate(DersToPems(remote_ders))); TestCertificateReports(local_cert, local_ders, std::move(remote_cert), @@ -1356,7 +1355,7 @@ TEST_F(StatsCollectorTest, ChainlessCertificateReportsCreated) { // Build remote certificate. std::string remote_der = "This is somebody else's der."; - rtc::scoped_ptr remote_cert( + std::unique_ptr remote_cert( new rtc::FakeSSLCertificate(DerToPem(remote_der))); TestCertificateReports(local_cert, std::vector(1, local_der), @@ -1446,7 +1445,7 @@ TEST_F(StatsCollectorTest, NoCertificates) { transport_stats; // Fake transport object. - rtc::scoped_ptr transport( + std::unique_ptr transport( new cricket::FakeTransport(transport_stats.transport_name)); // Configure MockWebRtcSession @@ -1480,7 +1479,7 @@ TEST_F(StatsCollectorTest, UnsupportedDigestIgnored) { // Build a remote certificate with an unsupported digest algorithm. std::string remote_der = "This is somebody else's der."; - rtc::scoped_ptr remote_cert( + std::unique_ptr 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 9200bdf6f3..30ad3f8b71 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 + #include "webrtc/base/basictypes.h" #include "webrtc/base/criticalsection.h" #include "webrtc/base/messagehandler.h" @@ -247,7 +249,7 @@ class FakeAudioCaptureModule bool started_; uint32_t next_frame_time_; - rtc::scoped_ptr process_thread_; + std::unique_ptr 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 bd593c2ab5..39a8f0134d 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 #include #include "webrtc/api/datachannelinterface.h" @@ -44,7 +45,7 @@ class MockCreateSessionDescriptionObserver private: bool called_; bool result_; - rtc::scoped_ptr desc_; + std::unique_ptr desc_; }; class MockSetSessionDescriptionObserver diff --git a/webrtc/api/test/peerconnectiontestwrapper.cc b/webrtc/api/test/peerconnectiontestwrapper.cc index 038980ce56..717c48af13 100644 --- a/webrtc/api/test/peerconnectiontestwrapper.cc +++ b/webrtc/api/test/peerconnectiontestwrapper.cc @@ -55,7 +55,7 @@ PeerConnectionTestWrapper::~PeerConnectionTestWrapper() {} bool PeerConnectionTestWrapper::CreatePc( const MediaConstraintsInterface* constraints) { - rtc::scoped_ptr port_allocator( + std::unique_ptr port_allocator( new cricket::FakePortAllocator(worker_thread_, nullptr)); fake_audio_capture_module_ = FakeAudioCaptureModule::Create(); @@ -75,9 +75,9 @@ bool PeerConnectionTestWrapper::CreatePc( webrtc::PeerConnectionInterface::IceServer ice_server; ice_server.uri = "stun:stun.l.google.com:19302"; config.servers.push_back(ice_server); - rtc::scoped_ptr dtls_identity_store( - rtc::SSLStreamAdapter::HaveDtlsSrtp() ? - new FakeDtlsIdentityStore() : nullptr); + std::unique_ptr 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::OnDataChannel( void PeerConnectionTestWrapper::OnSuccess(SessionDescriptionInterface* desc) { // This callback should take the ownership of |desc|. - rtc::scoped_ptr owned_desc(desc); + std::unique_ptr owned_desc(desc); std::string sdp; EXPECT_TRUE(desc->ToString(&sdp)); @@ -183,7 +183,7 @@ void PeerConnectionTestWrapper::SetRemoteDescription(const std::string& type, void PeerConnectionTestWrapper::AddIceCandidate(const std::string& sdp_mid, int sdp_mline_index, const std::string& candidate) { - rtc::scoped_ptr owned_candidate( + std::unique_ptr 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 f744b57c22..7a9bea46b0 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 + #include "webrtc/api/peerconnectioninterface.h" #include "webrtc/api/test/fakeaudiocapturemodule.h" #include "webrtc/api/test/fakeconstraints.h" @@ -94,7 +96,7 @@ class PeerConnectionTestWrapper rtc::scoped_refptr peer_connection_factory_; rtc::scoped_refptr fake_audio_capture_module_; - rtc::scoped_ptr renderer_; + std::unique_ptr renderer_; }; #endif // WEBRTC_API_TEST_PEERCONNECTIONTESTWRAPPER_H_ diff --git a/webrtc/api/videocapturertracksource.h b/webrtc/api/videocapturertracksource.h index 2eb7b50741..fa4ef0709b 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 + #include "webrtc/api/mediastreaminterface.h" #include "webrtc/api/videotracksource.h" #include "webrtc/base/asyncinvoker.h" @@ -73,7 +75,7 @@ class VideoCapturerTrackSource : public VideoTrackSource, rtc::Thread* signaling_thread_; rtc::Thread* worker_thread_; rtc::AsyncInvoker invoker_; - rtc::scoped_ptr video_capturer_; + std::unique_ptr video_capturer_; bool started_; cricket::VideoFormat format_; rtc::Optional needs_denoising_; diff --git a/webrtc/api/videocapturertracksource_unittest.cc b/webrtc/api/videocapturertracksource_unittest.cc index 6b0d07b0e0..90d2cd2563 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 #include #include @@ -109,7 +110,7 @@ class VideoCapturerTrackSourceTest : public testing::Test { protected: VideoCapturerTrackSourceTest() { InitCapturer(false); } void InitCapturer(bool is_screencast) { - capturer_cleanup_ = rtc::scoped_ptr( + capturer_cleanup_ = std::unique_ptr( new TestVideoCapturer(is_screencast)); capturer_ = capturer_cleanup_.get(); } @@ -132,10 +133,10 @@ class VideoCapturerTrackSourceTest : public testing::Test { source_->AddOrUpdateSink(&renderer_, rtc::VideoSinkWants()); } - rtc::scoped_ptr capturer_cleanup_; + std::unique_ptr capturer_cleanup_; TestVideoCapturer* capturer_; cricket::FakeVideoRenderer renderer_; - rtc::scoped_ptr state_observer_; + std::unique_ptr state_observer_; rtc::scoped_refptr source_; }; diff --git a/webrtc/api/videotrack_unittest.cc b/webrtc/api/videotrack_unittest.cc index b1cd0a6739..0b67c77829 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 #include #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 @@ TEST_F(VideoTrackTest, SourceStateChangeTrackState) { // frames to the source. TEST_F(VideoTrackTest, RenderVideo) { // FakeVideoTrackRenderer register itself to |video_track_| - rtc::scoped_ptr renderer_1( + std::unique_ptr 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 renderer_2( + std::unique_ptr renderer_2( new FakeVideoTrackRenderer(video_track_.get())); capturer_.CaptureFrame(); EXPECT_EQ(2, renderer_1->num_rendered_frames()); @@ -75,7 +75,7 @@ TEST_F(VideoTrackTest, RenderVideo) { // Test that disabling the track results in blacked out frames. TEST_F(VideoTrackTest, DisableTrackBlackout) { - rtc::scoped_ptr renderer( + std::unique_ptr renderer( new FakeVideoTrackRenderer(video_track_.get())); capturer_.CaptureFrame(); diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc index 10f99224f8..b86d9038dd 100644 --- a/webrtc/api/webrtcsdp.cc +++ b/webrtc/api/webrtcsdp.cc @@ -13,7 +13,9 @@ #include #include #include + #include +#include #include #include #include @@ -2307,7 +2309,7 @@ bool ParseMediaDescription(const std::string& message, session_td.ice_mode, session_td.connection_role, session_td.identity_fingerprint.get()); - rtc::scoped_ptr content; + std::unique_ptr content; std::string content_name; if (HasAttribute(line, kMediaTypeVideo)) { content.reset(ParseContentDescription( diff --git a/webrtc/api/webrtcsdp_unittest.cc b/webrtc/api/webrtcsdp_unittest.cc index f222b3fc9a..4bc84fdc12 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 #include #include #include @@ -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 @@ class WebRtcSdpTest : public testing::Test { } void AddSctpDataChannel() { - rtc::scoped_ptr data( - new DataContentDescription()); + std::unique_ptr data(new DataContentDescription()); data_desc_ = data.get(); data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); DataCodec codec(cricket::kGoogleSctpDataCodecId, @@ -1408,8 +1407,7 @@ class WebRtcSdpTest : public testing::Test { } void AddRtpDataChannel() { - rtc::scoped_ptr data( - new DataContentDescription()); + std::unique_ptr data(new DataContentDescription()); data_desc_ = data.get(); data_desc_->AddCodec(DataCodec(101, "google-data")); @@ -1679,7 +1677,7 @@ class WebRtcSdpTest : public testing::Test { VideoContentDescription* video_desc_; DataContentDescription* data_desc_; Candidates candidates_; - rtc::scoped_ptr jcandidate_; + std::unique_ptr jcandidate_; JsepSessionDescription jdesc_; }; @@ -2082,8 +2080,8 @@ TEST_F(WebRtcSdpTest, SerializeTcpCandidates) { "", "", LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); candidate.set_tcptype(cricket::TCPTYPE_ACTIVE_STR); - rtc::scoped_ptr jcandidate( - new JsepIceCandidate(std::string("audio_content_name"), 0, candidate)); + std::unique_ptr 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 @@ TEST_F(WebRtcSdpTest, DeserializeCandidate) { rtc::SocketAddress("192.168.1.5", 9), kCandidatePriority, "", "", LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); - rtc::scoped_ptr jcandidate_template( - new JsepIceCandidate(std::string("audio_content_name"), 0, candidate)); + std::unique_ptr 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 1cf7924fb7..9f84840822 100644 --- a/webrtc/api/webrtcsession.cc +++ b/webrtc/api/webrtcsession.cc @@ -528,7 +528,7 @@ WebRtcSession::~WebRtcSession() { bool WebRtcSession::Initialize( const PeerConnectionFactoryInterface::Options& options, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr 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 @@ bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc, ASSERT(signaling_thread()->IsCurrent()); // Takes the ownership of |desc| regardless of the result. - rtc::scoped_ptr desc_temp(desc); + std::unique_ptr desc_temp(desc); // Validate SDP. if (!ValidateSessionDescription(desc, cricket::CS_LOCAL, err_desc)) { @@ -731,14 +731,14 @@ bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc, ASSERT(signaling_thread()->IsCurrent()); // Takes the ownership of |desc| regardless of the result. - rtc::scoped_ptr desc_temp(desc); + std::unique_ptr desc_temp(desc); // Validate SDP. if (!ValidateSessionDescription(desc, cricket::CS_REMOTE, err_desc)) { return false; } - rtc::scoped_ptr old_remote_desc( + std::unique_ptr old_remote_desc( remote_desc_.release()); remote_desc_.reset(desc_temp.release()); @@ -1236,7 +1236,7 @@ void WebRtcSession::SetAudioPlayoutVolume(uint32_t ssrc, double volume) { } void WebRtcSession::SetRawAudioSink(uint32_t ssrc, - rtc::scoped_ptr sink) { + std::unique_ptr sink) { ASSERT(signaling_thread()->IsCurrent()); if (!voice_channel_) return; diff --git a/webrtc/api/webrtcsession.h b/webrtc/api/webrtcsession.h index 08938fc9f6..89b77bbc88 100644 --- a/webrtc/api/webrtcsession.h +++ b/webrtc/api/webrtcsession.h @@ -153,7 +153,7 @@ class WebRtcSession : public AudioProviderInterface, bool Initialize( const PeerConnectionFactoryInterface::Options& options, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr 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 @@ class WebRtcSession : public AudioProviderInterface, cricket::AudioSource* source) override; void SetAudioPlayoutVolume(uint32_t ssrc, double volume) override; void SetRawAudioSink(uint32_t ssrc, - rtc::scoped_ptr sink) override; + std::unique_ptr sink) override; RtpParameters GetAudioRtpParameters(uint32_t ssrc) const override; bool SetAudioRtpParameters(uint32_t ssrc, @@ -479,17 +479,17 @@ class WebRtcSession : public AudioProviderInterface, const std::string sid_; bool initial_offerer_ = false; - rtc::scoped_ptr transport_controller_; + std::unique_ptr transport_controller_; MediaControllerInterface* media_controller_; - rtc::scoped_ptr voice_channel_; - rtc::scoped_ptr video_channel_; - rtc::scoped_ptr data_channel_; + std::unique_ptr voice_channel_; + std::unique_ptr video_channel_; + std::unique_ptr data_channel_; cricket::ChannelManager* channel_manager_; IceObserver* ice_observer_; PeerConnectionInterface::IceConnectionState ice_connection_state_; bool ice_connection_receiving_; - rtc::scoped_ptr local_desc_; - rtc::scoped_ptr remote_desc_; + std::unique_ptr local_desc_; + std::unique_ptr 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 @@ class WebRtcSession : public AudioProviderInterface, // List of content names for which the remote side triggered an ICE restart. std::set pending_ice_restarts_; - rtc::scoped_ptr - webrtc_session_desc_factory_; + std::unique_ptr 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 4cb6cc441e..24e830eed9 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 @@ class WebRtcSessionCreateSDPObserverForTest ~WebRtcSessionCreateSDPObserverForTest() {} private: - rtc::scoped_ptr description_; + std::unique_ptr description_; State state_; }; @@ -376,7 +375,7 @@ class WebRtcSessionTest // used if provided, otherwise one will be generated using the // |dtls_identity_store|. void Init( - rtc::scoped_ptr dtls_identity_store) { + std::unique_ptr 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 @@ class WebRtcSessionTest // 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 dtls_identity_store; + std::unique_ptr dtls_identity_store; if (cert_gen_method == ALREADY_GENERATED) { configuration_.certificates.push_back( FakeDtlsIdentityStore::GenerateCertificate()); @@ -443,7 +442,7 @@ class WebRtcSessionTest // Init with DTLS with a store that will fail to generate a certificate. void InitWithDtlsIdentityGenFail() { - rtc::scoped_ptr dtls_identity_store( + std::unique_ptr dtls_identity_store( new FakeDtlsIdentityStore()); dtls_identity_store->set_should_fail(true); Init(std::move(dtls_identity_store)); @@ -727,12 +726,12 @@ class WebRtcSessionTest cricket::MediaSessionOptions options; options.recv_video = true; options.bundle_enabled = true; - scoped_ptr offer( + std::unique_ptr offer( CreateRemoteOffer(options, cricket::SEC_REQUIRED)); ASSERT_TRUE(offer.get() != NULL); VerifyCryptoParams(offer->description()); SetRemoteDescriptionWithoutError(offer.release()); - scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); ASSERT_TRUE(answer.get() != NULL); VerifyCryptoParams(answer->description()); } @@ -931,7 +930,7 @@ class WebRtcSessionTest options.recv_video = true; options.bundle_enabled = true; - rtc::scoped_ptr temp_offer( + std::unique_ptr temp_offer( CreateRemoteOffer(options, cricket::SEC_ENABLED)); *nodtls_answer = @@ -1070,7 +1069,7 @@ class WebRtcSessionTest // and answer. SetLocalDescriptionWithoutError(offer); - rtc::scoped_ptr answer( + std::unique_ptr answer( CreateRemoteAnswer(session_->local_description())); std::string sdp; EXPECT_TRUE(answer->ToString(&sdp)); @@ -1371,8 +1370,8 @@ class WebRtcSessionTest SetFactoryDtlsSrtp(); if (type == CreateSessionDescriptionRequest::kAnswer) { cricket::MediaSessionOptions options; - scoped_ptr offer( - CreateRemoteOffer(options, cricket::SEC_DISABLED)); + std::unique_ptr offer( + CreateRemoteOffer(options, cricket::SEC_DISABLED)); ASSERT_TRUE(offer.get() != NULL); SetRemoteDescriptionWithoutError(offer.release()); } @@ -1418,23 +1417,23 @@ class WebRtcSessionTest cricket::FakeMediaEngine* media_engine_; cricket::FakeDataEngine* data_engine_; - rtc::scoped_ptr channel_manager_; + std::unique_ptr channel_manager_; cricket::FakeCall fake_call_; - rtc::scoped_ptr media_controller_; - rtc::scoped_ptr tdesc_factory_; - rtc::scoped_ptr desc_factory_; - rtc::scoped_ptr pss_; - rtc::scoped_ptr vss_; - rtc::scoped_ptr fss_; + std::unique_ptr media_controller_; + std::unique_ptr tdesc_factory_; + std::unique_ptr desc_factory_; + std::unique_ptr pss_; + std::unique_ptr vss_; + std::unique_ptr fss_; rtc::SocketServerScope ss_scope_; rtc::SocketAddress stun_socket_addr_; - rtc::scoped_ptr stun_server_; + std::unique_ptr stun_server_; cricket::TestTurnServer turn_server_; rtc::FakeNetworkManager network_manager_; - rtc::scoped_ptr allocator_; + std::unique_ptr allocator_; PeerConnectionFactoryInterface::Options options_; PeerConnectionInterface::RTCConfiguration configuration_; - rtc::scoped_ptr session_; + std::unique_ptr session_; MockIceObserver observer_; cricket::FakeVideoMediaChannel* video_channel_; cricket::FakeVoiceMediaChannel* voice_channel_; @@ -1872,7 +1871,7 @@ TEST_P(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) { SessionDescriptionInterface* offer = CreateOffer(); cricket::MediaSessionOptions options; options.recv_video = true; - rtc::scoped_ptr temp_offer( + std::unique_ptr temp_offer( CreateRemoteOffer(options, cricket::SEC_ENABLED)); JsepSessionDescription* answer = CreateRemoteAnswer(temp_offer.get(), options, cricket::SEC_ENABLED); @@ -2098,7 +2097,7 @@ TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) { TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) { Init(); SendNothing(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); SessionDescriptionInterface* answer = CreateRemoteAnswer(offer.get()); @@ -2109,7 +2108,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) { TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) { Init(); SendNothing(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); SessionDescriptionInterface* answer = CreateRemoteAnswer(offer.get()); @@ -2348,7 +2347,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) { EXPECT_TRUE_WAIT(0u < observer_.mline_0_candidates_.size(), kIceCandidatesTimeout); - rtc::scoped_ptr local_offer(CreateOffer()); + std::unique_ptr 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, TestSetLocalAndRemoteDescriptionWithCandidates) { TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) { Init(); SendAudioVideoStream1(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr 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 @@ TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) { // the send streams when no constraints have been set. TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) { Init(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); ASSERT_TRUE(offer != NULL); const cricket::ContentInfo* content = @@ -2431,7 +2430,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) { Init(); // Test Audio only offer. SendAudioOnlyStream2(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); const cricket::ContentInfo* content = cricket::GetFirstAudioContent(offer->description()); @@ -2456,8 +2455,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) { options.offer_to_receive_audio = 0; options.offer_to_receive_video = 0; - rtc::scoped_ptr offer( - CreateOffer(options)); + std::unique_ptr offer(CreateOffer(options)); ASSERT_TRUE(offer != NULL); const cricket::ContentInfo* content = @@ -2475,8 +2473,7 @@ TEST_F(WebRtcSessionTest, CreateAudioOnlyOfferWithConstraints) { options.offer_to_receive_audio = RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; - rtc::scoped_ptr offer( - CreateOffer(options)); + std::unique_ptr offer(CreateOffer(options)); const cricket::ContentInfo* content = cricket::GetFirstAudioContent(offer->description()); @@ -2496,8 +2493,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithConstraints) { options.offer_to_receive_video = RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; - rtc::scoped_ptr offer( - CreateOffer(options)); + std::unique_ptr offer(CreateOffer(options)); const cricket::ContentInfo* content = cricket::GetFirstAudioContent(offer->description()); @@ -2534,9 +2530,9 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithoutAnOffer) { TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraintsOrStreams) { Init(); // Create a remote offer with audio and video content. - rtc::scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr offer(CreateRemoteOffer()); SetRemoteDescriptionWithoutError(offer.release()); - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); const cricket::ContentInfo* content = cricket::GetFirstAudioContent(answer->description()); ASSERT_TRUE(content != NULL); @@ -2554,13 +2550,12 @@ TEST_F(WebRtcSessionTest, CreateAudioAnswerWithoutConstraintsOrStreams) { // Create a remote offer with audio only. cricket::MediaSessionOptions options; - rtc::scoped_ptr offer( - CreateRemoteOffer(options)); + std::unique_ptr offer(CreateRemoteOffer(options)); ASSERT_TRUE(cricket::GetFirstVideoContent(offer->description()) == NULL); ASSERT_TRUE(cricket::GetFirstAudioContent(offer->description()) != NULL); SetRemoteDescriptionWithoutError(offer.release()); - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); const cricket::ContentInfo* content = cricket::GetFirstAudioContent(answer->description()); ASSERT_TRUE(content != NULL); @@ -2574,11 +2569,11 @@ TEST_F(WebRtcSessionTest, CreateAudioAnswerWithoutConstraintsOrStreams) { TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) { Init(); // Create a remote offer with audio and video content. - rtc::scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr offer(CreateRemoteOffer()); SetRemoteDescriptionWithoutError(offer.release()); // Test with a stream with tracks. SendAudioVideoStream1(); - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); const cricket::ContentInfo* content = cricket::GetFirstAudioContent(answer->description()); ASSERT_TRUE(content != NULL); @@ -2594,13 +2589,13 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) { TEST_F(WebRtcSessionTest, CreateAnswerWithConstraintsWithoutStreams) { Init(); // Create a remote offer with audio and video content. - rtc::scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr offer(CreateRemoteOffer()); SetRemoteDescriptionWithoutError(offer.release()); cricket::MediaSessionOptions session_options; session_options.recv_audio = false; session_options.recv_video = false; - rtc::scoped_ptr answer( + std::unique_ptr answer( CreateAnswer(session_options)); const cricket::ContentInfo* content = @@ -2618,7 +2613,7 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithConstraintsWithoutStreams) { TEST_F(WebRtcSessionTest, CreateAnswerWithConstraints) { Init(); // Create a remote offer with audio and video content. - rtc::scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr offer(CreateRemoteOffer()); SetRemoteDescriptionWithoutError(offer.release()); cricket::MediaSessionOptions options; @@ -2627,7 +2622,7 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithConstraints) { // Test with a stream with tracks. SendAudioVideoStream1(); - rtc::scoped_ptr answer(CreateAnswer(options)); + std::unique_ptr answer(CreateAnswer(options)); // TODO(perkj): Should the direction be set to SEND_ONLY? const cricket::ContentInfo* content = @@ -2649,8 +2644,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithoutCNCodecs) { RTCOfferAnswerOptions::kOfferToReceiveMediaTrue; options.voice_activity_detection = false; - rtc::scoped_ptr offer( - CreateOffer(options)); + std::unique_ptr offer(CreateOffer(options)); const cricket::ContentInfo* content = cricket::GetFirstAudioContent(offer->description()); @@ -2662,12 +2656,12 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithoutCNCodecs) { AddCNCodecs(); Init(); // Create a remote offer with audio and video content. - rtc::scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr offer(CreateRemoteOffer()); SetRemoteDescriptionWithoutError(offer.release()); cricket::MediaSessionOptions options; options.vad_enabled = false; - rtc::scoped_ptr answer(CreateAnswer(options)); + std::unique_ptr answer(CreateAnswer(options)); const cricket::ContentInfo* content = cricket::GetFirstAudioContent(answer->description()); ASSERT_TRUE(content != NULL); @@ -2789,10 +2783,10 @@ TEST_F(WebRtcSessionTest, TestAVOfferWithVideoOnlyAnswer) { TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) { Init(); SendAudioVideoStream1(); - scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); VerifyCryptoParams(offer->description()); SetRemoteDescriptionWithoutError(offer.release()); - scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); VerifyCryptoParams(answer->description()); } @@ -2800,7 +2794,7 @@ TEST_F(WebRtcSessionTest, VerifyNoCryptoParamsInSDP) { options_.disable_encryption = true; Init(); SendAudioVideoStream1(); - scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); VerifyNoCryptoParams(offer->description(), false); } @@ -2819,7 +2813,7 @@ TEST_F(WebRtcSessionTest, VerifyAnswerFromCryptoOffer) { TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) { Init(); SendAudioVideoStream1(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); std::string sdp; RemoveIceUfragPwdLines(offer.get(), &sdp); @@ -2832,7 +2826,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) { // no a=ice-ufrag and a=ice-pwd lines are present in the SDP. TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) { Init(); - rtc::scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr offer(CreateRemoteOffer()); std::string sdp; RemoveIceUfragPwdLines(offer.get(), &sdp); SessionDescriptionInterface* modified_offer = @@ -2845,7 +2839,7 @@ TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) { TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) { Init(); SendAudioVideoStream1(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr 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 @@ TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) { // too short ice ufrag and pwd strings. TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionInvalidIceCredentials) { Init(); - rtc::scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr 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 @@ TEST_F(WebRtcSessionTest, TestSetRemoteOfferWithIceRestart) { Init(); // Create the first offer. - scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr 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 @@ TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithIceRestart) { SetLocalDescriptionWithoutError(offer); // Create the first answer. - scoped_ptr answer(CreateRemoteAnswer(offer)); + std::unique_ptr 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 @@ TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) { SendAudioVideoStream2(); // Remove BUNDLE from the answer. - rtc::scoped_ptr answer( + std::unique_ptr answer( CreateRemoteAnswer(session_->local_description())); cricket::SessionDescription* answer_copy = answer->description()->Copy(); answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); @@ -3178,7 +3172,7 @@ TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) { SendAudioVideoStream2(); // Remove BUNDLE from the answer. - rtc::scoped_ptr answer( + std::unique_ptr answer( CreateRemoteAnswer(session_->local_description())); cricket::SessionDescription* answer_copy = answer->description()->Copy(); answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); @@ -3216,7 +3210,7 @@ TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInRemoteOffer) { SendAudioVideoStream1(); // Remove BUNDLE from the offer. - rtc::scoped_ptr offer(CreateRemoteOffer()); + std::unique_ptr offer(CreateRemoteOffer()); cricket::SessionDescription* offer_copy = offer->description()->Copy(); offer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); JsepSessionDescription* modified_offer = @@ -3269,7 +3263,7 @@ TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) { SendAudioVideoStream2(); // Remove BUNDLE from the answer. - rtc::scoped_ptr answer( + std::unique_ptr answer( CreateRemoteAnswer(session_->local_description())); cricket::SessionDescription* answer_copy = answer->description()->Copy(); answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE); @@ -3427,7 +3421,7 @@ TEST_F(WebRtcSessionTest, SetAudioSend) { cricket::AudioOptions options; options.echo_cancellation = rtc::Optional(true); - rtc::scoped_ptr source(new FakeAudioSource()); + std::unique_ptr source(new FakeAudioSource()); session_->SetAudioSend(send_ssrc, false, options, source.get()); EXPECT_TRUE(channel->IsStreamMuted(send_ssrc)); EXPECT_EQ(rtc::Optional(), channel->options().echo_cancellation); @@ -3449,7 +3443,7 @@ TEST_F(WebRtcSessionTest, AudioSourceForLocalStream) { ASSERT_EQ(1u, channel->send_streams().size()); uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); - rtc::scoped_ptr source(new FakeAudioSource()); + std::unique_ptr source(new FakeAudioSource()); cricket::AudioOptions options; session_->SetAudioSend(send_ssrc, true, options, source.get()); EXPECT_TRUE(source->sink() != nullptr); @@ -3589,7 +3583,7 @@ TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) { SendAudioVideoStream1(); SessionDescriptionInterface* offer = CreateOffer(); SetLocalDescriptionWithoutError(offer); - rtc::scoped_ptr answer( + std::unique_ptr answer( CreateRemoteAnswer(session_->local_description())); cricket::SessionDescription* answer_copy = answer->description()->Copy(); @@ -3686,7 +3680,7 @@ TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) { TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) { Init(); SendAudioVideoStream1(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); // Making sure SetLocalDescription correctly sets crypto value in // SessionDescription object after de-serialization of sdp string. The value @@ -3705,7 +3699,7 @@ TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) { options_.disable_encryption = true; Init(); SendAudioVideoStream1(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); // Making sure SetLocalDescription correctly sets crypto value in // SessionDescription object after de-serialization of sdp string. The value @@ -3725,12 +3719,11 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) { Init(); cricket::MediaSessionOptions options; options.recv_video = true; - rtc::scoped_ptr offer( - CreateRemoteOffer(options)); + std::unique_ptr offer(CreateRemoteOffer(options)); SetRemoteDescriptionWithoutError(offer.release()); SendAudioVideoStream1(); - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); SetLocalDescriptionWithoutError(answer.release()); // Receive an offer with new ufrag and password. @@ -3738,18 +3731,18 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewUfragAndPassword) { session_->local_description()->description()->contents()) { options.transport_options[content.name].ice_restart = true; } - rtc::scoped_ptr updated_offer1( + std::unique_ptr updated_offer1( CreateRemoteOffer(options, session_->remote_description())); SetRemoteDescriptionWithoutError(updated_offer1.release()); - rtc::scoped_ptr updated_answer1(CreateAnswer()); + std::unique_ptr 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 updated_answer2(CreateAnswer()); + std::unique_ptr updated_answer2(CreateAnswer()); EXPECT_FALSE(IceUfragPwdEqual(updated_answer2->description(), session_->local_description()->description())); @@ -3768,34 +3761,34 @@ TEST_F(WebRtcSessionTest, TestOfferChangingOnlyUfragOrPassword) { options.recv_audio = true; options.recv_video = true; // Create an offer with audio and video. - rtc::scoped_ptr offer(CreateRemoteOffer(options)); + std::unique_ptr offer(CreateRemoteOffer(options)); SetIceUfragPwd(offer.get(), "original_ufrag", "original_password12345"); SetRemoteDescriptionWithoutError(offer.release()); SendAudioVideoStream1(); - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); SetLocalDescriptionWithoutError(answer.release()); // Receive an offer with a new ufrag but stale password. - rtc::scoped_ptr ufrag_changed_offer( + std::unique_ptr 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 updated_answer1(CreateAnswer()); + std::unique_ptr 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 password_changed_offer( + std::unique_ptr 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 updated_answer2(CreateAnswer()); + std::unique_ptr updated_answer2(CreateAnswer()); EXPECT_FALSE(IceUfragPwdEqual(updated_answer2->description(), session_->local_description()->description())); SetLocalDescriptionWithoutError(updated_answer2.release()); @@ -3807,20 +3800,19 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerWithOldUfragAndPassword) { Init(); cricket::MediaSessionOptions options; options.recv_video = true; - rtc::scoped_ptr offer( - CreateRemoteOffer(options)); + std::unique_ptr offer(CreateRemoteOffer(options)); SetRemoteDescriptionWithoutError(offer.release()); SendAudioVideoStream1(); - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); SetLocalDescriptionWithoutError(answer.release()); // Receive an offer without changed ufrag or password. - rtc::scoped_ptr updated_offer2( + std::unique_ptr updated_offer2( CreateRemoteOffer(options, session_->remote_description())); SetRemoteDescriptionWithoutError(updated_offer2.release()); - rtc::scoped_ptr updated_answer2(CreateAnswer()); + std::unique_ptr updated_answer2(CreateAnswer()); EXPECT_TRUE(IceUfragPwdEqual(updated_answer2->description(), session_->local_description()->description())); @@ -3837,7 +3829,7 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewAndOldUfragAndPassword) { options.recv_video = true; options.recv_audio = true; options.bundle_enabled = false; - rtc::scoped_ptr offer(CreateRemoteOffer(options)); + std::unique_ptr offer(CreateRemoteOffer(options)); SetIceUfragPwd(offer.get(), cricket::MEDIA_TYPE_AUDIO, "aaaa", "aaaaaaaaaaaaaaaaaaaaaa"); @@ -3846,18 +3838,18 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerWithNewAndOldUfragAndPassword) { SetRemoteDescriptionWithoutError(offer.release()); SendAudioVideoStream1(); - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); SetLocalDescriptionWithoutError(answer.release()); // Receive an offer with new ufrag and password, but only for the video media // section. - rtc::scoped_ptr updated_offer( + std::unique_ptr updated_offer( CreateRemoteOffer(options, session_->remote_description())); SetIceUfragPwd(updated_offer.get(), cricket::MEDIA_TYPE_VIDEO, "cccc", "cccccccccccccccccccccc"); SetRemoteDescriptionWithoutError(updated_offer.release()); - rtc::scoped_ptr updated_answer(CreateAnswer()); + std::unique_ptr updated_answer(CreateAnswer()); EXPECT_TRUE(IceUfragPwdEqual(updated_answer->description(), session_->local_description()->description(), @@ -3950,7 +3942,7 @@ TEST_P(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) { InitWithDtls(GetParam()); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL); EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL); } @@ -3968,7 +3960,7 @@ TEST_P(WebRtcSessionTest, TestCreateAnswerWithSctpInOfferAndNoStreams) { SetRemoteDescriptionWithoutError(offer); // Verifies the answer contains SCTP. - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); EXPECT_TRUE(answer != NULL); EXPECT_TRUE(answer->description()->GetContentByName("data") != NULL); EXPECT_TRUE(answer->description()->GetTransportInfoByName("data") != NULL); @@ -4100,7 +4092,7 @@ TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { EXPECT_TRUE(session_->waiting_for_certificate_for_testing()); SendAudioVideoStream1(); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); EXPECT_TRUE(offer != NULL); VerifyNoCryptoParams(offer->description(), true); @@ -4117,12 +4109,12 @@ TEST_P(WebRtcSessionTest, TestCreateAnswerBeforeIdentityRequestReturnSuccess) { cricket::MediaSessionOptions options; options.recv_video = true; - scoped_ptr offer( - CreateRemoteOffer(options, cricket::SEC_DISABLED)); + std::unique_ptr offer( + CreateRemoteOffer(options, cricket::SEC_DISABLED)); ASSERT_TRUE(offer.get() != NULL); SetRemoteDescriptionWithoutError(offer.release()); - rtc::scoped_ptr answer(CreateAnswer()); + std::unique_ptr answer(CreateAnswer()); EXPECT_TRUE(answer != NULL); VerifyNoCryptoParams(answer->description(), true); VerifyFingerprintStatus(answer->description(), true); @@ -4137,7 +4129,7 @@ TEST_P(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) { EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); EXPECT_TRUE(offer != NULL); } @@ -4149,7 +4141,7 @@ TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) { EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); - rtc::scoped_ptr offer(CreateOffer()); + std::unique_ptr offer(CreateOffer()); EXPECT_TRUE(offer == NULL); } diff --git a/webrtc/api/webrtcsessiondescriptionfactory.cc b/webrtc/api/webrtcsessiondescriptionfactory.cc index 584125f989..e88262fbdc 100644 --- a/webrtc/api/webrtcsessiondescriptionfactory.cc +++ b/webrtc/api/webrtcsessiondescriptionfactory.cc @@ -64,7 +64,7 @@ struct CreateSessionDescriptionMsg : public rtc::MessageData { rtc::scoped_refptr observer; std::string error; - rtc::scoped_ptr description; + std::unique_ptr description; }; } // namespace @@ -127,7 +127,7 @@ void WebRtcSessionDescriptionFactory::CopyCandidatesFromSessionDescription( WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( rtc::Thread* signaling_thread, cricket::ChannelManager* channel_manager, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr dtls_identity_store, const rtc::scoped_refptr& identity_request_observer, WebRtcSession* session, @@ -168,7 +168,7 @@ WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( rtc::Thread* signaling_thread, cricket::ChannelManager* channel_manager, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr dtls_identity_store, WebRtcSession* session, const std::string& session_id) : WebRtcSessionDescriptionFactory( diff --git a/webrtc/api/webrtcsessiondescriptionfactory.h b/webrtc/api/webrtcsessiondescriptionfactory.h index 8d04bf1d17..17e2ddd3b0 100644 --- a/webrtc/api/webrtcsessiondescriptionfactory.h +++ b/webrtc/api/webrtcsessiondescriptionfactory.h @@ -85,7 +85,7 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler, WebRtcSessionDescriptionFactory( rtc::Thread* signaling_thread, cricket::ChannelManager* channel_manager, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr dtls_identity_store, WebRtcSession* session, const std::string& session_id); @@ -133,7 +133,7 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler, WebRtcSessionDescriptionFactory( rtc::Thread* signaling_thread, cricket::ChannelManager* channel_manager, - rtc::scoped_ptr dtls_identity_store, + std::unique_ptr dtls_identity_store, const rtc::scoped_refptr& identity_request_observer, WebRtcSession* session, @@ -164,7 +164,7 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler, cricket::TransportDescriptionFactory transport_desc_factory_; cricket::MediaSessionDescriptionFactory session_desc_factory_; uint64_t session_version_; - const rtc::scoped_ptr dtls_identity_store_; + const std::unique_ptr dtls_identity_store_; const rtc::scoped_refptr identity_request_observer_; // TODO(jiayl): remove the dependency on session once bug 2264 is fixed.