OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 DestroyVoiceChannel_w(voice_channels_.back()); | 312 DestroyVoiceChannel_w(voice_channels_.back()); |
313 } | 313 } |
314 if (!SetCaptureDevice_w(NULL)) { | 314 if (!SetCaptureDevice_w(NULL)) { |
315 LOG(LS_WARNING) << "failed to delete video capturer"; | 315 LOG(LS_WARNING) << "failed to delete video capturer"; |
316 } | 316 } |
317 media_engine_->Terminate(); | 317 media_engine_->Terminate(); |
318 } | 318 } |
319 | 319 |
320 VoiceChannel* ChannelManager::CreateVoiceChannel( | 320 VoiceChannel* ChannelManager::CreateVoiceChannel( |
321 webrtc::MediaControllerInterface* media_controller, | 321 webrtc::MediaControllerInterface* media_controller, |
322 BaseSession* session, | 322 TransportController* transport_controller, |
323 const std::string& content_name, | 323 const std::string& content_name, |
324 bool rtcp, | 324 bool rtcp, |
325 const AudioOptions& options) { | 325 const AudioOptions& options) { |
326 return worker_thread_->Invoke<VoiceChannel*>( | 326 return worker_thread_->Invoke<VoiceChannel*>( |
327 Bind(&ChannelManager::CreateVoiceChannel_w, | 327 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, |
328 this, | 328 transport_controller, content_name, rtcp, options)); |
329 media_controller, | |
330 session, | |
331 content_name, | |
332 rtcp, | |
333 options)); | |
334 } | 329 } |
335 | 330 |
336 VoiceChannel* ChannelManager::CreateVoiceChannel_w( | 331 VoiceChannel* ChannelManager::CreateVoiceChannel_w( |
337 webrtc::MediaControllerInterface* media_controller, | 332 webrtc::MediaControllerInterface* media_controller, |
338 BaseSession* session, | 333 TransportController* transport_controller, |
339 const std::string& content_name, | 334 const std::string& content_name, |
340 bool rtcp, | 335 bool rtcp, |
341 const AudioOptions& options) { | 336 const AudioOptions& options) { |
342 ASSERT(initialized_); | 337 ASSERT(initialized_); |
343 ASSERT(worker_thread_ == rtc::Thread::Current()); | 338 ASSERT(worker_thread_ == rtc::Thread::Current()); |
344 ASSERT(nullptr != media_controller); | 339 ASSERT(nullptr != media_controller); |
345 VoiceMediaChannel* media_channel = | 340 VoiceMediaChannel* media_channel = |
346 media_engine_->CreateChannel(media_controller->call_w(), options); | 341 media_engine_->CreateChannel(media_controller->call_w(), options); |
347 if (!media_channel) | 342 if (!media_channel) |
348 return nullptr; | 343 return nullptr; |
349 | 344 |
350 VoiceChannel* voice_channel = new VoiceChannel( | 345 VoiceChannel* voice_channel = |
351 worker_thread_, media_engine_.get(), media_channel, | 346 new VoiceChannel(worker_thread_, media_engine_.get(), media_channel, |
352 session, content_name, rtcp); | 347 transport_controller, content_name, rtcp); |
353 if (!voice_channel->Init()) { | 348 if (!voice_channel->Init()) { |
354 delete voice_channel; | 349 delete voice_channel; |
355 return nullptr; | 350 return nullptr; |
356 } | 351 } |
357 voice_channels_.push_back(voice_channel); | 352 voice_channels_.push_back(voice_channel); |
358 return voice_channel; | 353 return voice_channel; |
359 } | 354 } |
360 | 355 |
361 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { | 356 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { |
362 if (voice_channel) { | 357 if (voice_channel) { |
(...skipping 10 matching lines...) Expand all Loading... |
373 voice_channels_.end(), voice_channel); | 368 voice_channels_.end(), voice_channel); |
374 ASSERT(it != voice_channels_.end()); | 369 ASSERT(it != voice_channels_.end()); |
375 if (it == voice_channels_.end()) | 370 if (it == voice_channels_.end()) |
376 return; | 371 return; |
377 voice_channels_.erase(it); | 372 voice_channels_.erase(it); |
378 delete voice_channel; | 373 delete voice_channel; |
379 } | 374 } |
380 | 375 |
381 VideoChannel* ChannelManager::CreateVideoChannel( | 376 VideoChannel* ChannelManager::CreateVideoChannel( |
382 webrtc::MediaControllerInterface* media_controller, | 377 webrtc::MediaControllerInterface* media_controller, |
383 BaseSession* session, | 378 TransportController* transport_controller, |
384 const std::string& content_name, | 379 const std::string& content_name, |
385 bool rtcp, | 380 bool rtcp, |
386 const VideoOptions& options) { | 381 const VideoOptions& options) { |
387 return worker_thread_->Invoke<VideoChannel*>( | 382 return worker_thread_->Invoke<VideoChannel*>( |
388 Bind(&ChannelManager::CreateVideoChannel_w, | 383 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, |
389 this, | 384 transport_controller, content_name, rtcp, options)); |
390 media_controller, | |
391 session, | |
392 content_name, | |
393 rtcp, | |
394 options)); | |
395 } | 385 } |
396 | 386 |
397 VideoChannel* ChannelManager::CreateVideoChannel_w( | 387 VideoChannel* ChannelManager::CreateVideoChannel_w( |
398 webrtc::MediaControllerInterface* media_controller, | 388 webrtc::MediaControllerInterface* media_controller, |
399 BaseSession* session, | 389 TransportController* transport_controller, |
400 const std::string& content_name, | 390 const std::string& content_name, |
401 bool rtcp, | 391 bool rtcp, |
402 const VideoOptions& options) { | 392 const VideoOptions& options) { |
403 ASSERT(initialized_); | 393 ASSERT(initialized_); |
404 ASSERT(worker_thread_ == rtc::Thread::Current()); | 394 ASSERT(worker_thread_ == rtc::Thread::Current()); |
405 ASSERT(nullptr != media_controller); | 395 ASSERT(nullptr != media_controller); |
406 VideoMediaChannel* media_channel = | 396 VideoMediaChannel* media_channel = |
407 media_engine_->CreateVideoChannel(media_controller->call_w(), options); | 397 media_engine_->CreateVideoChannel(media_controller->call_w(), options); |
408 if (media_channel == NULL) | 398 if (media_channel == NULL) { |
409 return NULL; | 399 return NULL; |
| 400 } |
410 | 401 |
411 VideoChannel* video_channel = new VideoChannel( | 402 VideoChannel* video_channel = new VideoChannel( |
412 worker_thread_, media_channel, | 403 worker_thread_, media_channel, transport_controller, content_name, rtcp); |
413 session, content_name, rtcp); | |
414 if (!video_channel->Init()) { | 404 if (!video_channel->Init()) { |
415 delete video_channel; | 405 delete video_channel; |
416 return NULL; | 406 return NULL; |
417 } | 407 } |
418 video_channels_.push_back(video_channel); | 408 video_channels_.push_back(video_channel); |
419 return video_channel; | 409 return video_channel; |
420 } | 410 } |
421 | 411 |
422 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { | 412 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { |
423 if (video_channel) { | 413 if (video_channel) { |
(...skipping 10 matching lines...) Expand all Loading... |
434 video_channels_.end(), video_channel); | 424 video_channels_.end(), video_channel); |
435 ASSERT(it != video_channels_.end()); | 425 ASSERT(it != video_channels_.end()); |
436 if (it == video_channels_.end()) | 426 if (it == video_channels_.end()) |
437 return; | 427 return; |
438 | 428 |
439 video_channels_.erase(it); | 429 video_channels_.erase(it); |
440 delete video_channel; | 430 delete video_channel; |
441 } | 431 } |
442 | 432 |
443 DataChannel* ChannelManager::CreateDataChannel( | 433 DataChannel* ChannelManager::CreateDataChannel( |
444 BaseSession* session, const std::string& content_name, | 434 TransportController* transport_controller, |
445 bool rtcp, DataChannelType channel_type) { | 435 const std::string& content_name, |
| 436 bool rtcp, |
| 437 DataChannelType channel_type) { |
446 return worker_thread_->Invoke<DataChannel*>( | 438 return worker_thread_->Invoke<DataChannel*>( |
447 Bind(&ChannelManager::CreateDataChannel_w, this, session, content_name, | 439 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, |
448 rtcp, channel_type)); | 440 content_name, rtcp, channel_type)); |
449 } | 441 } |
450 | 442 |
451 DataChannel* ChannelManager::CreateDataChannel_w( | 443 DataChannel* ChannelManager::CreateDataChannel_w( |
452 BaseSession* session, const std::string& content_name, | 444 TransportController* transport_controller, |
453 bool rtcp, DataChannelType data_channel_type) { | 445 const std::string& content_name, |
| 446 bool rtcp, |
| 447 DataChannelType data_channel_type) { |
454 // This is ok to alloc from a thread other than the worker thread. | 448 // This is ok to alloc from a thread other than the worker thread. |
455 ASSERT(initialized_); | 449 ASSERT(initialized_); |
456 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( | 450 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( |
457 data_channel_type); | 451 data_channel_type); |
458 if (!media_channel) { | 452 if (!media_channel) { |
459 LOG(LS_WARNING) << "Failed to create data channel of type " | 453 LOG(LS_WARNING) << "Failed to create data channel of type " |
460 << data_channel_type; | 454 << data_channel_type; |
461 return NULL; | 455 return NULL; |
462 } | 456 } |
463 | 457 |
464 DataChannel* data_channel = new DataChannel( | 458 DataChannel* data_channel = new DataChannel( |
465 worker_thread_, media_channel, | 459 worker_thread_, media_channel, transport_controller, content_name, rtcp); |
466 session, content_name, rtcp); | |
467 if (!data_channel->Init()) { | 460 if (!data_channel->Init()) { |
468 LOG(LS_WARNING) << "Failed to init data channel."; | 461 LOG(LS_WARNING) << "Failed to init data channel."; |
469 delete data_channel; | 462 delete data_channel; |
470 return NULL; | 463 return NULL; |
471 } | 464 } |
472 data_channels_.push_back(data_channel); | 465 data_channels_.push_back(data_channel); |
473 return data_channel; | 466 return data_channel; |
474 } | 467 } |
475 | 468 |
476 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { | 469 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 const VideoFormat& max_format) { | 898 const VideoFormat& max_format) { |
906 device_manager_->SetVideoCaptureDeviceMaxFormat(usb_id, max_format); | 899 device_manager_->SetVideoCaptureDeviceMaxFormat(usb_id, max_format); |
907 } | 900 } |
908 | 901 |
909 bool ChannelManager::StartAecDump(rtc::PlatformFile file) { | 902 bool ChannelManager::StartAecDump(rtc::PlatformFile file) { |
910 return worker_thread_->Invoke<bool>( | 903 return worker_thread_->Invoke<bool>( |
911 Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); | 904 Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); |
912 } | 905 } |
913 | 906 |
914 } // namespace cricket | 907 } // namespace cricket |
OLD | NEW |