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/win/audio_manager_win.h" | 5 #include "media/audio/win/audio_manager_win.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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // loads libraries or attempts to call out into the OS. Instead add such code | 150 // loads libraries or attempts to call out into the OS. Instead add such code |
151 // to the InitializeOnAudioThread() method below. | 151 // to the InitializeOnAudioThread() method below. |
152 | 152 |
153 // Task must be posted last to avoid races from handing out "this" to the | 153 // Task must be posted last to avoid races from handing out "this" to the |
154 // audio thread. | 154 // audio thread. |
155 GetTaskRunner()->PostTask( | 155 GetTaskRunner()->PostTask( |
156 FROM_HERE, base::Bind(&AudioManagerWin::InitializeOnAudioThread, | 156 FROM_HERE, base::Bind(&AudioManagerWin::InitializeOnAudioThread, |
157 base::Unretained(this))); | 157 base::Unretained(this))); |
158 } | 158 } |
159 | 159 |
160 AudioManagerWin::~AudioManagerWin() { | 160 AudioManagerWin::~AudioManagerWin() = default; |
161 Shutdown(); | 161 |
| 162 void AudioManagerWin::Shutdown() { |
| 163 AudioManagerBase::Shutdown(); |
| 164 output_device_listener_.reset(); |
162 } | 165 } |
163 | 166 |
164 bool AudioManagerWin::HasAudioOutputDevices() { | 167 bool AudioManagerWin::HasAudioOutputDevices() { |
165 return (::waveOutGetNumDevs() != 0); | 168 return (::waveOutGetNumDevs() != 0); |
166 } | 169 } |
167 | 170 |
168 bool AudioManagerWin::HasAudioInputDevices() { | 171 bool AudioManagerWin::HasAudioInputDevices() { |
169 return (::waveInGetNumDevs() != 0); | 172 return (::waveInGetNumDevs() != 0); |
170 } | 173 } |
171 | 174 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 if (user_buffer_size) | 460 if (user_buffer_size) |
458 buffer_size = user_buffer_size; | 461 buffer_size = user_buffer_size; |
459 | 462 |
460 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, | 463 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, |
461 sample_rate, bits_per_sample, buffer_size); | 464 sample_rate, bits_per_sample, buffer_size); |
462 params.set_effects(effects); | 465 params.set_effects(effects); |
463 return params; | 466 return params; |
464 } | 467 } |
465 | 468 |
466 // static | 469 // static |
467 ScopedAudioManagerPtr CreateAudioManager( | 470 std::unique_ptr<AudioManager> CreateAudioManager( |
468 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 471 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
469 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 472 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
470 AudioLogFactory* audio_log_factory) { | 473 AudioLogFactory* audio_log_factory) { |
471 return ScopedAudioManagerPtr( | 474 return base::MakeUnique<AudioManagerWin>( |
472 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner), | 475 std::move(task_runner), std::move(worker_task_runner), audio_log_factory); |
473 audio_log_factory)); | |
474 } | 476 } |
475 | 477 |
476 } // namespace media | 478 } // namespace media |
OLD | NEW |