Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / libjingle / source / talk / session / media / channelmanager.cc
index 199bc86..ecfe851 100644 (file)
@@ -137,12 +137,6 @@ void ChannelManager::Construct(MediaEngineInterface* me,
       this, &ChannelManager::OnVideoCaptureStateChange);
   capture_manager_->SignalCapturerStateChange.connect(
       this, &ChannelManager::OnVideoCaptureStateChange);
-
-  if (worker_thread_ != rtc::Thread::Current()) {
-    // Do not allow invoking calls to other threads on the worker thread.
-    worker_thread_->Invoke<bool>(
-        rtc::Bind(&rtc::Thread::SetAllowBlockingCalls, worker_thread_, false));
-  }
 }
 
 ChannelManager::~ChannelManager() {
@@ -224,6 +218,12 @@ bool ChannelManager::Init() {
 
   ASSERT(worker_thread_ != NULL);
   if (worker_thread_) {
+    if (worker_thread_ != rtc::Thread::Current()) {
+      // Do not allow invoking calls to other threads on the worker thread.
+      worker_thread_->Invoke<bool>(rtc::Bind(
+          &rtc::Thread::SetAllowBlockingCalls, worker_thread_, false));
+    }
+
     if (media_engine_->Init(worker_thread_)) {
       initialized_ = true;
 
@@ -362,22 +362,48 @@ void ChannelManager::DestroyVoiceChannel_w(VoiceChannel* voice_channel) {
 }
 
 VideoChannel* ChannelManager::CreateVideoChannel(
-    BaseSession* session, const std::string& content_name, bool rtcp,
+    BaseSession* session,
+    const std::string& content_name,
+    bool rtcp,
+    VoiceChannel* voice_channel) {
+  return worker_thread_->Invoke<VideoChannel*>(
+      Bind(&ChannelManager::CreateVideoChannel_w,
+           this,
+           session,
+           content_name,
+           rtcp,
+           VideoOptions(),
+           voice_channel));
+}
+
+VideoChannel* ChannelManager::CreateVideoChannel(
+    BaseSession* session,
+    const std::string& content_name,
+    bool rtcp,
+    const VideoOptions& options,
     VoiceChannel* voice_channel) {
   return worker_thread_->Invoke<VideoChannel*>(
-      Bind(&ChannelManager::CreateVideoChannel_w, this, session,
-           content_name, rtcp, voice_channel));
+      Bind(&ChannelManager::CreateVideoChannel_w,
+           this,
+           session,
+           content_name,
+           rtcp,
+           options,
+           voice_channel));
 }
 
 VideoChannel* ChannelManager::CreateVideoChannel_w(
-    BaseSession* session, const std::string& content_name, bool rtcp,
+    BaseSession* session,
+    const std::string& content_name,
+    bool rtcp,
+    const VideoOptions& options,
     VoiceChannel* voice_channel) {
   // This is ok to alloc from a thread other than the worker thread
   ASSERT(initialized_);
   VideoMediaChannel* media_channel =
       // voice_channel can be NULL in case of NullVoiceEngine.
-      media_engine_->CreateVideoChannel(voice_channel ?
-          voice_channel->media_channel() : NULL);
+      media_engine_->CreateVideoChannel(
+          options, voice_channel ? voice_channel->media_channel() : NULL);
   if (media_channel == NULL)
     return NULL;