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

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

Issue 2675173003: Adding "adapter" ORTC objects on top of ChannelManager/BaseChannel/etc. (Closed)
Patch Set: 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 default_socket_factory_.reset( 162 default_socket_factory_.reset(
163 new rtc::BasicPacketSocketFactory(network_thread_)); 163 new rtc::BasicPacketSocketFactory(network_thread_));
164 if (!default_socket_factory_) { 164 if (!default_socket_factory_) {
165 return false; 165 return false;
166 } 166 }
167 167
168 // TODO: Need to make sure only one VoE is created inside 168 // TODO: Need to make sure only one VoE is created inside
169 // WebRtcMediaEngine. 169 // WebRtcMediaEngine.
170 cricket::MediaEngineInterface* media_engine = 170 std::unique_ptr<cricket::MediaEngineInterface> media_engine =
171 worker_thread_->Invoke<cricket::MediaEngineInterface*>( 171 worker_thread_->Invoke<std::unique_ptr<cricket::MediaEngineInterface>>(
172 RTC_FROM_HERE, 172 RTC_FROM_HERE,
173 rtc::Bind(&PeerConnectionFactory::CreateMediaEngine_w, this)); 173 rtc::Bind(&PeerConnectionFactory::CreateMediaEngine_w, this));
174 174
175 channel_manager_.reset(new cricket::ChannelManager( 175 channel_manager_.reset(new cricket::ChannelManager(
176 media_engine, worker_thread_, network_thread_)); 176 std::move(media_engine), worker_thread_, network_thread_));
177 177
178 channel_manager_->SetVideoRtxEnabled(true); 178 channel_manager_->SetVideoRtxEnabled(true);
179 channel_manager_->SetCryptoOptions(options_.crypto_options); 179 channel_manager_->SetCryptoOptions(options_.crypto_options);
180 if (!channel_manager_->Init()) { 180 if (!channel_manager_->Init()) {
181 return false; 181 return false;
182 } 182 }
183 183
184 return true; 184 return true;
185 } 185 }
186 186
187 void PeerConnectionFactory::SetOptions(const Options& options) { 187 void PeerConnectionFactory::SetOptions(const Options& options) {
188 options_ = options; 188 options_ = options;
189 if (channel_manager_) { 189 if (channel_manager_) {
190 channel_manager_->SetCryptoOptions(options.crypto_options); 190 channel_manager_->SetCryptoOptions(options.crypto_options);
191 } 191 }
192 } 192 }
193 193
194 rtc::scoped_refptr<AudioSourceInterface> 194 rtc::scoped_refptr<AudioSourceInterface>
195 PeerConnectionFactory::CreateAudioSource( 195 PeerConnectionFactory::CreateAudioSource(
196 const MediaConstraintsInterface* constraints) { 196 const MediaConstraintsInterface* constraints) {
197 RTC_DCHECK(signaling_thread_->IsCurrent()); 197 RTC_DCHECK(signaling_thread_->IsCurrent());
198 rtc::scoped_refptr<LocalAudioSource> source( 198 rtc::scoped_refptr<LocalAudioSource> source(
199 LocalAudioSource::Create(options_, constraints)); 199 LocalAudioSource::Create(constraints));
200 return source; 200 return source;
201 } 201 }
202 202
203 rtc::scoped_refptr<AudioSourceInterface> 203 rtc::scoped_refptr<AudioSourceInterface>
204 PeerConnectionFactory::CreateAudioSource(const cricket::AudioOptions& options) { 204 PeerConnectionFactory::CreateAudioSource(const cricket::AudioOptions& options) {
205 RTC_DCHECK(signaling_thread_->IsCurrent()); 205 RTC_DCHECK(signaling_thread_->IsCurrent());
206 rtc::scoped_refptr<LocalAudioSource> source( 206 rtc::scoped_refptr<LocalAudioSource> source(
207 LocalAudioSource::Create(options_, &options)); 207 LocalAudioSource::Create(&options));
208 return source; 208 return source;
209 } 209 }
210 210
211 rtc::scoped_refptr<VideoTrackSourceInterface> 211 rtc::scoped_refptr<VideoTrackSourceInterface>
212 PeerConnectionFactory::CreateVideoSource( 212 PeerConnectionFactory::CreateVideoSource(
213 cricket::VideoCapturer* capturer, 213 cricket::VideoCapturer* capturer,
214 const MediaConstraintsInterface* constraints) { 214 const MediaConstraintsInterface* constraints) {
215 RTC_DCHECK(signaling_thread_->IsCurrent()); 215 RTC_DCHECK(signaling_thread_->IsCurrent());
216 rtc::scoped_refptr<VideoTrackSourceInterface> source( 216 rtc::scoped_refptr<VideoTrackSourceInterface> source(
217 VideoCapturerTrackSource::Create(worker_thread_, capturer, constraints, 217 VideoCapturerTrackSource::Create(
218 false)); 218 worker_thread_, std::unique_ptr<cricket::VideoCapturer>(capturer),
219 constraints, false));
219 return VideoTrackSourceProxy::Create(signaling_thread_, worker_thread_, 220 return VideoTrackSourceProxy::Create(signaling_thread_, worker_thread_,
220 source); 221 source);
221 } 222 }
222 223
223 rtc::scoped_refptr<VideoTrackSourceInterface> 224 rtc::scoped_refptr<VideoTrackSourceInterface>
224 PeerConnectionFactory::CreateVideoSource(cricket::VideoCapturer* capturer) { 225 PeerConnectionFactory::CreateVideoSource(cricket::VideoCapturer* capturer) {
225 RTC_DCHECK(signaling_thread_->IsCurrent()); 226 RTC_DCHECK(signaling_thread_->IsCurrent());
226 rtc::scoped_refptr<VideoTrackSourceInterface> source( 227 rtc::scoped_refptr<VideoTrackSourceInterface> source(
227 VideoCapturerTrackSource::Create(worker_thread_, capturer, false)); 228 VideoCapturerTrackSource::Create(
229 worker_thread_, std::unique_ptr<cricket::VideoCapturer>(capturer),
230 false));
228 return VideoTrackSourceProxy::Create(signaling_thread_, worker_thread_, 231 return VideoTrackSourceProxy::Create(signaling_thread_, worker_thread_,
229 source); 232 source);
230 } 233 }
231 234
232 bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file, 235 bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file,
233 int64_t max_size_bytes) { 236 int64_t max_size_bytes) {
234 RTC_DCHECK(signaling_thread_->IsCurrent()); 237 RTC_DCHECK(signaling_thread_->IsCurrent());
235 return channel_manager_->StartAecDump(file, max_size_bytes); 238 return channel_manager_->StartAecDump(file, max_size_bytes);
236 } 239 }
237 240
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 341
339 rtc::Thread* PeerConnectionFactory::worker_thread() { 342 rtc::Thread* PeerConnectionFactory::worker_thread() {
340 RTC_DCHECK(signaling_thread_->IsCurrent()); 343 RTC_DCHECK(signaling_thread_->IsCurrent());
341 return worker_thread_; 344 return worker_thread_;
342 } 345 }
343 346
344 rtc::Thread* PeerConnectionFactory::network_thread() { 347 rtc::Thread* PeerConnectionFactory::network_thread() {
345 return network_thread_; 348 return network_thread_;
346 } 349 }
347 350
348 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { 351 std::unique_ptr<cricket::MediaEngineInterface>
352 PeerConnectionFactory::CreateMediaEngine_w() {
349 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); 353 RTC_DCHECK(worker_thread_ == rtc::Thread::Current());
350 return cricket::WebRtcMediaEngineFactory::Create( 354 return cricket::WebRtcMediaEngineFactory::Create(
351 default_adm_.get(), audio_decoder_factory_, video_encoder_factory_.get(), 355 default_adm_.get(), audio_decoder_factory_, video_encoder_factory_.get(),
352 video_decoder_factory_.get(), external_audio_mixer_); 356 video_decoder_factory_.get(), external_audio_mixer_);
353 } 357 }
354 358
355 } // namespace webrtc 359 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698