Chromium Code Reviews| Index: media/audio/audio_system_impl.cc |
| diff --git a/media/audio/audio_system_impl.cc b/media/audio/audio_system_impl.cc |
| index 96300ba950df9e3c3cef1f2acd9ac369fd0b1be6..fdffa70fda0f70cbce1e60457eb2044e9287a254 100644 |
| --- a/media/audio/audio_system_impl.cc |
| +++ b/media/audio/audio_system_impl.cc |
| @@ -33,9 +33,12 @@ AudioParameters GetInputParametersOnDeviceThread(AudioManager* audio_manager, |
| AudioSystemImpl::AudioSystemImpl(AudioManager* audio_manager) |
| : audio_manager_(audio_manager) { |
| DCHECK(audio_manager_); |
| + AudioSystem::SetInstance(this); |
| } |
| -AudioSystemImpl::~AudioSystemImpl() {} |
| +AudioSystemImpl::~AudioSystemImpl() { |
| + AudioSystem::ClearInstance(this); |
| +} |
| // static |
| std::unique_ptr<AudioSystem> AudioSystemImpl::Create( |
| @@ -59,6 +62,20 @@ void AudioSystemImpl::GetInputStreamParameters( |
| std::move(on_params_cb)); |
| } |
| +void AudioSystemImpl::HasInputDevices(OnBoolCallback on_has_devices_cb) const { |
| + if (GetTaskRunner()->BelongsToCurrentThread()) { |
|
tommi (sloooow) - chröme
2017/02/09 16:39:34
I guess this is necessary so that the on_has_devic
o1ka
2017/02/09 16:56:10
It's never called on the audio thread unless it is
tommi (sloooow) - chröme
2017/02/10 10:51:07
Thanks - now looking at this again, I see I misre
|
| + GetTaskRunner()->PostTask( |
| + FROM_HERE, |
| + base::Bind(on_has_devices_cb, audio_manager_->HasAudioInputDevices())); |
| + return; |
| + } |
| + base::PostTaskAndReplyWithResult( |
| + GetTaskRunner(), FROM_HERE, |
| + base::Bind(&AudioManager::HasAudioInputDevices, |
| + base::Unretained(audio_manager_)), |
| + std::move(on_has_devices_cb)); |
| +} |
| + |
| AudioManager* AudioSystemImpl::GetAudioManager() const { |
| return audio_manager_; |
| } |