| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 AudioParameters::Format format() const { return default_params_.format(); } | 186 AudioParameters::Format format() const { return default_params_.format(); } |
| 187 int channels() const { | 187 int channels() const { |
| 188 return ChannelLayoutToChannelCount(default_params_.channel_layout()); | 188 return ChannelLayoutToChannelCount(default_params_.channel_layout()); |
| 189 } | 189 } |
| 190 int bits_per_sample() const { return default_params_.bits_per_sample(); } | 190 int bits_per_sample() const { return default_params_.bits_per_sample(); } |
| 191 int sample_rate() const { return default_params_.sample_rate(); } | 191 int sample_rate() const { return default_params_.sample_rate(); } |
| 192 int frames_per_buffer() const { return frames_per_buffer_; } | 192 int frames_per_buffer() const { return frames_per_buffer_; } |
| 193 | 193 |
| 194 private: | 194 private: |
| 195 AudioInputStream* CreateInputStream() { | 195 AudioInputStream* CreateInputStream() { |
| 196 AudioParameters params = default_params_; |
| 197 params.set_frames_per_buffer(frames_per_buffer_); |
| 196 AudioInputStream* ais = audio_man_->MakeAudioInputStream( | 198 AudioInputStream* ais = audio_man_->MakeAudioInputStream( |
| 197 AudioParameters(format(), default_params_.channel_layout(), | 199 params, AudioManagerBase::kDefaultDeviceId); |
| 198 sample_rate(), bits_per_sample(), frames_per_buffer_, | |
| 199 default_params_.effects()), | |
| 200 AudioManagerBase::kDefaultDeviceId); | |
| 201 EXPECT_TRUE(ais); | 200 EXPECT_TRUE(ais); |
| 202 return ais; | 201 return ais; |
| 203 } | 202 } |
| 204 | 203 |
| 205 AudioManager* audio_man_; | 204 AudioManager* audio_man_; |
| 206 AudioParameters default_params_; | 205 AudioParameters default_params_; |
| 207 int frames_per_buffer_; | 206 int frames_per_buffer_; |
| 208 }; | 207 }; |
| 209 | 208 |
| 210 // Convenience method which creates a default AudioInputStream object. | 209 // Convenience method which creates a default AudioInputStream object. |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); | 462 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); |
| 464 VLOG(0) << ">> Speak into the default microphone while recording."; | 463 VLOG(0) << ">> Speak into the default microphone while recording."; |
| 465 ais->Start(&file_sink); | 464 ais->Start(&file_sink); |
| 466 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 465 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); |
| 467 ais->Stop(); | 466 ais->Stop(); |
| 468 VLOG(0) << ">> Recording has stopped."; | 467 VLOG(0) << ">> Recording has stopped."; |
| 469 ais.Close(); | 468 ais.Close(); |
| 470 } | 469 } |
| 471 | 470 |
| 472 } // namespace media | 471 } // namespace media |
| OLD | NEW |