Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: remoting/host/audio_capturer_win.cc

Issue 2887243002: Remove ScopedComPtr::CreateInstance() (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | remoting/host/desktop_session_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | remoting/host/desktop_session_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698