| 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <mmsystem.h> | 6 #include <mmsystem.h> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void(AudioInputStream* stream, | 42 void(AudioInputStream* stream, |
| 43 const AudioBus* src, | 43 const AudioBus* src, |
| 44 uint32 hardware_delay_bytes, | 44 uint32 hardware_delay_bytes, |
| 45 double volume)); | 45 double volume)); |
| 46 MOCK_METHOD1(OnError, void(AudioInputStream* stream)); | 46 MOCK_METHOD1(OnError, void(AudioInputStream* stream)); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class FakeAudioInputCallback : public AudioInputStream::AudioInputCallback { | 49 class FakeAudioInputCallback : public AudioInputStream::AudioInputCallback { |
| 50 public: | 50 public: |
| 51 FakeAudioInputCallback() | 51 FakeAudioInputCallback() |
| 52 : error_(false), | 52 : num_received_audio_frames_(0), |
| 53 data_event_(false, false), | 53 data_event_(false, false), |
| 54 num_received_audio_frames_(0) {} | 54 error_(false) {} |
| 55 | 55 |
| 56 bool error() const { return error_; } | 56 bool error() const { return error_; } |
| 57 int num_received_audio_frames() const { return num_received_audio_frames_; } | 57 int num_received_audio_frames() const { return num_received_audio_frames_; } |
| 58 | 58 |
| 59 // Waits until OnData() is called on another thread. | 59 // Waits until OnData() is called on another thread. |
| 60 void WaitForData() { | 60 void WaitForData() { |
| 61 data_event_.Wait(); | 61 data_event_.Wait(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void OnData(AudioInputStream* stream, | 64 void OnData(AudioInputStream* stream, |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); | 465 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); |
| 466 VLOG(0) << ">> Speak into the default microphone while recording."; | 466 VLOG(0) << ">> Speak into the default microphone while recording."; |
| 467 ais->Start(&file_sink); | 467 ais->Start(&file_sink); |
| 468 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 468 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); |
| 469 ais->Stop(); | 469 ais->Stop(); |
| 470 VLOG(0) << ">> Recording has stopped."; | 470 VLOG(0) << ">> Recording has stopped."; |
| 471 ais.Close(); | 471 ais.Close(); |
| 472 } | 472 } |
| 473 | 473 |
| 474 } // namespace media | 474 } // namespace media |
| OLD | NEW |