| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "media/audio/audio_util.h" | 10 #include "media/audio/audio_util.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 if (FAILED(hr)) { | 200 if (FAILED(hr)) { |
| 201 NOTREACHED() << "error code: " << hr; | 201 NOTREACHED() << "error code: " << hr; |
| 202 return 0.0; | 202 return 0.0; |
| 203 } | 203 } |
| 204 | 204 |
| 205 ScopedComPtr<IMMDevice> endpoint_device; | 205 ScopedComPtr<IMMDevice> endpoint_device; |
| 206 hr = enumerator->GetDefaultAudioEndpoint(eCapture, | 206 hr = enumerator->GetDefaultAudioEndpoint(eCapture, |
| 207 device_role, | 207 device_role, |
| 208 endpoint_device.Receive()); | 208 endpoint_device.Receive()); |
| 209 if (FAILED(hr)) { | 209 if (FAILED(hr)) { |
| 210 NOTREACHED() << "error code: " << hr; | 210 // This will happen if there's no audio capture device found or available |
| 211 // (e.g. some audio cards that have inputs will still report them as |
| 212 // "not found" when no mic is plugged into the input jack). |
| 213 LOG(WARNING) << "No audio end point: " << std::hex << hr; |
| 211 return 0.0; | 214 return 0.0; |
| 212 } | 215 } |
| 213 | 216 |
| 214 ScopedComPtr<IAudioClient> audio_client; | 217 ScopedComPtr<IAudioClient> audio_client; |
| 215 hr = endpoint_device->Activate(__uuidof(IAudioClient), | 218 hr = endpoint_device->Activate(__uuidof(IAudioClient), |
| 216 CLSCTX_INPROC_SERVER, | 219 CLSCTX_INPROC_SERVER, |
| 217 NULL, | 220 NULL, |
| 218 audio_client.ReceiveVoid()); | 221 audio_client.ReceiveVoid()); |
| 219 if (FAILED(hr)) { | 222 if (FAILED(hr)) { |
| 220 NOTREACHED() << "error code: " << hr; | 223 NOTREACHED() << "error code: " << hr; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 hr = audio_client_->SetEventHandle(audio_samples_ready_event_.Get()); | 505 hr = audio_client_->SetEventHandle(audio_samples_ready_event_.Get()); |
| 503 if (FAILED(hr)) | 506 if (FAILED(hr)) |
| 504 return hr; | 507 return hr; |
| 505 | 508 |
| 506 // Get access to the IAudioCaptureClient interface. This interface | 509 // Get access to the IAudioCaptureClient interface. This interface |
| 507 // enables us to read input data from the capture endpoint buffer. | 510 // enables us to read input data from the capture endpoint buffer. |
| 508 hr = audio_client_->GetService(__uuidof(IAudioCaptureClient), | 511 hr = audio_client_->GetService(__uuidof(IAudioCaptureClient), |
| 509 audio_capture_client_.ReceiveVoid()); | 512 audio_capture_client_.ReceiveVoid()); |
| 510 return hr; | 513 return hr; |
| 511 } | 514 } |
| OLD | NEW |