| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 enable_rtx_ = enable; | 82 enable_rtx_ = enable; |
| 83 return true; | 83 return true; |
| 84 } else { | 84 } else { |
| 85 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!"; | 85 LOG(LS_WARNING) << "Cannot toggle rtx after initialization!"; |
| 86 return false; | 86 return false; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 void ChannelManager::GetSupportedAudioSendCodecs( | 90 void ChannelManager::GetSupportedAudioSendCodecs( |
| 91 std::vector<AudioCodec>* codecs) const { | 91 std::vector<AudioCodec>* codecs) const { |
| 92 if (!media_engine_) { |
| 93 return; |
| 94 } |
| 92 *codecs = media_engine_->audio_send_codecs(); | 95 *codecs = media_engine_->audio_send_codecs(); |
| 93 } | 96 } |
| 94 | 97 |
| 95 void ChannelManager::GetSupportedAudioReceiveCodecs( | 98 void ChannelManager::GetSupportedAudioReceiveCodecs( |
| 96 std::vector<AudioCodec>* codecs) const { | 99 std::vector<AudioCodec>* codecs) const { |
| 100 if (!media_engine_) { |
| 101 return; |
| 102 } |
| 97 *codecs = media_engine_->audio_recv_codecs(); | 103 *codecs = media_engine_->audio_recv_codecs(); |
| 98 } | 104 } |
| 99 | 105 |
| 100 void ChannelManager::GetSupportedAudioRtpHeaderExtensions( | 106 void ChannelManager::GetSupportedAudioRtpHeaderExtensions( |
| 101 RtpHeaderExtensions* ext) const { | 107 RtpHeaderExtensions* ext) const { |
| 108 if (!media_engine_) { |
| 109 return; |
| 110 } |
| 102 *ext = media_engine_->GetAudioCapabilities().header_extensions; | 111 *ext = media_engine_->GetAudioCapabilities().header_extensions; |
| 103 } | 112 } |
| 104 | 113 |
| 105 void ChannelManager::GetSupportedVideoCodecs( | 114 void ChannelManager::GetSupportedVideoCodecs( |
| 106 std::vector<VideoCodec>* codecs) const { | 115 std::vector<VideoCodec>* codecs) const { |
| 116 if (!media_engine_) { |
| 117 return; |
| 118 } |
| 107 codecs->clear(); | 119 codecs->clear(); |
| 108 | 120 |
| 109 std::vector<VideoCodec> video_codecs = media_engine_->video_codecs(); | 121 std::vector<VideoCodec> video_codecs = media_engine_->video_codecs(); |
| 110 for (const auto& video_codec : video_codecs) { | 122 for (const auto& video_codec : video_codecs) { |
| 111 if (!enable_rtx_ && | 123 if (!enable_rtx_ && |
| 112 _stricmp(kRtxCodecName, video_codec.name.c_str()) == 0) { | 124 _stricmp(kRtxCodecName, video_codec.name.c_str()) == 0) { |
| 113 continue; | 125 continue; |
| 114 } | 126 } |
| 115 codecs->push_back(video_codec); | 127 codecs->push_back(video_codec); |
| 116 } | 128 } |
| 117 } | 129 } |
| 118 | 130 |
| 119 void ChannelManager::GetSupportedVideoRtpHeaderExtensions( | 131 void ChannelManager::GetSupportedVideoRtpHeaderExtensions( |
| 120 RtpHeaderExtensions* ext) const { | 132 RtpHeaderExtensions* ext) const { |
| 133 if (!media_engine_) { |
| 134 return; |
| 135 } |
| 121 *ext = media_engine_->GetVideoCapabilities().header_extensions; | 136 *ext = media_engine_->GetVideoCapabilities().header_extensions; |
| 122 } | 137 } |
| 123 | 138 |
| 124 void ChannelManager::GetSupportedDataCodecs( | 139 void ChannelManager::GetSupportedDataCodecs( |
| 125 std::vector<DataCodec>* codecs) const { | 140 std::vector<DataCodec>* codecs) const { |
| 141 if (!data_media_engine_) { |
| 142 return; |
| 143 } |
| 126 *codecs = data_media_engine_->data_codecs(); | 144 *codecs = data_media_engine_->data_codecs(); |
| 127 } | 145 } |
| 128 | 146 |
| 129 bool ChannelManager::Init() { | 147 bool ChannelManager::Init() { |
| 130 RTC_DCHECK(!initialized_); | 148 RTC_DCHECK(!initialized_); |
| 131 if (initialized_) { | 149 if (initialized_) { |
| 132 return false; | 150 return false; |
| 133 } | 151 } |
| 134 RTC_DCHECK(network_thread_); | 152 RTC_DCHECK(network_thread_); |
| 135 RTC_DCHECK(worker_thread_); | 153 RTC_DCHECK(worker_thread_); |
| 136 if (!network_thread_->IsCurrent()) { | 154 if (!network_thread_->IsCurrent()) { |
| 137 // Do not allow invoking calls to other threads on the network thread. | 155 // Do not allow invoking calls to other threads on the network thread. |
| 138 network_thread_->Invoke<bool>( | 156 network_thread_->Invoke<bool>( |
| 139 RTC_FROM_HERE, | 157 RTC_FROM_HERE, |
| 140 rtc::Bind(&rtc::Thread::SetAllowBlockingCalls, network_thread_, false)); | 158 rtc::Bind(&rtc::Thread::SetAllowBlockingCalls, network_thread_, false)); |
| 141 } | 159 } |
| 142 | 160 |
| 143 initialized_ = worker_thread_->Invoke<bool>( | 161 initialized_ = worker_thread_->Invoke<bool>( |
| 144 RTC_FROM_HERE, Bind(&ChannelManager::InitMediaEngine_w, this)); | 162 RTC_FROM_HERE, Bind(&ChannelManager::InitMediaEngine_w, this)); |
| 145 RTC_DCHECK(initialized_); | 163 RTC_DCHECK(initialized_); |
| 146 return initialized_; | 164 return initialized_; |
| 147 } | 165 } |
| 148 | 166 |
| 149 bool ChannelManager::InitMediaEngine_w() { | 167 bool ChannelManager::InitMediaEngine_w() { |
| 150 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 168 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
| 151 return media_engine_->Init(); | 169 if (media_engine_) { |
| 170 return media_engine_->Init(); |
| 171 } |
| 172 return true; |
| 152 } | 173 } |
| 153 | 174 |
| 154 void ChannelManager::Terminate() { | 175 void ChannelManager::Terminate() { |
| 155 RTC_DCHECK(initialized_); | 176 RTC_DCHECK(initialized_); |
| 156 if (!initialized_) { | 177 if (!initialized_) { |
| 157 return; | 178 return; |
| 158 } | 179 } |
| 159 worker_thread_->Invoke<void>(RTC_FROM_HERE, | 180 worker_thread_->Invoke<void>(RTC_FROM_HERE, |
| 160 Bind(&ChannelManager::Terminate_w, this)); | 181 Bind(&ChannelManager::Terminate_w, this)); |
| 161 initialized_ = false; | 182 initialized_ = false; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 DtlsTransportInternal* rtcp_dtls_transport, | 237 DtlsTransportInternal* rtcp_dtls_transport, |
| 217 rtc::PacketTransportInternal* rtp_packet_transport, | 238 rtc::PacketTransportInternal* rtp_packet_transport, |
| 218 rtc::PacketTransportInternal* rtcp_packet_transport, | 239 rtc::PacketTransportInternal* rtcp_packet_transport, |
| 219 rtc::Thread* signaling_thread, | 240 rtc::Thread* signaling_thread, |
| 220 const std::string& content_name, | 241 const std::string& content_name, |
| 221 bool srtp_required, | 242 bool srtp_required, |
| 222 const AudioOptions& options) { | 243 const AudioOptions& options) { |
| 223 RTC_DCHECK(initialized_); | 244 RTC_DCHECK(initialized_); |
| 224 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 245 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
| 225 RTC_DCHECK(nullptr != call); | 246 RTC_DCHECK(nullptr != call); |
| 247 if (!media_engine_) { |
| 248 return nullptr; |
| 249 } |
| 226 | 250 |
| 227 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( | 251 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
| 228 call, media_config, options); | 252 call, media_config, options); |
| 229 if (!media_channel) | 253 if (!media_channel) |
| 230 return nullptr; | 254 return nullptr; |
| 231 | 255 |
| 232 VoiceChannel* voice_channel = | 256 VoiceChannel* voice_channel = |
| 233 new VoiceChannel(worker_thread_, network_thread_, signaling_thread, | 257 new VoiceChannel(worker_thread_, network_thread_, signaling_thread, |
| 234 media_engine_.get(), media_channel, content_name, | 258 media_engine_.get(), media_channel, content_name, |
| 235 rtcp_packet_transport == nullptr, srtp_required); | 259 rtcp_packet_transport == nullptr, srtp_required); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 media_engine_.get(), file, max_size_bytes)); | 450 media_engine_.get(), file, max_size_bytes)); |
| 427 } | 451 } |
| 428 | 452 |
| 429 void ChannelManager::StopAecDump() { | 453 void ChannelManager::StopAecDump() { |
| 430 worker_thread_->Invoke<void>( | 454 worker_thread_->Invoke<void>( |
| 431 RTC_FROM_HERE, | 455 RTC_FROM_HERE, |
| 432 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); | 456 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); |
| 433 } | 457 } |
| 434 | 458 |
| 435 } // namespace cricket | 459 } // namespace cricket |
| OLD | NEW |