OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004--2011 Google Inc. | 3 * Copyright 2004--2011 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 ASSERT(worker_thread != NULL); | 145 ASSERT(worker_thread != NULL); |
146 ASSERT(signaling_thread != NULL); | 146 ASSERT(signaling_thread != NULL); |
147 // TODO: Currently there is no way creating an external adm in | 147 // TODO: Currently there is no way creating an external adm in |
148 // libjingle source tree. So we can 't currently assert if this is NULL. | 148 // libjingle source tree. So we can 't currently assert if this is NULL. |
149 // ASSERT(default_adm != NULL); | 149 // ASSERT(default_adm != NULL); |
150 } | 150 } |
151 | 151 |
152 PeerConnectionFactory::~PeerConnectionFactory() { | 152 PeerConnectionFactory::~PeerConnectionFactory() { |
153 RTC_DCHECK(signaling_thread_->IsCurrent()); | 153 RTC_DCHECK(signaling_thread_->IsCurrent()); |
154 channel_manager_.reset(nullptr); | 154 channel_manager_.reset(nullptr); |
| 155 media_controller_.reset(nullptr); |
155 default_allocator_factory_ = nullptr; | 156 default_allocator_factory_ = nullptr; |
156 | 157 |
157 // Make sure |worker_thread_| and |signaling_thread_| outlive | 158 // Make sure |worker_thread_| and |signaling_thread_| outlive |
158 // |dtls_identity_store_|. | 159 // |dtls_identity_store_|. |
159 dtls_identity_store_ = nullptr; | 160 dtls_identity_store_ = nullptr; |
160 | 161 |
161 if (owns_ptrs_) { | 162 if (owns_ptrs_) { |
162 if (wraps_current_thread_) | 163 if (wraps_current_thread_) |
163 rtc::ThreadManager::Instance()->UnwrapCurrentThread(); | 164 rtc::ThreadManager::Instance()->UnwrapCurrentThread(); |
164 delete worker_thread_; | 165 delete worker_thread_; |
(...skipping 15 matching lines...) Expand all Loading... |
180 &PeerConnectionFactory::CreateMediaEngine_w, this)); | 181 &PeerConnectionFactory::CreateMediaEngine_w, this)); |
181 | 182 |
182 channel_manager_.reset( | 183 channel_manager_.reset( |
183 new cricket::ChannelManager(media_engine, worker_thread_)); | 184 new cricket::ChannelManager(media_engine, worker_thread_)); |
184 | 185 |
185 channel_manager_->SetVideoRtxEnabled(true); | 186 channel_manager_->SetVideoRtxEnabled(true); |
186 if (!channel_manager_->Init()) { | 187 if (!channel_manager_->Init()) { |
187 return false; | 188 return false; |
188 } | 189 } |
189 | 190 |
| 191 media_controller_.reset(MediaControllerInterface::Create( |
| 192 worker_thread(), channel_manager_.get())); |
| 193 |
190 dtls_identity_store_ = new RefCountedDtlsIdentityStore( | 194 dtls_identity_store_ = new RefCountedDtlsIdentityStore( |
191 signaling_thread_, worker_thread_); | 195 signaling_thread_, worker_thread_); |
192 | 196 |
193 return true; | 197 return true; |
194 } | 198 } |
195 | 199 |
196 rtc::scoped_refptr<AudioSourceInterface> | 200 rtc::scoped_refptr<AudioSourceInterface> |
197 PeerConnectionFactory::CreateAudioSource( | 201 PeerConnectionFactory::CreateAudioSource( |
198 const MediaConstraintsInterface* constraints) { | 202 const MediaConstraintsInterface* constraints) { |
199 RTC_DCHECK(signaling_thread_->IsCurrent()); | 203 RTC_DCHECK(signaling_thread_->IsCurrent()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 275 |
272 rtc::scoped_refptr<AudioTrackInterface> | 276 rtc::scoped_refptr<AudioTrackInterface> |
273 PeerConnectionFactory::CreateAudioTrack(const std::string& id, | 277 PeerConnectionFactory::CreateAudioTrack(const std::string& id, |
274 AudioSourceInterface* source) { | 278 AudioSourceInterface* source) { |
275 RTC_DCHECK(signaling_thread_->IsCurrent()); | 279 RTC_DCHECK(signaling_thread_->IsCurrent()); |
276 rtc::scoped_refptr<AudioTrackInterface> track( | 280 rtc::scoped_refptr<AudioTrackInterface> track( |
277 AudioTrack::Create(id, source)); | 281 AudioTrack::Create(id, source)); |
278 return AudioTrackProxy::Create(signaling_thread_, track); | 282 return AudioTrackProxy::Create(signaling_thread_, track); |
279 } | 283 } |
280 | 284 |
281 cricket::ChannelManager* PeerConnectionFactory::channel_manager() { | 285 webrtc::MediaControllerInterface* PeerConnectionFactory::media_controller() |
282 RTC_DCHECK(signaling_thread_->IsCurrent()); | 286 const { |
283 return channel_manager_.get(); | 287 return media_controller_.get(); |
284 } | 288 } |
285 | 289 |
286 rtc::Thread* PeerConnectionFactory::signaling_thread() { | 290 rtc::Thread* PeerConnectionFactory::signaling_thread() { |
287 // This method can be called on a different thread when the factory is | 291 // This method can be called on a different thread when the factory is |
288 // created in CreatePeerConnectionFactory(). | 292 // created in CreatePeerConnectionFactory(). |
289 return signaling_thread_; | 293 return signaling_thread_; |
290 } | 294 } |
291 | 295 |
292 rtc::Thread* PeerConnectionFactory::worker_thread() { | 296 rtc::Thread* PeerConnectionFactory::worker_thread() { |
293 RTC_DCHECK(signaling_thread_->IsCurrent()); | 297 RTC_DCHECK(signaling_thread_->IsCurrent()); |
294 return worker_thread_; | 298 return worker_thread_; |
295 } | 299 } |
296 | 300 |
297 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { | 301 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { |
298 ASSERT(worker_thread_ == rtc::Thread::Current()); | 302 ASSERT(worker_thread_ == rtc::Thread::Current()); |
299 return cricket::WebRtcMediaEngineFactory::Create( | 303 return cricket::WebRtcMediaEngineFactory::Create( |
300 default_adm_.get(), video_encoder_factory_.get(), | 304 default_adm_.get(), video_encoder_factory_.get(), |
301 video_decoder_factory_.get()); | 305 video_decoder_factory_.get()); |
302 } | 306 } |
303 | 307 |
304 } // namespace webrtc | 308 } // namespace webrtc |
OLD | NEW |