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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual void OnData(AudioInputStream* stream, | 64 virtual void OnData(AudioInputStream* stream, |
65 const AudioBus* src, | 65 const AudioBus* src, |
66 uint32 hardware_delay_bytes, | 66 uint32 hardware_delay_bytes, |
67 double volume) OVERRIDE { | 67 double volume) override { |
68 EXPECT_NE(hardware_delay_bytes, 0u); | 68 EXPECT_NE(hardware_delay_bytes, 0u); |
69 num_received_audio_frames_ += src->frames(); | 69 num_received_audio_frames_ += src->frames(); |
70 data_event_.Signal(); | 70 data_event_.Signal(); |
71 } | 71 } |
72 | 72 |
73 virtual void OnError(AudioInputStream* stream) OVERRIDE { | 73 virtual void OnError(AudioInputStream* stream) override { |
74 error_ = true; | 74 error_ = true; |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 int num_received_audio_frames_; | 78 int num_received_audio_frames_; |
79 base::WaitableEvent data_event_; | 79 base::WaitableEvent data_event_; |
80 bool error_; | 80 bool error_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputCallback); | 82 DISALLOW_COPY_AND_ASSIGN(FakeAudioInputCallback); |
83 }; | 83 }; |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); | 486 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); |
487 VLOG(0) << ">> Speak into the default microphone while recording."; | 487 VLOG(0) << ">> Speak into the default microphone while recording."; |
488 ais->Start(&file_sink); | 488 ais->Start(&file_sink); |
489 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 489 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); |
490 ais->Stop(); | 490 ais->Stop(); |
491 VLOG(0) << ">> Recording has stopped."; | 491 VLOG(0) << ">> Recording has stopped."; |
492 ais.Close(); | 492 ais.Close(); |
493 } | 493 } |
494 | 494 |
495 } // namespace media | 495 } // namespace media |
OLD | NEW |