| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #ifdef HAVE_SCTP | 42 #ifdef HAVE_SCTP |
| 43 #include "talk/media/sctp/sctpdataengine.h" | 43 #include "talk/media/sctp/sctpdataengine.h" |
| 44 #endif | 44 #endif |
| 45 #include "talk/session/media/srtpfilter.h" | 45 #include "talk/session/media/srtpfilter.h" |
| 46 #include "webrtc/base/bind.h" | 46 #include "webrtc/base/bind.h" |
| 47 #include "webrtc/base/common.h" | 47 #include "webrtc/base/common.h" |
| 48 #include "webrtc/base/logging.h" | 48 #include "webrtc/base/logging.h" |
| 49 #include "webrtc/base/sigslotrepeater.h" | 49 #include "webrtc/base/sigslotrepeater.h" |
| 50 #include "webrtc/base/stringencode.h" | 50 #include "webrtc/base/stringencode.h" |
| 51 #include "webrtc/base/stringutils.h" | 51 #include "webrtc/base/stringutils.h" |
| 52 #include "webrtc/base/trace_event.h" |
| 52 | 53 |
| 53 namespace cricket { | 54 namespace cricket { |
| 54 | 55 |
| 55 enum { | 56 enum { |
| 56 MSG_VIDEOCAPTURESTATE = 1, | 57 MSG_VIDEOCAPTURESTATE = 1, |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 using rtc::Bind; | 60 using rtc::Bind; |
| 60 | 61 |
| 61 static const int kNotSetOutputVolume = -1; | 62 static const int kNotSetOutputVolume = -1; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 transport_controller, content_name, rtcp); | 289 transport_controller, content_name, rtcp); |
| 289 if (!voice_channel->Init()) { | 290 if (!voice_channel->Init()) { |
| 290 delete voice_channel; | 291 delete voice_channel; |
| 291 return nullptr; | 292 return nullptr; |
| 292 } | 293 } |
| 293 voice_channels_.push_back(voice_channel); | 294 voice_channels_.push_back(voice_channel); |
| 294 return voice_channel; | 295 return voice_channel; |
| 295 } | 296 } |
| 296 | 297 |
| 297 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { | 298 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { |
| 299 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); |
| 298 if (voice_channel) { | 300 if (voice_channel) { |
| 299 worker_thread_->Invoke<void>( | 301 worker_thread_->Invoke<void>( |
| 300 Bind(&ChannelManager::DestroyVoiceChannel_w, this, voice_channel)); | 302 Bind(&ChannelManager::DestroyVoiceChannel_w, this, voice_channel)); |
| 301 } | 303 } |
| 302 } | 304 } |
| 303 | 305 |
| 304 void ChannelManager::DestroyVoiceChannel_w(VoiceChannel* voice_channel) { | 306 void ChannelManager::DestroyVoiceChannel_w(VoiceChannel* voice_channel) { |
| 307 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel_w"); |
| 305 // Destroy voice channel. | 308 // Destroy voice channel. |
| 306 ASSERT(initialized_); | 309 ASSERT(initialized_); |
| 307 ASSERT(worker_thread_ == rtc::Thread::Current()); | 310 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 308 VoiceChannels::iterator it = std::find(voice_channels_.begin(), | 311 VoiceChannels::iterator it = std::find(voice_channels_.begin(), |
| 309 voice_channels_.end(), voice_channel); | 312 voice_channels_.end(), voice_channel); |
| 310 ASSERT(it != voice_channels_.end()); | 313 ASSERT(it != voice_channels_.end()); |
| 311 if (it == voice_channels_.end()) | 314 if (it == voice_channels_.end()) |
| 312 return; | 315 return; |
| 313 voice_channels_.erase(it); | 316 voice_channels_.erase(it); |
| 314 delete voice_channel; | 317 delete voice_channel; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 344 worker_thread_, media_channel, transport_controller, content_name, rtcp); | 347 worker_thread_, media_channel, transport_controller, content_name, rtcp); |
| 345 if (!video_channel->Init()) { | 348 if (!video_channel->Init()) { |
| 346 delete video_channel; | 349 delete video_channel; |
| 347 return NULL; | 350 return NULL; |
| 348 } | 351 } |
| 349 video_channels_.push_back(video_channel); | 352 video_channels_.push_back(video_channel); |
| 350 return video_channel; | 353 return video_channel; |
| 351 } | 354 } |
| 352 | 355 |
| 353 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { | 356 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { |
| 357 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); |
| 354 if (video_channel) { | 358 if (video_channel) { |
| 355 worker_thread_->Invoke<void>( | 359 worker_thread_->Invoke<void>( |
| 356 Bind(&ChannelManager::DestroyVideoChannel_w, this, video_channel)); | 360 Bind(&ChannelManager::DestroyVideoChannel_w, this, video_channel)); |
| 357 } | 361 } |
| 358 } | 362 } |
| 359 | 363 |
| 360 void ChannelManager::DestroyVideoChannel_w(VideoChannel* video_channel) { | 364 void ChannelManager::DestroyVideoChannel_w(VideoChannel* video_channel) { |
| 365 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel_w"); |
| 361 // Destroy video channel. | 366 // Destroy video channel. |
| 362 ASSERT(initialized_); | 367 ASSERT(initialized_); |
| 363 ASSERT(worker_thread_ == rtc::Thread::Current()); | 368 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 364 VideoChannels::iterator it = std::find(video_channels_.begin(), | 369 VideoChannels::iterator it = std::find(video_channels_.begin(), |
| 365 video_channels_.end(), video_channel); | 370 video_channels_.end(), video_channel); |
| 366 ASSERT(it != video_channels_.end()); | 371 ASSERT(it != video_channels_.end()); |
| 367 if (it == video_channels_.end()) | 372 if (it == video_channels_.end()) |
| 368 return; | 373 return; |
| 369 | 374 |
| 370 video_channels_.erase(it); | 375 video_channels_.erase(it); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 401 if (!data_channel->Init()) { | 406 if (!data_channel->Init()) { |
| 402 LOG(LS_WARNING) << "Failed to init data channel."; | 407 LOG(LS_WARNING) << "Failed to init data channel."; |
| 403 delete data_channel; | 408 delete data_channel; |
| 404 return NULL; | 409 return NULL; |
| 405 } | 410 } |
| 406 data_channels_.push_back(data_channel); | 411 data_channels_.push_back(data_channel); |
| 407 return data_channel; | 412 return data_channel; |
| 408 } | 413 } |
| 409 | 414 |
| 410 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { | 415 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { |
| 416 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel"); |
| 411 if (data_channel) { | 417 if (data_channel) { |
| 412 worker_thread_->Invoke<void>( | 418 worker_thread_->Invoke<void>( |
| 413 Bind(&ChannelManager::DestroyDataChannel_w, this, data_channel)); | 419 Bind(&ChannelManager::DestroyDataChannel_w, this, data_channel)); |
| 414 } | 420 } |
| 415 } | 421 } |
| 416 | 422 |
| 417 void ChannelManager::DestroyDataChannel_w(DataChannel* data_channel) { | 423 void ChannelManager::DestroyDataChannel_w(DataChannel* data_channel) { |
| 424 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel_w"); |
| 418 // Destroy data channel. | 425 // Destroy data channel. |
| 419 ASSERT(initialized_); | 426 ASSERT(initialized_); |
| 420 DataChannels::iterator it = std::find(data_channels_.begin(), | 427 DataChannels::iterator it = std::find(data_channels_.begin(), |
| 421 data_channels_.end(), data_channel); | 428 data_channels_.end(), data_channel); |
| 422 ASSERT(it != data_channels_.end()); | 429 ASSERT(it != data_channels_.end()); |
| 423 if (it == data_channels_.end()) | 430 if (it == data_channels_.end()) |
| 424 return; | 431 return; |
| 425 | 432 |
| 426 data_channels_.erase(it); | 433 data_channels_.erase(it); |
| 427 delete data_channel; | 434 delete data_channel; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 return worker_thread_->Invoke<bool>( | 626 return worker_thread_->Invoke<bool>( |
| 620 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file)); | 627 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file)); |
| 621 } | 628 } |
| 622 | 629 |
| 623 void ChannelManager::StopRtcEventLog() { | 630 void ChannelManager::StopRtcEventLog() { |
| 624 worker_thread_->Invoke<void>( | 631 worker_thread_->Invoke<void>( |
| 625 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get())); | 632 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get())); |
| 626 } | 633 } |
| 627 | 634 |
| 628 } // namespace cricket | 635 } // namespace cricket |
| OLD | NEW |