| 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 <objbase.h> | 7 #include <objbase.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 NOTREACHED() << "Error code: " << err; | 506 NOTREACHED() << "Error code: " << err; |
| 507 if (sink_) | 507 if (sink_) |
| 508 sink_->OnError(this); | 508 sink_->OnError(this); |
| 509 } | 509 } |
| 510 | 510 |
| 511 HRESULT WASAPIAudioInputStream::SetCaptureDevice() { | 511 HRESULT WASAPIAudioInputStream::SetCaptureDevice() { |
| 512 DCHECK_EQ(OPEN_RESULT_OK, open_result_); | 512 DCHECK_EQ(OPEN_RESULT_OK, open_result_); |
| 513 DCHECK(!endpoint_device_.Get()); | 513 DCHECK(!endpoint_device_.Get()); |
| 514 | 514 |
| 515 ScopedComPtr<IMMDeviceEnumerator> enumerator; | 515 ScopedComPtr<IMMDeviceEnumerator> enumerator; |
| 516 HRESULT hr = enumerator.CreateInstance(__uuidof(MMDeviceEnumerator), NULL, | 516 HRESULT hr = |
| 517 CLSCTX_INPROC_SERVER); | 517 ::CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, |
| 518 CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&enumerator)); |
| 518 if (FAILED(hr)) { | 519 if (FAILED(hr)) { |
| 519 open_result_ = OPEN_RESULT_CREATE_INSTANCE; | 520 open_result_ = OPEN_RESULT_CREATE_INSTANCE; |
| 520 return hr; | 521 return hr; |
| 521 } | 522 } |
| 522 | 523 |
| 523 // Retrieve the IMMDevice by using the specified role or the specified | 524 // Retrieve the IMMDevice by using the specified role or the specified |
| 524 // unique endpoint device-identification string. | 525 // unique endpoint device-identification string. |
| 525 | 526 |
| 526 if (device_id_ == AudioDeviceDescription::kDefaultDeviceId) { | 527 if (device_id_ == AudioDeviceDescription::kDefaultDeviceId) { |
| 527 // Retrieve the default capture audio endpoint for the specified role. | 528 // Retrieve the default capture audio endpoint for the specified role. |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 OPEN_RESULT_MAX + 1); | 829 OPEN_RESULT_MAX + 1); |
| 829 } | 830 } |
| 830 | 831 |
| 831 double WASAPIAudioInputStream::ProvideInput(AudioBus* audio_bus, | 832 double WASAPIAudioInputStream::ProvideInput(AudioBus* audio_bus, |
| 832 uint32_t frames_delayed) { | 833 uint32_t frames_delayed) { |
| 833 fifo_->Consume()->CopyTo(audio_bus); | 834 fifo_->Consume()->CopyTo(audio_bus); |
| 834 return 1.0; | 835 return 1.0; |
| 835 } | 836 } |
| 836 | 837 |
| 837 } // namespace media | 838 } // namespace media |
| OLD | NEW |