OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/audio_capturer_win.h" | 5 #include "remoting/host/audio_capturer_win.h" |
6 | 6 |
7 #include <avrt.h> | 7 #include <avrt.h> |
8 #include <mmreg.h> | 8 #include <mmreg.h> |
9 #include <mmsystem.h> | 9 #include <mmsystem.h> |
10 #include <objbase.h> | 10 #include <objbase.h> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool AudioCapturerWin::Initialize() { | 97 bool AudioCapturerWin::Initialize() { |
98 DCHECK(!audio_capture_client_.Get()); | 98 DCHECK(!audio_capture_client_.Get()); |
99 DCHECK(!audio_client_.Get()); | 99 DCHECK(!audio_client_.Get()); |
100 DCHECK(!mm_device_.Get()); | 100 DCHECK(!mm_device_.Get()); |
101 DCHECK(!audio_volume_.Get()); | 101 DCHECK(!audio_volume_.Get()); |
102 DCHECK(static_cast<PWAVEFORMATEX>(wave_format_ex_) == nullptr); | 102 DCHECK(static_cast<PWAVEFORMATEX>(wave_format_ex_) == nullptr); |
103 DCHECK(thread_checker_.CalledOnValidThread()); | 103 DCHECK(thread_checker_.CalledOnValidThread()); |
104 | 104 |
105 HRESULT hr = S_OK; | 105 HRESULT hr = S_OK; |
106 base::win::ScopedComPtr<IMMDeviceEnumerator> mm_device_enumerator; | 106 base::win::ScopedComPtr<IMMDeviceEnumerator> mm_device_enumerator; |
107 hr = mm_device_enumerator.CreateInstance(__uuidof(MMDeviceEnumerator)); | 107 hr = ::CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, |
| 108 IID_PPV_ARGS(&mm_device_enumerator)); |
108 if (FAILED(hr)) { | 109 if (FAILED(hr)) { |
109 LOG(ERROR) << "Failed to create IMMDeviceEnumerator. Error " << hr; | 110 LOG(ERROR) << "Failed to create IMMDeviceEnumerator. Error " << hr; |
110 return false; | 111 return false; |
111 } | 112 } |
112 | 113 |
113 default_device_detector_.reset( | 114 default_device_detector_.reset( |
114 new DefaultAudioDeviceChangeDetector(mm_device_enumerator)); | 115 new DefaultAudioDeviceChangeDetector(mm_device_enumerator)); |
115 | 116 |
116 // Get the audio endpoint. | 117 // Get the audio endpoint. |
117 hr = mm_device_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, | 118 hr = mm_device_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 369 |
369 bool AudioCapturer::IsSupported() { | 370 bool AudioCapturer::IsSupported() { |
370 return true; | 371 return true; |
371 } | 372 } |
372 | 373 |
373 std::unique_ptr<AudioCapturer> AudioCapturer::Create() { | 374 std::unique_ptr<AudioCapturer> AudioCapturer::Create() { |
374 return base::WrapUnique(new AudioCapturerWin()); | 375 return base::WrapUnique(new AudioCapturerWin()); |
375 } | 376 } |
376 | 377 |
377 } // namespace remoting | 378 } // namespace remoting |
OLD | NEW |