OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
12 #include "base/win/scoped_com_initializer.h" | 12 #include "base/win/scoped_com_initializer.h" |
13 #include "media/audio/audio_io.h" | 13 #include "media/audio/audio_io.h" |
14 #include "media/audio/audio_manager.h" | 14 #include "media/audio/audio_manager_base.h" |
15 #include "media/audio/win/audio_low_latency_input_win.h" | 15 #include "media/audio/win/audio_low_latency_input_win.h" |
16 #include "media/base/seekable_buffer.h" | 16 #include "media/base/seekable_buffer.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using base::win::ScopedCOMInitializer; | 20 using base::win::ScopedCOMInitializer; |
21 using ::testing::AnyNumber; | 21 using ::testing::AnyNumber; |
22 using ::testing::Between; | 22 using ::testing::Between; |
23 using ::testing::Gt; | 23 using ::testing::Gt; |
24 using ::testing::NotNull; | 24 using ::testing::NotNull; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 return ChannelLayoutToChannelCount(channel_layout_); | 135 return ChannelLayoutToChannelCount(channel_layout_); |
136 } | 136 } |
137 int bits_per_sample() const { return bits_per_sample_; } | 137 int bits_per_sample() const { return bits_per_sample_; } |
138 int sample_rate() const { return sample_rate_; } | 138 int sample_rate() const { return sample_rate_; } |
139 int samples_per_packet() const { return samples_per_packet_; } | 139 int samples_per_packet() const { return samples_per_packet_; } |
140 | 140 |
141 private: | 141 private: |
142 AudioInputStream* CreateInputStream() { | 142 AudioInputStream* CreateInputStream() { |
143 AudioInputStream* ais = audio_man_->MakeAudioInputStream( | 143 AudioInputStream* ais = audio_man_->MakeAudioInputStream( |
144 AudioParameters(format_, channel_layout_, sample_rate_, | 144 AudioParameters(format_, channel_layout_, sample_rate_, |
145 bits_per_sample_, samples_per_packet_)); | 145 bits_per_sample_, samples_per_packet_), |
| 146 AudioManagerBase::kDefaultDeviceId); |
146 EXPECT_TRUE(ais); | 147 EXPECT_TRUE(ais); |
147 return ais; | 148 return ais; |
148 } | 149 } |
149 | 150 |
150 ScopedCOMInitializer com_init_; | 151 ScopedCOMInitializer com_init_; |
151 AudioManager* audio_man_; | 152 AudioManager* audio_man_; |
152 AudioParameters::Format format_; | 153 AudioParameters::Format format_; |
153 ChannelLayout channel_layout_; | 154 ChannelLayout channel_layout_; |
154 int bits_per_sample_; | 155 int bits_per_sample_; |
155 int sample_rate_; | 156 int sample_rate_; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 fprintf(stderr, " File name : %s\n", file_name); | 359 fprintf(stderr, " File name : %s\n", file_name); |
359 fprintf(stderr, " Sample rate: %d\n", aisw.sample_rate()); | 360 fprintf(stderr, " Sample rate: %d\n", aisw.sample_rate()); |
360 WriteToFileAudioSink file_sink(file_name); | 361 WriteToFileAudioSink file_sink(file_name); |
361 fprintf(stderr, " >> Speak into the mic while recording...\n"); | 362 fprintf(stderr, " >> Speak into the mic while recording...\n"); |
362 ais->Start(&file_sink); | 363 ais->Start(&file_sink); |
363 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); | 364 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); |
364 ais->Stop(); | 365 ais->Stop(); |
365 fprintf(stderr, " >> Recording has stopped.\n"); | 366 fprintf(stderr, " >> Recording has stopped.\n"); |
366 ais->Close(); | 367 ais->Close(); |
367 } | 368 } |
OLD | NEW |