Chromium Code Reviews| 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 "media/audio/audio_io.h" | 5 #include "media/audio/audio_io.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <objbase.h> // This has to be before initguid.h | 8 #include <objbase.h> // This has to be before initguid.h |
| 9 #include <initguid.h> | 9 #include <initguid.h> |
| 10 #include <mmsystem.h> | 10 #include <mmsystem.h> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool AudioManagerWin::HasAudioOutputDevices() { | 156 bool AudioManagerWin::HasAudioOutputDevices() { |
| 157 return (::waveOutGetNumDevs() != 0); | 157 return (::waveOutGetNumDevs() != 0); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool AudioManagerWin::HasAudioInputDevices() { | 160 bool AudioManagerWin::HasAudioInputDevices() { |
| 161 return (::waveInGetNumDevs() != 0); | 161 return (::waveInGetNumDevs() != 0); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void AudioManagerWin::CreateDeviceListener() { | 164 void AudioManagerWin::CreateDeviceListener() { |
|
Ami GONE FROM CHROMIUM
2014/01/08 21:37:41
DCHECK(GetTaskRunner()->IsCurrent());
or whatever?
scherkus (not reviewing)
2014/01/09 01:52:02
indeed!
| |
| 165 // AudioDeviceListenerWin must be initialized on a COM thread and should only | 165 // AudioDeviceListenerWin must be initialized on a COM thread and should only |
| 166 // be used if WASAPI / Core Audio is supported. | 166 // be used if WASAPI / Core Audio is supported. |
| 167 if (CoreAudioUtil::IsSupported()) { | 167 if (CoreAudioUtil::IsSupported()) { |
| 168 output_device_listener_.reset(new AudioDeviceListenerWin(BindToLoop( | 168 output_device_listener_.reset(new AudioDeviceListenerWin(BindToCurrentLoop( |
| 169 GetTaskRunner(), base::Bind( | 169 base::Bind(&AudioManagerWin::NotifyAllOutputDeviceChangeListeners, |
| 170 &AudioManagerWin::NotifyAllOutputDeviceChangeListeners, | 170 base::Unretained(this))))); |
| 171 base::Unretained(this))))); | |
| 172 } | 171 } |
| 173 } | 172 } |
| 174 | 173 |
| 175 void AudioManagerWin::DestroyDeviceListener() { | 174 void AudioManagerWin::DestroyDeviceListener() { |
| 176 output_device_listener_.reset(); | 175 output_device_listener_.reset(); |
| 177 } | 176 } |
| 178 | 177 |
| 179 base::string16 AudioManagerWin::GetAudioInputDeviceModel() { | 178 base::string16 AudioManagerWin::GetAudioInputDeviceModel() { |
| 180 // Get the default audio capture device and its device interface name. | 179 // Get the default audio capture device and its device interface name. |
| 181 DWORD device_id = 0; | 180 DWORD device_id = 0; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, | 522 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, |
| 524 xp_device_id); | 523 xp_device_id); |
| 525 } | 524 } |
| 526 | 525 |
| 527 /// static | 526 /// static |
| 528 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 527 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
| 529 return new AudioManagerWin(audio_log_factory); | 528 return new AudioManagerWin(audio_log_factory); |
| 530 } | 529 } |
| 531 | 530 |
| 532 } // namespace media | 531 } // namespace media |
| OLD | NEW |