diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-02 20:51:33 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-02 20:51:33 +0000 |
commit | 02037c63e776ba5661531e7720cf9efcd1fa2b68 (patch) | |
tree | 096066c43f8858c72c43536c9258cf4a4fbab33e | |
parent | 0867cb17a83fa04cda2ce8336584653541493123 (diff) | |
download | chromium_src-02037c63e776ba5661531e7720cf9efcd1fa2b68.zip chromium_src-02037c63e776ba5661531e7720cf9efcd1fa2b68.tar.gz chromium_src-02037c63e776ba5661531e7720cf9efcd1fa2b68.tar.bz2 |
Don't use ScopedCOMInitializer in AudioCapturerWin
COM needs to be initialized per-thread, AudioCapturerWin was
using ScopedCOMInitializer.
BUG=146392
Review URL: https://codereview.chromium.org/11369038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165746 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/host/audio_capturer_win.cc | 2 | ||||
-rw-r--r-- | remoting/host/audio_capturer_win.h | 2 | ||||
-rw-r--r-- | remoting/host/chromoting_host_context.cc | 15 |
3 files changed, 13 insertions, 6 deletions
diff --git a/remoting/host/audio_capturer_win.cc b/remoting/host/audio_capturer_win.cc index 90714ac..977bdaf 100644 --- a/remoting/host/audio_capturer_win.cc +++ b/remoting/host/audio_capturer_win.cc @@ -58,7 +58,6 @@ bool AudioCapturerWin::Start(const PacketCapturedCallback& callback) { capture_timer_.reset(new base::RepeatingTimer<AudioCapturerWin>()); HRESULT hr = S_OK; - com_initializer_.reset(new base::win::ScopedCOMInitializer()); base::win::ScopedComPtr<IMMDeviceEnumerator> mm_device_enumerator; hr = mm_device_enumerator.CreateInstance(__uuidof(MMDeviceEnumerator)); @@ -206,7 +205,6 @@ void AudioCapturerWin::Stop() { audio_client_.Release(); audio_capture_client_.Release(); wave_format_ex_.Reset(NULL); - com_initializer_.reset(); thread_checker_.DetachFromThread(); } diff --git a/remoting/host/audio_capturer_win.h b/remoting/host/audio_capturer_win.h index 4b0d38e..ad3ddea 100644 --- a/remoting/host/audio_capturer_win.h +++ b/remoting/host/audio_capturer_win.h @@ -12,7 +12,6 @@ #include "base/memory/scoped_ptr.h" #include "base/timer.h" #include "base/win/scoped_co_mem.h" -#include "base/win/scoped_com_initializer.h" #include "base/win/scoped_comptr.h" #include "remoting/host/audio_capturer.h" #include "remoting/proto/audio.pb.h" @@ -47,7 +46,6 @@ class AudioCapturerWin : public AudioCapturer { base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_; base::win::ScopedComPtr<IAudioClient> audio_client_; base::win::ScopedComPtr<IMMDevice> mm_device_; - scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; base::ThreadChecker thread_checker_; diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc index c3699ca..81c852a 100644 --- a/remoting/host/chromoting_host_context.cc +++ b/remoting/host/chromoting_host_context.cc @@ -41,8 +41,19 @@ void ChromotingHostContext::ReleaseTaskRunners() { bool ChromotingHostContext::Start() { // Start all the threads. base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0); - bool started = capture_thread_.Start() && encode_thread_.Start() && - audio_thread_.StartWithOptions(io_thread_options) && + + bool started = capture_thread_.Start() && encode_thread_.Start(); + +#if defined(OS_WIN) + // On Windows audio capturer needs to run on a UI thread that has COM + // initialized. + audio_thread_.init_com_with_mta(false); + started = started && audio_thread_.Start(); +#else // defined(OS_WIN) + started = started && audio_thread_.StartWithOptions(io_thread_options); +#endif // !defined(OS_WIN) + + started = started && file_thread_.StartWithOptions(io_thread_options) && input_thread_.StartWithOptions(io_thread_options) && network_thread_.StartWithOptions(io_thread_options); |