diff options
author | guidou <guidou@chromium.org> | 2015-12-14 13:28:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-14 21:29:21 +0000 |
commit | 1eb49fb9a056c509efb809f4547c4a1c072b48d9 (patch) | |
tree | c4206617fba412e2bb4cf9b6b30405e740e2f30b | |
parent | 0b9b347bef4480ca5393afdcd583678591298900 (diff) | |
download | chromium_src-1eb49fb9a056c509efb809f4547c4a1c072b48d9.zip chromium_src-1eb49fb9a056c509efb809f4547c4a1c072b48d9.tar.gz chromium_src-1eb49fb9a056c509efb809f4547c4a1c072b48d9.tar.bz2 |
Create default client in CoreAudioUtil for both default device IDs.
BUG=479057
Review URL: https://codereview.chromium.org/1524793002
Cr-Commit-Position: refs/heads/master@{#365101}
-rw-r--r-- | media/audio/win/core_audio_util_win.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc index 4db77c0..fce679c 100644 --- a/media/audio/win/core_audio_util_win.cc +++ b/media/audio/win/core_audio_util_win.cc @@ -146,6 +146,10 @@ static std::string GetDeviceID(IMMDevice* device) { return device_id; } +static bool IsDefaultDeviceId(const std::string& device_id) { + return device_id.empty() || device_id == AudioManagerBase::kDefaultDeviceId; +} + static bool IsDeviceActive(IMMDevice* device) { DWORD state = DEVICE_STATE_DISABLED; return SUCCEEDED(device->GetState(&state)) && (state & DEVICE_STATE_ACTIVE); @@ -438,8 +442,7 @@ std::string CoreAudioUtil::GetMatchingOutputDeviceID( return AudioManagerBase::kCommunicationsDeviceId; ScopedComPtr<IMMDevice> input_device; - if (input_device_id.empty() || - input_device_id == AudioManagerBase::kDefaultDeviceId) { + if (IsDefaultDeviceId(input_device_id)) { input_device = CreateDefaultDevice(eCapture, eConsole); } else { input_device = CreateDevice(input_device_id); @@ -547,7 +550,7 @@ ScopedComPtr<IAudioClient> CoreAudioUtil::CreateDefaultClient( ScopedComPtr<IAudioClient> CoreAudioUtil::CreateClient( const std::string& device_id, EDataFlow data_flow, ERole role) { - if (device_id.empty()) + if (IsDefaultDeviceId(device_id)) return CreateDefaultClient(data_flow, role); ScopedComPtr<IMMDevice> device(CreateDevice(device_id)); |