summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/host/audio_capturer_win.cc2
-rw-r--r--remoting/host/audio_capturer_win.h2
-rw-r--r--remoting/host/chromoting_host_context.cc15
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);