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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return false; | 114 return false; |
115 } | 115 } |
116 | 116 |
117 opened_ = true; | 117 opened_ = true; |
118 | 118 |
119 return true; | 119 return true; |
120 } | 120 } |
121 | 121 |
122 void WASAPIAudioInputStream::Start(AudioInputCallback* callback) { | 122 void WASAPIAudioInputStream::Start(AudioInputCallback* callback) { |
123 DCHECK(callback); | 123 DCHECK(callback); |
124 DCHECK(opened_); | 124 DLOG_IF(ERROR, !opened_) << "Open() has not been called successfully"; |
125 | |
126 if (!opened_) | 125 if (!opened_) |
127 return; | 126 return; |
128 | 127 |
129 if (started_) | 128 if (started_) |
130 return; | 129 return; |
131 | 130 |
132 sink_ = callback; | 131 sink_ = callback; |
133 | 132 |
134 // Create and start the thread that will drive the capturing by waiting for | 133 // Create and start the thread that will drive the capturing by waiting for |
135 // capture events. | 134 // capture events. |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 hr = audio_client_->SetEventHandle(audio_samples_ready_event_.Get()); | 513 hr = audio_client_->SetEventHandle(audio_samples_ready_event_.Get()); |
515 if (FAILED(hr)) | 514 if (FAILED(hr)) |
516 return hr; | 515 return hr; |
517 | 516 |
518 // Get access to the IAudioCaptureClient interface. This interface | 517 // Get access to the IAudioCaptureClient interface. This interface |
519 // enables us to read input data from the capture endpoint buffer. | 518 // enables us to read input data from the capture endpoint buffer. |
520 hr = audio_client_->GetService(__uuidof(IAudioCaptureClient), | 519 hr = audio_client_->GetService(__uuidof(IAudioCaptureClient), |
521 audio_capture_client_.ReceiveVoid()); | 520 audio_capture_client_.ReceiveVoid()); |
522 return hr; | 521 return hr; |
523 } | 522 } |
OLD | NEW |