| 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 size_t buffer_frame_index = 0; | 358 size_t buffer_frame_index = 0; |
| 359 size_t capture_buffer_size = std::max( | 359 size_t capture_buffer_size = std::max( |
| 360 2 * endpoint_buffer_size_frames_ * frame_size_, | 360 2 * endpoint_buffer_size_frames_ * frame_size_, |
| 361 2 * packet_size_frames_ * frame_size_); | 361 2 * packet_size_frames_ * frame_size_); |
| 362 scoped_ptr<uint8[]> capture_buffer(new uint8[capture_buffer_size]); | 362 scoped_ptr<uint8[]> capture_buffer(new uint8[capture_buffer_size]); |
| 363 | 363 |
| 364 LARGE_INTEGER now_count; | 364 LARGE_INTEGER now_count; |
| 365 bool recording = true; | 365 bool recording = true; |
| 366 bool error = false; | 366 bool error = false; |
| 367 double volume = GetVolume(); | 367 double volume = GetVolume(); |
| 368 HANDLE wait_array[2] = {stop_capture_event_, audio_samples_ready_event_}; | 368 HANDLE wait_array[2] = |
| 369 { stop_capture_event_.Get(), audio_samples_ready_event_.Get() }; |
| 369 | 370 |
| 370 while (recording && !error) { | 371 while (recording && !error) { |
| 371 HRESULT hr = S_FALSE; | 372 HRESULT hr = S_FALSE; |
| 372 | 373 |
| 373 // Wait for a close-down event or a new capture event. | 374 // Wait for a close-down event or a new capture event. |
| 374 DWORD wait_result = WaitForMultipleObjects(2, wait_array, FALSE, INFINITE); | 375 DWORD wait_result = WaitForMultipleObjects(2, wait_array, FALSE, INFINITE); |
| 375 switch (wait_result) { | 376 switch (wait_result) { |
| 376 case WAIT_FAILED: | 377 case WAIT_FAILED: |
| 377 error = true; | 378 error = true; |
| 378 break; | 379 break; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 return hr; | 742 return hr; |
| 742 | 743 |
| 743 // Obtain a reference to the ISimpleAudioVolume interface which enables | 744 // Obtain a reference to the ISimpleAudioVolume interface which enables |
| 744 // us to control the master volume level of an audio session. | 745 // us to control the master volume level of an audio session. |
| 745 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume), | 746 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume), |
| 746 simple_audio_volume_.ReceiveVoid()); | 747 simple_audio_volume_.ReceiveVoid()); |
| 747 return hr; | 748 return hr; |
| 748 } | 749 } |
| 749 | 750 |
| 750 } // namespace media | 751 } // namespace media |
| OLD | NEW |