Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: webrtc/pc/peerconnectionfactory.cc

Issue 2685093002: Switching some interfaces to use std::unique_ptr<>. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (!default_network_manager_) { 202 if (!default_network_manager_) {
203 return false; 203 return false;
204 } 204 }
205 205
206 default_socket_factory_.reset( 206 default_socket_factory_.reset(
207 new rtc::BasicPacketSocketFactory(network_thread_)); 207 new rtc::BasicPacketSocketFactory(network_thread_));
208 if (!default_socket_factory_) { 208 if (!default_socket_factory_) {
209 return false; 209 return false;
210 } 210 }
211 211
212 // TODO: Need to make sure only one VoE is created inside 212 // TODO: Need to make sure only one VoE is created inside
nisse-webrtc 2017/02/13 08:25:58 When? Do you intend to ensure that before landing?
the sun 2017/02/13 09:02:31 This is an old comment (mid 2013) and nothing I'd
Taylor Brandstetter 2017/02/13 17:47:45 Removing comment.
213 // WebRtcMediaEngine. 213 // WebRtcMediaEngine.
214 cricket::MediaEngineInterface* media_engine = 214 std::unique_ptr<cricket::MediaEngineInterface> media_engine =
215 worker_thread_->Invoke<cricket::MediaEngineInterface*>( 215 worker_thread_->Invoke<std::unique_ptr<cricket::MediaEngineInterface>>(
216 RTC_FROM_HERE, 216 RTC_FROM_HERE,
217 rtc::Bind(&PeerConnectionFactory::CreateMediaEngine_w, this)); 217 rtc::Bind(&PeerConnectionFactory::CreateMediaEngine_w, this));
218 218
219 channel_manager_.reset(new cricket::ChannelManager( 219 channel_manager_.reset(new cricket::ChannelManager(
220 media_engine, worker_thread_, network_thread_)); 220 std::move(media_engine), worker_thread_, network_thread_));
221 221
222 channel_manager_->SetVideoRtxEnabled(true); 222 channel_manager_->SetVideoRtxEnabled(true);
223 channel_manager_->SetCryptoOptions(options_.crypto_options); 223 channel_manager_->SetCryptoOptions(options_.crypto_options);
224 if (!channel_manager_->Init()) { 224 if (!channel_manager_->Init()) {
225 return false; 225 return false;
226 } 226 }
227 227
228 return true; 228 return true;
229 } 229 }
230 230
(...skipping 16 matching lines...) Expand all
247 rtc::scoped_refptr<AudioSourceInterface> 247 rtc::scoped_refptr<AudioSourceInterface>
248 PeerConnectionFactory::CreateAudioSource(const cricket::AudioOptions& options) { 248 PeerConnectionFactory::CreateAudioSource(const cricket::AudioOptions& options) {
249 RTC_DCHECK(signaling_thread_->IsCurrent()); 249 RTC_DCHECK(signaling_thread_->IsCurrent());
250 rtc::scoped_refptr<LocalAudioSource> source( 250 rtc::scoped_refptr<LocalAudioSource> source(
251 LocalAudioSource::Create(options_, &options)); 251 LocalAudioSource::Create(options_, &options));
252 return source; 252 return source;
253 } 253 }
254 254
255 rtc::scoped_refptr<VideoTrackSourceInterface> 255 rtc::scoped_refptr<VideoTrackSourceInterface>
256 PeerConnectionFactory::CreateVideoSource( 256 PeerConnectionFactory::CreateVideoSource(
257 cricket::VideoCapturer* capturer, 257 std::unique_ptr<cricket::VideoCapturer> capturer,
258 const MediaConstraintsInterface* constraints) { 258 const MediaConstraintsInterface* constraints) {
259 RTC_DCHECK(signaling_thread_->IsCurrent()); 259 RTC_DCHECK(signaling_thread_->IsCurrent());
260 rtc::scoped_refptr<VideoTrackSourceInterface> source( 260 rtc::scoped_refptr<VideoTrackSourceInterface> source(
261 VideoCapturerTrackSource::Create(worker_thread_, capturer, constraints, 261 VideoCapturerTrackSource::Create(worker_thread_, std::move(capturer),
262 false)); 262 constraints, false));
263 return VideoTrackSourceProxy::Create(signaling_thread_, worker_thread_, 263 return VideoTrackSourceProxy::Create(signaling_thread_, worker_thread_,
264 source); 264 source);
265 } 265 }
266 266
267 rtc::scoped_refptr<VideoTrackSourceInterface> 267 rtc::scoped_refptr<VideoTrackSourceInterface>
268 PeerConnectionFactory::CreateVideoSource(cricket::VideoCapturer* capturer) { 268 PeerConnectionFactory::CreateVideoSource(
269 std::unique_ptr<cricket::VideoCapturer> capturer) {
269 RTC_DCHECK(signaling_thread_->IsCurrent()); 270 RTC_DCHECK(signaling_thread_->IsCurrent());
270 rtc::scoped_refptr<VideoTrackSourceInterface> source( 271 rtc::scoped_refptr<VideoTrackSourceInterface> source(
271 VideoCapturerTrackSource::Create(worker_thread_, capturer, false)); 272 VideoCapturerTrackSource::Create(worker_thread_, std::move(capturer),
273 false));
272 return VideoTrackSourceProxy::Create(signaling_thread_, worker_thread_, 274 return VideoTrackSourceProxy::Create(signaling_thread_, worker_thread_,
273 source); 275 source);
274 } 276 }
275 277
276 bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file, 278 bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file,
277 int64_t max_size_bytes) { 279 int64_t max_size_bytes) {
278 RTC_DCHECK(signaling_thread_->IsCurrent()); 280 RTC_DCHECK(signaling_thread_->IsCurrent());
279 return channel_manager_->StartAecDump(file, max_size_bytes); 281 return channel_manager_->StartAecDump(file, max_size_bytes);
280 } 282 }
281 283
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 384
383 rtc::Thread* PeerConnectionFactory::worker_thread() { 385 rtc::Thread* PeerConnectionFactory::worker_thread() {
384 RTC_DCHECK(signaling_thread_->IsCurrent()); 386 RTC_DCHECK(signaling_thread_->IsCurrent());
385 return worker_thread_; 387 return worker_thread_;
386 } 388 }
387 389
388 rtc::Thread* PeerConnectionFactory::network_thread() { 390 rtc::Thread* PeerConnectionFactory::network_thread() {
389 return network_thread_; 391 return network_thread_;
390 } 392 }
391 393
392 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { 394 std::unique_ptr<cricket::MediaEngineInterface>
395 PeerConnectionFactory::CreateMediaEngine_w() {
393 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); 396 RTC_DCHECK(worker_thread_ == rtc::Thread::Current());
394 return cricket::WebRtcMediaEngineFactory::Create( 397 return std::unique_ptr<cricket::MediaEngineInterface>(
395 default_adm_.get(), audio_decoder_factory_, video_encoder_factory_.get(), 398 cricket::WebRtcMediaEngineFactory::Create(
396 video_decoder_factory_.get(), external_audio_mixer_); 399 default_adm_.get(), audio_decoder_factory_,
400 video_encoder_factory_.get(), video_decoder_factory_.get(),
401 external_audio_mixer_));
397 } 402 }
398 403
399 } // namespace webrtc 404 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698