| Index: trunk/src/content/browser/renderer_host/media/media_stream_manager.cc
|
| ===================================================================
|
| --- trunk/src/content/browser/renderer_host/media/media_stream_manager.cc (revision 210020)
|
| +++ trunk/src/content/browser/renderer_host/media/media_stream_manager.cc (working copy)
|
| @@ -11,6 +11,7 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/logging.h"
|
| #include "base/rand_util.h"
|
| +#include "base/threading/thread.h"
|
| #include "content/browser/renderer_host/media/audio_input_device_manager.h"
|
| #include "content/browser/renderer_host/media/media_stream_requester.h"
|
| #include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
|
| @@ -148,7 +149,7 @@
|
|
|
| MediaStreamManager::~MediaStreamManager() {
|
| DCHECK(requests_.empty());
|
| - DCHECK(!device_loop_.get());
|
| + DCHECK(!device_thread_.get());
|
| DCHECK(!io_loop_);
|
| }
|
|
|
| @@ -585,15 +586,22 @@
|
|
|
| void MediaStreamManager::InitializeDeviceManagersOnIOThread() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - if (device_loop_.get())
|
| + if (device_thread_)
|
| return;
|
| - device_loop_ = audio_manager_->GetMessageLoop();
|
|
|
| + device_thread_.reset(new base::Thread("MediaStreamDeviceThread"));
|
| +#if defined(OS_WIN)
|
| + device_thread_->init_com_with_mta(true);
|
| +#endif
|
| + CHECK(device_thread_->Start());
|
| +
|
| audio_input_device_manager_ = new AudioInputDeviceManager(audio_manager_);
|
| - audio_input_device_manager_->Register(this, device_loop_.get());
|
| + audio_input_device_manager_->Register(
|
| + this, device_thread_->message_loop_proxy().get());
|
|
|
| video_capture_manager_ = new VideoCaptureManager();
|
| - video_capture_manager_->Register(this, device_loop_.get());
|
| + video_capture_manager_->Register(this,
|
| + device_thread_->message_loop_proxy().get());
|
|
|
| // We want to be notified of IO message loop destruction to delete the thread
|
| // and the device managers.
|
| @@ -937,12 +945,12 @@
|
| void MediaStreamManager::WillDestroyCurrentMessageLoop() {
|
| DCHECK_EQ(base::MessageLoop::current(), io_loop_);
|
| DCHECK(requests_.empty());
|
| - if (device_loop_.get()) {
|
| + if (device_thread_) {
|
| StopMonitoring();
|
|
|
| video_capture_manager_->Unregister();
|
| audio_input_device_manager_->Unregister();
|
| - device_loop_ = NULL;
|
| + device_thread_.reset();
|
| }
|
|
|
| audio_input_device_manager_ = NULL;
|
|
|