| 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/core_audio_util_win.h" | 5 #include "media/audio/win/core_audio_util_win.h" |
| 6 | 6 |
| 7 #include <devicetopology.h> | 7 #include <devicetopology.h> |
| 8 #include <dxdiag.h> | 8 #include <dxdiag.h> |
| 9 #include <functiondiscoverykeys_devpkey.h> | 9 #include <functiondiscoverykeys_devpkey.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (FAILED(hr)) { | 298 if (FAILED(hr)) { |
| 299 DVLOG(1) << "IMMDeviceEnumerator::GetDefaultAudioEndpoint: " | 299 DVLOG(1) << "IMMDeviceEnumerator::GetDefaultAudioEndpoint: " |
| 300 << std::hex << hr; | 300 << std::hex << hr; |
| 301 return endpoint_device; | 301 return endpoint_device; |
| 302 } | 302 } |
| 303 | 303 |
| 304 // Verify that the audio endpoint device is active, i.e., that the audio | 304 // Verify that the audio endpoint device is active, i.e., that the audio |
| 305 // adapter that connects to the endpoint device is present and enabled. | 305 // adapter that connects to the endpoint device is present and enabled. |
| 306 if (!IsDeviceActive(endpoint_device.get())) { | 306 if (!IsDeviceActive(endpoint_device.get())) { |
| 307 DVLOG(1) << "Selected endpoint device is not active"; | 307 DVLOG(1) << "Selected endpoint device is not active"; |
| 308 endpoint_device.Release(); | 308 endpoint_device.Reset(); |
| 309 } | 309 } |
| 310 return endpoint_device; | 310 return endpoint_device; |
| 311 } | 311 } |
| 312 | 312 |
| 313 std::string CoreAudioUtil::GetDefaultOutputDeviceID() { | 313 std::string CoreAudioUtil::GetDefaultOutputDeviceID() { |
| 314 ScopedComPtr<IMMDevice> device(CreateDefaultDevice(eRender, eConsole)); | 314 ScopedComPtr<IMMDevice> device(CreateDefaultDevice(eRender, eConsole)); |
| 315 return device.get() ? GetDeviceID(device.get()) : std::string(); | 315 return device.get() ? GetDeviceID(device.get()) : std::string(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 ScopedComPtr<IMMDevice> CoreAudioUtil::CreateDevice( | 318 ScopedComPtr<IMMDevice> CoreAudioUtil::CreateDevice( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 334 | 334 |
| 335 if (FAILED(hr)) { | 335 if (FAILED(hr)) { |
| 336 DVLOG(1) << "IMMDeviceEnumerator::GetDevice: " << std::hex << hr; | 336 DVLOG(1) << "IMMDeviceEnumerator::GetDevice: " << std::hex << hr; |
| 337 return endpoint_device; | 337 return endpoint_device; |
| 338 } | 338 } |
| 339 | 339 |
| 340 // Verify that the audio endpoint device is active, i.e., that the audio | 340 // Verify that the audio endpoint device is active, i.e., that the audio |
| 341 // adapter that connects to the endpoint device is present and enabled. | 341 // adapter that connects to the endpoint device is present and enabled. |
| 342 if (!IsDeviceActive(endpoint_device.get())) { | 342 if (!IsDeviceActive(endpoint_device.get())) { |
| 343 DVLOG(1) << "Selected endpoint device is not active"; | 343 DVLOG(1) << "Selected endpoint device is not active"; |
| 344 endpoint_device.Release(); | 344 endpoint_device.Reset(); |
| 345 } | 345 } |
| 346 return endpoint_device; | 346 return endpoint_device; |
| 347 } | 347 } |
| 348 | 348 |
| 349 HRESULT CoreAudioUtil::GetDeviceName(IMMDevice* device, AudioDeviceName* name) { | 349 HRESULT CoreAudioUtil::GetDeviceName(IMMDevice* device, AudioDeviceName* name) { |
| 350 // Retrieve unique name of endpoint device. | 350 // Retrieve unique name of endpoint device. |
| 351 // Example: "{0.0.1.00000000}.{8db6020f-18e3-4f25-b6f5-7726c9122574}". | 351 // Example: "{0.0.1.00000000}.{8db6020f-18e3-4f25-b6f5-7726c9122574}". |
| 352 AudioDeviceName device_name; | 352 AudioDeviceName device_name; |
| 353 device_name.unique_id = GetDeviceID(device); | 353 device_name.unique_id = GetDeviceID(device); |
| 354 if (device_name.unique_id.empty()) | 354 if (device_name.unique_id.empty()) |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 920 |
| 921 if (variant.type() == VT_BSTR && variant.ptr()->bstrVal) { | 921 if (variant.type() == VT_BSTR && variant.ptr()->bstrVal) { |
| 922 base::WideToUTF8(variant.ptr()->bstrVal, wcslen(variant.ptr()->bstrVal), | 922 base::WideToUTF8(variant.ptr()->bstrVal, wcslen(variant.ptr()->bstrVal), |
| 923 driver_version); | 923 driver_version); |
| 924 } | 924 } |
| 925 | 925 |
| 926 return true; | 926 return true; |
| 927 } | 927 } |
| 928 | 928 |
| 929 } // namespace media | 929 } // namespace media |
| OLD | NEW |