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

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

Issue 2854123003: Build WebRTC with data channel only. (Closed)
Patch Set: Fix the issues. Make it ready for another round of review. Add a test. Created 3 years, 7 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 19 matching lines...) Expand all
30 #include "webrtc/p2p/client/basicportallocator.h" 30 #include "webrtc/p2p/client/basicportallocator.h"
31 #include "webrtc/pc/audiotrack.h" 31 #include "webrtc/pc/audiotrack.h"
32 #include "webrtc/pc/localaudiosource.h" 32 #include "webrtc/pc/localaudiosource.h"
33 #include "webrtc/pc/mediastream.h" 33 #include "webrtc/pc/mediastream.h"
34 #include "webrtc/pc/peerconnection.h" 34 #include "webrtc/pc/peerconnection.h"
35 #include "webrtc/pc/videocapturertracksource.h" 35 #include "webrtc/pc/videocapturertracksource.h"
36 #include "webrtc/pc/videotrack.h" 36 #include "webrtc/pc/videotrack.h"
37 37
38 namespace webrtc { 38 namespace webrtc {
39 39
40 rtc::scoped_refptr<AudioEncoderFactory> CreateBuiltinAudioEncoderFactoryImpl();
41
42 rtc::scoped_refptr<AudioDecoderFactory> CreateBuiltinAudioDecoderFactoryImpl();
43
44 std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine(
45 webrtc::AudioDeviceModule* adm,
46 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>&
47 audio_encoder_factory,
48 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
49 audio_decoder_factory,
50 cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
51 cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
52 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer);
53
40 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( 54 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
41 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, 55 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
42 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory) { 56 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory) {
43 rtc::scoped_refptr<PeerConnectionFactory> pc_factory( 57 rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
44 new rtc::RefCountedObject<PeerConnectionFactory>(audio_encoder_factory, 58 new rtc::RefCountedObject<PeerConnectionFactory>(audio_encoder_factory,
45 audio_decoder_factory)); 59 audio_decoder_factory));
46 60
47 RTC_CHECK(rtc::Thread::Current() == pc_factory->signaling_thread()); 61 RTC_CHECK(rtc::Thread::Current() == pc_factory->signaling_thread());
48 // The signaling thread is the current thread so we can 62 // The signaling thread is the current thread so we can
49 // safely call Initialize directly. 63 // safely call Initialize directly.
50 if (!pc_factory->Initialize()) { 64 if (!pc_factory->Initialize()) {
51 return nullptr; 65 return nullptr;
52 } 66 }
53 return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(), 67 return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(),
54 pc_factory); 68 pc_factory);
55 } 69 }
56 70
57 rtc::scoped_refptr<PeerConnectionFactoryInterface> 71 rtc::scoped_refptr<PeerConnectionFactoryInterface>
58 CreatePeerConnectionFactory() { 72 CreatePeerConnectionFactory() {
59 return CreatePeerConnectionFactory(CreateBuiltinAudioEncoderFactory(), 73 return CreatePeerConnectionFactory(CreateBuiltinAudioEncoderFactoryImpl(),
60 CreateBuiltinAudioDecoderFactory()); 74 CreateBuiltinAudioDecoderFactoryImpl());
61 } 75 }
62 76
63 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( 77 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
64 rtc::Thread* network_thread, 78 rtc::Thread* network_thread,
65 rtc::Thread* worker_thread, 79 rtc::Thread* worker_thread,
66 rtc::Thread* signaling_thread, 80 rtc::Thread* signaling_thread,
67 AudioDeviceModule* default_adm, 81 AudioDeviceModule* default_adm,
68 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, 82 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
69 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, 83 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
70 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, 84 cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 CreatePeerConnectionFactoryWithAudioMixer( 134 CreatePeerConnectionFactoryWithAudioMixer(
121 rtc::Thread* network_thread, 135 rtc::Thread* network_thread,
122 rtc::Thread* worker_thread, 136 rtc::Thread* worker_thread,
123 rtc::Thread* signaling_thread, 137 rtc::Thread* signaling_thread,
124 AudioDeviceModule* default_adm, 138 AudioDeviceModule* default_adm,
125 cricket::WebRtcVideoEncoderFactory* encoder_factory, 139 cricket::WebRtcVideoEncoderFactory* encoder_factory,
126 cricket::WebRtcVideoDecoderFactory* decoder_factory, 140 cricket::WebRtcVideoDecoderFactory* decoder_factory,
127 rtc::scoped_refptr<AudioMixer> audio_mixer) { 141 rtc::scoped_refptr<AudioMixer> audio_mixer) {
128 return CreatePeerConnectionFactoryWithAudioMixer( 142 return CreatePeerConnectionFactoryWithAudioMixer(
129 network_thread, worker_thread, signaling_thread, default_adm, 143 network_thread, worker_thread, signaling_thread, default_adm,
130 CreateBuiltinAudioEncoderFactory(), CreateBuiltinAudioDecoderFactory(), 144 CreateBuiltinAudioEncoderFactoryImpl(),
131 encoder_factory, decoder_factory, audio_mixer); 145 CreateBuiltinAudioDecoderFactoryImpl(), encoder_factory, decoder_factory,
146 audio_mixer);
132 } 147 }
133 148
134 PeerConnectionFactory::PeerConnectionFactory( 149 PeerConnectionFactory::PeerConnectionFactory(
135 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, 150 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
136 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) 151 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory)
137 : owns_ptrs_(true), 152 : owns_ptrs_(true),
138 wraps_current_thread_(false), 153 wraps_current_thread_(false),
139 network_thread_(rtc::Thread::CreateWithSocketServer().release()), 154 network_thread_(rtc::Thread::CreateWithSocketServer().release()),
140 worker_thread_(rtc::Thread::Create().release()), 155 worker_thread_(rtc::Thread::Create().release()),
141 signaling_thread_(rtc::Thread::Current()), 156 signaling_thread_(rtc::Thread::Current()),
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 return worker_thread_; 393 return worker_thread_;
379 } 394 }
380 395
381 rtc::Thread* PeerConnectionFactory::network_thread() { 396 rtc::Thread* PeerConnectionFactory::network_thread() {
382 return network_thread_; 397 return network_thread_;
383 } 398 }
384 399
385 std::unique_ptr<cricket::MediaEngineInterface> 400 std::unique_ptr<cricket::MediaEngineInterface>
386 PeerConnectionFactory::CreateMediaEngine_w() { 401 PeerConnectionFactory::CreateMediaEngine_w() {
387 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); 402 RTC_DCHECK(worker_thread_ == rtc::Thread::Current());
388 return std::unique_ptr<cricket::MediaEngineInterface>( 403 return CreateMediaEngine(default_adm_.get(), audio_encoder_factory_,
389 cricket::WebRtcMediaEngineFactory::Create( 404 audio_decoder_factory_, video_encoder_factory_.get(),
390 default_adm_.get(), audio_encoder_factory_, 405 video_decoder_factory_.get(), external_audio_mixer_);
391 audio_decoder_factory_,
392 video_encoder_factory_.get(), video_decoder_factory_.get(),
393 external_audio_mixer_));
394 } 406 }
395 407
396 } // namespace webrtc 408 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698