| 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <mmsystem.h> | 8 #include <mmsystem.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const AudioBus* src, | 48 const AudioBus* src, |
| 49 uint32_t hardware_delay_bytes, | 49 uint32_t hardware_delay_bytes, |
| 50 double volume)); | 50 double volume)); |
| 51 MOCK_METHOD1(OnError, void(AudioInputStream* stream)); | 51 MOCK_METHOD1(OnError, void(AudioInputStream* stream)); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class FakeAudioInputCallback : public AudioInputStream::AudioInputCallback { | 54 class FakeAudioInputCallback : public AudioInputStream::AudioInputCallback { |
| 55 public: | 55 public: |
| 56 FakeAudioInputCallback() | 56 FakeAudioInputCallback() |
| 57 : num_received_audio_frames_(0), | 57 : num_received_audio_frames_(0), |
| 58 data_event_(false, false), | 58 data_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 59 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 59 error_(false) {} | 60 error_(false) {} |
| 60 | 61 |
| 61 bool error() const { return error_; } | 62 bool error() const { return error_; } |
| 62 int num_received_audio_frames() const { return num_received_audio_frames_; } | 63 int num_received_audio_frames() const { return num_received_audio_frames_; } |
| 63 | 64 |
| 64 // Waits until OnData() is called on another thread. | 65 // Waits until OnData() is called on another thread. |
| 65 void WaitForData() { | 66 void WaitForData() { |
| 66 data_event_.Wait(); | 67 data_event_.Wait(); |
| 67 } | 68 } |
| 68 | 69 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); | 478 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); |
| 478 VLOG(0) << ">> Speak into the default microphone while recording."; | 479 VLOG(0) << ">> Speak into the default microphone while recording."; |
| 479 ais->Start(&file_sink); | 480 ais->Start(&file_sink); |
| 480 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 481 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); |
| 481 ais->Stop(); | 482 ais->Stop(); |
| 482 VLOG(0) << ">> Recording has stopped."; | 483 VLOG(0) << ">> Recording has stopped."; |
| 483 ais.Close(); | 484 ais.Close(); |
| 484 } | 485 } |
| 485 | 486 |
| 486 } // namespace media | 487 } // namespace media |
| OLD | NEW |