| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 DestroyVoiceChannel_w(voice_channels_.back()); | 211 DestroyVoiceChannel_w(voice_channels_.back()); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 VoiceChannel* ChannelManager::CreateVoiceChannel( | 215 VoiceChannel* ChannelManager::CreateVoiceChannel( |
| 216 webrtc::MediaControllerInterface* media_controller, | 216 webrtc::MediaControllerInterface* media_controller, |
| 217 TransportController* transport_controller, | 217 TransportController* transport_controller, |
| 218 const std::string& content_name, | 218 const std::string& content_name, |
| 219 const std::string* bundle_transport_name, | 219 const std::string* bundle_transport_name, |
| 220 bool rtcp, | 220 bool rtcp, |
| 221 bool secure_required, |
| 221 const AudioOptions& options) { | 222 const AudioOptions& options) { |
| 222 return worker_thread_->Invoke<VoiceChannel*>( | 223 return worker_thread_->Invoke<VoiceChannel*>( |
| 223 RTC_FROM_HERE, Bind(&ChannelManager::CreateVoiceChannel_w, this, | 224 RTC_FROM_HERE, |
| 224 media_controller, transport_controller, content_name, | 225 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, |
| 225 bundle_transport_name, rtcp, options)); | 226 transport_controller, content_name, bundle_transport_name, rtcp, |
| 227 secure_required, options)); |
| 226 } | 228 } |
| 227 | 229 |
| 228 VoiceChannel* ChannelManager::CreateVoiceChannel_w( | 230 VoiceChannel* ChannelManager::CreateVoiceChannel_w( |
| 229 webrtc::MediaControllerInterface* media_controller, | 231 webrtc::MediaControllerInterface* media_controller, |
| 230 TransportController* transport_controller, | 232 TransportController* transport_controller, |
| 231 const std::string& content_name, | 233 const std::string& content_name, |
| 232 const std::string* bundle_transport_name, | 234 const std::string* bundle_transport_name, |
| 233 bool rtcp, | 235 bool rtcp, |
| 236 bool secure_required, |
| 234 const AudioOptions& options) { | 237 const AudioOptions& options) { |
| 235 ASSERT(initialized_); | 238 ASSERT(initialized_); |
| 236 ASSERT(worker_thread_ == rtc::Thread::Current()); | 239 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 237 ASSERT(nullptr != media_controller); | 240 ASSERT(nullptr != media_controller); |
| 238 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( | 241 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
| 239 media_controller->call_w(), media_controller->config(), options); | 242 media_controller->call_w(), media_controller->config(), options); |
| 240 if (!media_channel) | 243 if (!media_channel) |
| 241 return nullptr; | 244 return nullptr; |
| 242 | 245 |
| 243 VoiceChannel* voice_channel = | 246 VoiceChannel* voice_channel = new VoiceChannel( |
| 244 new VoiceChannel(worker_thread_, network_thread_, media_engine_.get(), | 247 worker_thread_, network_thread_, media_engine_.get(), media_channel, |
| 245 media_channel, transport_controller, content_name, rtcp); | 248 transport_controller, content_name, rtcp, secure_required); |
| 246 voice_channel->SetCryptoOptions(crypto_options_); | 249 voice_channel->SetCryptoOptions(crypto_options_); |
| 247 if (!voice_channel->Init_w(bundle_transport_name)) { | 250 if (!voice_channel->Init_w(bundle_transport_name)) { |
| 248 delete voice_channel; | 251 delete voice_channel; |
| 249 return nullptr; | 252 return nullptr; |
| 250 } | 253 } |
| 251 voice_channels_.push_back(voice_channel); | 254 voice_channels_.push_back(voice_channel); |
| 252 return voice_channel; | 255 return voice_channel; |
| 253 } | 256 } |
| 254 | 257 |
| 255 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { | 258 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 274 voice_channels_.erase(it); | 277 voice_channels_.erase(it); |
| 275 delete voice_channel; | 278 delete voice_channel; |
| 276 } | 279 } |
| 277 | 280 |
| 278 VideoChannel* ChannelManager::CreateVideoChannel( | 281 VideoChannel* ChannelManager::CreateVideoChannel( |
| 279 webrtc::MediaControllerInterface* media_controller, | 282 webrtc::MediaControllerInterface* media_controller, |
| 280 TransportController* transport_controller, | 283 TransportController* transport_controller, |
| 281 const std::string& content_name, | 284 const std::string& content_name, |
| 282 const std::string* bundle_transport_name, | 285 const std::string* bundle_transport_name, |
| 283 bool rtcp, | 286 bool rtcp, |
| 287 bool secure_required, |
| 284 const VideoOptions& options) { | 288 const VideoOptions& options) { |
| 285 return worker_thread_->Invoke<VideoChannel*>( | 289 return worker_thread_->Invoke<VideoChannel*>( |
| 286 RTC_FROM_HERE, Bind(&ChannelManager::CreateVideoChannel_w, this, | 290 RTC_FROM_HERE, |
| 287 media_controller, transport_controller, content_name, | 291 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, |
| 288 bundle_transport_name, rtcp, options)); | 292 transport_controller, content_name, bundle_transport_name, rtcp, |
| 293 secure_required, options)); |
| 289 } | 294 } |
| 290 | 295 |
| 291 VideoChannel* ChannelManager::CreateVideoChannel_w( | 296 VideoChannel* ChannelManager::CreateVideoChannel_w( |
| 292 webrtc::MediaControllerInterface* media_controller, | 297 webrtc::MediaControllerInterface* media_controller, |
| 293 TransportController* transport_controller, | 298 TransportController* transport_controller, |
| 294 const std::string& content_name, | 299 const std::string& content_name, |
| 295 const std::string* bundle_transport_name, | 300 const std::string* bundle_transport_name, |
| 296 bool rtcp, | 301 bool rtcp, |
| 302 bool secure_required, |
| 297 const VideoOptions& options) { | 303 const VideoOptions& options) { |
| 298 ASSERT(initialized_); | 304 ASSERT(initialized_); |
| 299 ASSERT(worker_thread_ == rtc::Thread::Current()); | 305 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 300 ASSERT(nullptr != media_controller); | 306 ASSERT(nullptr != media_controller); |
| 301 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( | 307 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( |
| 302 media_controller->call_w(), media_controller->config(), options); | 308 media_controller->call_w(), media_controller->config(), options); |
| 303 if (media_channel == NULL) { | 309 if (media_channel == NULL) { |
| 304 return NULL; | 310 return NULL; |
| 305 } | 311 } |
| 306 | 312 |
| 307 VideoChannel* video_channel = | 313 VideoChannel* video_channel = new VideoChannel( |
| 308 new VideoChannel(worker_thread_, network_thread_, media_channel, | 314 worker_thread_, network_thread_, media_channel, transport_controller, |
| 309 transport_controller, content_name, rtcp); | 315 content_name, rtcp, secure_required); |
| 310 video_channel->SetCryptoOptions(crypto_options_); | 316 video_channel->SetCryptoOptions(crypto_options_); |
| 311 if (!video_channel->Init_w(bundle_transport_name)) { | 317 if (!video_channel->Init_w(bundle_transport_name)) { |
| 312 delete video_channel; | 318 delete video_channel; |
| 313 return NULL; | 319 return NULL; |
| 314 } | 320 } |
| 315 video_channels_.push_back(video_channel); | 321 video_channels_.push_back(video_channel); |
| 316 return video_channel; | 322 return video_channel; |
| 317 } | 323 } |
| 318 | 324 |
| 319 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { | 325 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 338 | 344 |
| 339 video_channels_.erase(it); | 345 video_channels_.erase(it); |
| 340 delete video_channel; | 346 delete video_channel; |
| 341 } | 347 } |
| 342 | 348 |
| 343 DataChannel* ChannelManager::CreateDataChannel( | 349 DataChannel* ChannelManager::CreateDataChannel( |
| 344 TransportController* transport_controller, | 350 TransportController* transport_controller, |
| 345 const std::string& content_name, | 351 const std::string& content_name, |
| 346 const std::string* bundle_transport_name, | 352 const std::string* bundle_transport_name, |
| 347 bool rtcp, | 353 bool rtcp, |
| 354 bool secure_required, |
| 348 DataChannelType channel_type) { | 355 DataChannelType channel_type) { |
| 349 return worker_thread_->Invoke<DataChannel*>( | 356 return worker_thread_->Invoke<DataChannel*>( |
| 350 RTC_FROM_HERE, | 357 RTC_FROM_HERE, |
| 351 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, | 358 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, |
| 352 content_name, bundle_transport_name, rtcp, channel_type)); | 359 content_name, bundle_transport_name, rtcp, secure_required, |
| 360 channel_type)); |
| 353 } | 361 } |
| 354 | 362 |
| 355 DataChannel* ChannelManager::CreateDataChannel_w( | 363 DataChannel* ChannelManager::CreateDataChannel_w( |
| 356 TransportController* transport_controller, | 364 TransportController* transport_controller, |
| 357 const std::string& content_name, | 365 const std::string& content_name, |
| 358 const std::string* bundle_transport_name, | 366 const std::string* bundle_transport_name, |
| 359 bool rtcp, | 367 bool rtcp, |
| 368 bool secure_required, |
| 360 DataChannelType data_channel_type) { | 369 DataChannelType data_channel_type) { |
| 361 // This is ok to alloc from a thread other than the worker thread. | 370 // This is ok to alloc from a thread other than the worker thread. |
| 362 ASSERT(initialized_); | 371 ASSERT(initialized_); |
| 363 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( | 372 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( |
| 364 data_channel_type); | 373 data_channel_type); |
| 365 if (!media_channel) { | 374 if (!media_channel) { |
| 366 LOG(LS_WARNING) << "Failed to create data channel of type " | 375 LOG(LS_WARNING) << "Failed to create data channel of type " |
| 367 << data_channel_type; | 376 << data_channel_type; |
| 368 return NULL; | 377 return NULL; |
| 369 } | 378 } |
| 370 | 379 |
| 371 DataChannel* data_channel = | 380 // Only RTP data channels need SRTP. |
| 372 new DataChannel(worker_thread_, network_thread_, media_channel, | 381 secure_required = secure_required && data_channel_type == DCT_RTP; |
| 373 transport_controller, content_name, rtcp); | 382 DataChannel* data_channel = new DataChannel( |
| 383 worker_thread_, network_thread_, media_channel, transport_controller, |
| 384 content_name, rtcp, secure_required); |
| 374 data_channel->SetCryptoOptions(crypto_options_); | 385 data_channel->SetCryptoOptions(crypto_options_); |
| 375 if (!data_channel->Init_w(bundle_transport_name)) { | 386 if (!data_channel->Init_w(bundle_transport_name)) { |
| 376 LOG(LS_WARNING) << "Failed to init data channel."; | 387 LOG(LS_WARNING) << "Failed to init data channel."; |
| 377 delete data_channel; | 388 delete data_channel; |
| 378 return NULL; | 389 return NULL; |
| 379 } | 390 } |
| 380 data_channels_.push_back(data_channel); | 391 data_channels_.push_back(data_channel); |
| 381 return data_channel; | 392 return data_channel; |
| 382 } | 393 } |
| 383 | 394 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 411 media_engine_.get(), file, max_size_bytes)); | 422 media_engine_.get(), file, max_size_bytes)); |
| 412 } | 423 } |
| 413 | 424 |
| 414 void ChannelManager::StopAecDump() { | 425 void ChannelManager::StopAecDump() { |
| 415 worker_thread_->Invoke<void>( | 426 worker_thread_->Invoke<void>( |
| 416 RTC_FROM_HERE, | 427 RTC_FROM_HERE, |
| 417 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); | 428 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); |
| 418 } | 429 } |
| 419 | 430 |
| 420 } // namespace cricket | 431 } // namespace cricket |
| OLD | NEW |