OLD | NEW |
---|---|
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 } | 133 } |
134 RTC_DCHECK(network_thread_); | 134 RTC_DCHECK(network_thread_); |
135 RTC_DCHECK(worker_thread_); | 135 RTC_DCHECK(worker_thread_); |
136 if (!network_thread_->IsCurrent()) { | 136 if (!network_thread_->IsCurrent()) { |
137 // Do not allow invoking calls to other threads on the network thread. | 137 // Do not allow invoking calls to other threads on the network thread. |
138 network_thread_->Invoke<bool>( | 138 network_thread_->Invoke<bool>( |
139 RTC_FROM_HERE, | 139 RTC_FROM_HERE, |
140 rtc::Bind(&rtc::Thread::SetAllowBlockingCalls, network_thread_, false)); | 140 rtc::Bind(&rtc::Thread::SetAllowBlockingCalls, network_thread_, false)); |
141 } | 141 } |
142 | 142 |
143 #if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) | |
Taylor Brandstetter
2017/05/11 04:43:11
Should be an ||?
Zhi Huang
2017/05/12 20:05:33
Done.
| |
143 initialized_ = worker_thread_->Invoke<bool>( | 144 initialized_ = worker_thread_->Invoke<bool>( |
144 RTC_FROM_HERE, Bind(&ChannelManager::InitMediaEngine_w, this)); | 145 RTC_FROM_HERE, Bind(&ChannelManager::InitMediaEngine_w, this)); |
146 #else | |
147 initialized_ = true; | |
148 #endif | |
145 RTC_DCHECK(initialized_); | 149 RTC_DCHECK(initialized_); |
146 return initialized_; | 150 return initialized_; |
147 } | 151 } |
148 | 152 |
149 bool ChannelManager::InitMediaEngine_w() { | 153 bool ChannelManager::InitMediaEngine_w() { |
150 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 154 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
155 RTC_DCHECK(media_engine_); | |
151 return media_engine_->Init(); | 156 return media_engine_->Init(); |
152 } | 157 } |
153 | 158 |
154 void ChannelManager::Terminate() { | 159 void ChannelManager::Terminate() { |
155 RTC_DCHECK(initialized_); | 160 RTC_DCHECK(initialized_); |
156 if (!initialized_) { | 161 if (!initialized_) { |
157 return; | 162 return; |
158 } | 163 } |
159 worker_thread_->Invoke<void>(RTC_FROM_HERE, | 164 worker_thread_->Invoke<void>(RTC_FROM_HERE, |
160 Bind(&ChannelManager::Terminate_w, this)); | 165 Bind(&ChannelManager::Terminate_w, this)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 rtc::PacketTransportInternal* rtp_packet_transport, | 222 rtc::PacketTransportInternal* rtp_packet_transport, |
218 rtc::PacketTransportInternal* rtcp_packet_transport, | 223 rtc::PacketTransportInternal* rtcp_packet_transport, |
219 rtc::Thread* signaling_thread, | 224 rtc::Thread* signaling_thread, |
220 const std::string& content_name, | 225 const std::string& content_name, |
221 bool srtp_required, | 226 bool srtp_required, |
222 const AudioOptions& options) { | 227 const AudioOptions& options) { |
223 RTC_DCHECK(initialized_); | 228 RTC_DCHECK(initialized_); |
224 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 229 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
225 RTC_DCHECK(nullptr != call); | 230 RTC_DCHECK(nullptr != call); |
226 | 231 |
232 #ifndef HAVE_WEBRTC_VOICE | |
233 return nullptr; | |
Taylor Brandstetter
2017/05/11 04:43:11
I'm curious, why was this necessary?
Zhi Huang
2017/05/12 20:05:33
Because the media_engine_ here would be a nullptr.
| |
234 #endif | |
227 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( | 235 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
228 call, media_config, options); | 236 call, media_config, options); |
229 if (!media_channel) | 237 if (!media_channel) |
230 return nullptr; | 238 return nullptr; |
231 | 239 |
232 VoiceChannel* voice_channel = | 240 VoiceChannel* voice_channel = |
233 new VoiceChannel(worker_thread_, network_thread_, signaling_thread, | 241 new VoiceChannel(worker_thread_, network_thread_, signaling_thread, |
234 media_engine_.get(), media_channel, content_name, | 242 media_engine_.get(), media_channel, content_name, |
235 rtcp_packet_transport == nullptr, srtp_required); | 243 rtcp_packet_transport == nullptr, srtp_required); |
236 | 244 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 media_engine_.get(), file, max_size_bytes)); | 434 media_engine_.get(), file, max_size_bytes)); |
427 } | 435 } |
428 | 436 |
429 void ChannelManager::StopAecDump() { | 437 void ChannelManager::StopAecDump() { |
430 worker_thread_->Invoke<void>( | 438 worker_thread_->Invoke<void>( |
431 RTC_FROM_HERE, | 439 RTC_FROM_HERE, |
432 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); | 440 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); |
433 } | 441 } |
434 | 442 |
435 } // namespace cricket | 443 } // namespace cricket |
OLD | NEW |