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_low_latency_input_win.h" | 5 #include "media/audio/win/audio_low_latency_input_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "media/audio/win/audio_manager_win.h" | 10 #include "media/audio/win/audio_manager_win.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // Retrieve the default capture audio endpoint. | 275 // Retrieve the default capture audio endpoint. |
276 hr = enumerator->GetDefaultAudioEndpoint(eCapture, eConsole, | 276 hr = enumerator->GetDefaultAudioEndpoint(eCapture, eConsole, |
277 endpoint_device.Receive()); | 277 endpoint_device.Receive()); |
278 } else if (device_id == AudioManagerBase::kLoopbackInputDeviceId) { | 278 } else if (device_id == AudioManagerBase::kLoopbackInputDeviceId) { |
279 // Capture the default playback stream. | 279 // Capture the default playback stream. |
280 hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, | 280 hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, |
281 endpoint_device.Receive()); | 281 endpoint_device.Receive()); |
282 } else { | 282 } else { |
283 // Retrieve a capture endpoint device that is specified by an endpoint | 283 // Retrieve a capture endpoint device that is specified by an endpoint |
284 // device-identification string. | 284 // device-identification string. |
285 hr = enumerator->GetDevice(UTF8ToUTF16(device_id).c_str(), | 285 hr = enumerator->GetDevice(base::UTF8ToUTF16(device_id).c_str(), |
286 endpoint_device.Receive()); | 286 endpoint_device.Receive()); |
287 } | 287 } |
288 if (FAILED(hr)) | 288 if (FAILED(hr)) |
289 return hr; | 289 return hr; |
290 | 290 |
291 ScopedComPtr<IAudioClient> audio_client; | 291 ScopedComPtr<IAudioClient> audio_client; |
292 hr = endpoint_device->Activate(__uuidof(IAudioClient), | 292 hr = endpoint_device->Activate(__uuidof(IAudioClient), |
293 CLSCTX_INPROC_SERVER, | 293 CLSCTX_INPROC_SERVER, |
294 NULL, | 294 NULL, |
295 audio_client.ReceiveVoid()); | 295 audio_client.ReceiveVoid()); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // but the system-supplied user interface programs do not. | 471 // but the system-supplied user interface programs do not. |
472 hr = enumerator->GetDefaultAudioEndpoint(eCapture, eConsole, | 472 hr = enumerator->GetDefaultAudioEndpoint(eCapture, eConsole, |
473 endpoint_device_.Receive()); | 473 endpoint_device_.Receive()); |
474 } else if (device_id_ == AudioManagerBase::kLoopbackInputDeviceId) { | 474 } else if (device_id_ == AudioManagerBase::kLoopbackInputDeviceId) { |
475 // Capture the default playback stream. | 475 // Capture the default playback stream. |
476 hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, | 476 hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, |
477 endpoint_device_.Receive()); | 477 endpoint_device_.Receive()); |
478 } else { | 478 } else { |
479 // Retrieve a capture endpoint device that is specified by an endpoint | 479 // Retrieve a capture endpoint device that is specified by an endpoint |
480 // device-identification string. | 480 // device-identification string. |
481 hr = enumerator->GetDevice(UTF8ToUTF16(device_id_).c_str(), | 481 hr = enumerator->GetDevice(base::UTF8ToUTF16(device_id_).c_str(), |
482 endpoint_device_.Receive()); | 482 endpoint_device_.Receive()); |
483 } | 483 } |
484 | 484 |
485 if (FAILED(hr)) | 485 if (FAILED(hr)) |
486 return hr; | 486 return hr; |
487 | 487 |
488 // Verify that the audio endpoint device is active, i.e., the audio | 488 // Verify that the audio endpoint device is active, i.e., the audio |
489 // adapter that connects to the endpoint device is present and enabled. | 489 // adapter that connects to the endpoint device is present and enabled. |
490 DWORD state = DEVICE_STATE_DISABLED; | 490 DWORD state = DEVICE_STATE_DISABLED; |
491 hr = endpoint_device_->GetState(&state); | 491 hr = endpoint_device_->GetState(&state); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 return hr; | 679 return hr; |
680 | 680 |
681 // Obtain a reference to the ISimpleAudioVolume interface which enables | 681 // Obtain a reference to the ISimpleAudioVolume interface which enables |
682 // us to control the master volume level of an audio session. | 682 // us to control the master volume level of an audio session. |
683 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume), | 683 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume), |
684 simple_audio_volume_.ReceiveVoid()); | 684 simple_audio_volume_.ReceiveVoid()); |
685 return hr; | 685 return hr; |
686 } | 686 } |
687 | 687 |
688 } // namespace media | 688 } // namespace media |
OLD | NEW |