| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 base::MessageLoop message_loop_; | 272 base::MessageLoop message_loop_; |
| 273 ScopedAudioManagerPtr audio_manager_; | 273 ScopedAudioManagerPtr audio_manager_; |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 // Verify that we can retrieve the current hardware/mixing sample rate | 276 // Verify that we can retrieve the current hardware/mixing sample rate |
| 277 // for all available input devices. | 277 // for all available input devices. |
| 278 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamHardwareSampleRate) { | 278 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamHardwareSampleRate) { |
| 279 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndInputDevices(audio_manager_.get())); | 279 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndInputDevices(audio_manager_.get())); |
| 280 | 280 |
| 281 // Retrieve a list of all available input devices. | 281 // Retrieve a list of all available input devices. |
| 282 media::AudioDeviceNames device_names; | 282 media::AudioDeviceDescriptions device_descriptions; |
| 283 audio_manager_->GetAudioInputDeviceNames(&device_names); | 283 audio_manager_->GetAudioInputDeviceDescriptions(&device_descriptions); |
| 284 | 284 |
| 285 // Scan all available input devices and repeat the same test for all of them. | 285 // Scan all available input devices and repeat the same test for all of them. |
| 286 for (media::AudioDeviceNames::const_iterator it = device_names.begin(); | 286 for (const auto& device : device_descriptions) { |
| 287 it != device_names.end(); ++it) { | |
| 288 // Retrieve the hardware sample rate given a specified audio input device. | 287 // Retrieve the hardware sample rate given a specified audio input device. |
| 289 AudioParameters params; | 288 AudioParameters params; |
| 290 ASSERT_TRUE(SUCCEEDED(CoreAudioUtil::GetPreferredAudioParameters( | 289 ASSERT_TRUE(SUCCEEDED(CoreAudioUtil::GetPreferredAudioParameters( |
| 291 it->unique_id, false, ¶ms))); | 290 device.unique_id, false, ¶ms))); |
| 292 EXPECT_GE(params.sample_rate(), 0); | 291 EXPECT_GE(params.sample_rate(), 0); |
| 293 } | 292 } |
| 294 } | 293 } |
| 295 | 294 |
| 296 // Test Create(), Close() calling sequence. | 295 // Test Create(), Close() calling sequence. |
| 297 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamCreateAndClose) { | 296 TEST_F(WinAudioInputTest, WASAPIAudioInputStreamCreateAndClose) { |
| 298 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndInputDevices(audio_manager_.get())); | 297 ABORT_AUDIO_TEST_IF_NOT(HasCoreAudioAndInputDevices(audio_manager_.get())); |
| 299 ScopedAudioInputStream ais( | 298 ScopedAudioInputStream ais( |
| 300 CreateDefaultAudioInputStream(audio_manager_.get())); | 299 CreateDefaultAudioInputStream(audio_manager_.get())); |
| 301 ais.Close(); | 300 ais.Close(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); | 493 WriteToFileAudioSink file_sink(file_name, aisw.bits_per_sample()); |
| 495 VLOG(0) << ">> Speak into the default microphone while recording."; | 494 VLOG(0) << ">> Speak into the default microphone while recording."; |
| 496 ais->Start(&file_sink); | 495 ais->Start(&file_sink); |
| 497 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 496 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); |
| 498 ais->Stop(); | 497 ais->Stop(); |
| 499 VLOG(0) << ">> Recording has stopped."; | 498 VLOG(0) << ">> Recording has stopped."; |
| 500 ais.Close(); | 499 ais.Close(); |
| 501 } | 500 } |
| 502 | 501 |
| 503 } // namespace media | 502 } // namespace media |
| OLD | NEW |