OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/audio_manager.h" |
| 6 |
| 7 #include <memory> |
| 8 |
5 #include "base/bind.h" | 9 #include "base/bind.h" |
6 #include "base/environment.h" | 10 #include "base/environment.h" |
7 #include "base/logging.h" | 11 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
10 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
11 #include "base/test/test_message_loop.h" | 14 #include "base/test/test_message_loop.h" |
12 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
13 #include "build/build_config.h" | 16 #include "build/build_config.h" |
14 #include "media/audio/audio_manager.h" | |
15 #include "media/audio/audio_manager_base.h" | 17 #include "media/audio/audio_manager_base.h" |
16 #include "media/audio/audio_output_proxy.h" | 18 #include "media/audio/audio_output_proxy.h" |
17 #include "media/audio/audio_unittest_util.h" | 19 #include "media/audio/audio_unittest_util.h" |
18 #include "media/audio/fake_audio_log_factory.h" | 20 #include "media/audio/fake_audio_log_factory.h" |
19 #include "media/audio/fake_audio_manager.h" | 21 #include "media/audio/fake_audio_manager.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
21 | 23 |
22 #if defined(USE_ALSA) | 24 #if defined(USE_ALSA) |
23 #include "media/audio/alsa/audio_manager_alsa.h" | 25 #include "media/audio/alsa/audio_manager_alsa.h" |
24 #endif // defined(USE_ALSA) | 26 #endif // defined(USE_ALSA) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 amw->SetEnumerationType(AudioManagerWin::kWaveEnumeration); | 135 amw->SetEnumerationType(AudioManagerWin::kWaveEnumeration); |
134 } | 136 } |
135 | 137 |
136 std::string GetDeviceIdFromPCMWaveInAudioInputStream( | 138 std::string GetDeviceIdFromPCMWaveInAudioInputStream( |
137 const std::string& device_id) { | 139 const std::string& device_id) { |
138 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); | 140 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); |
139 AudioParameters parameters( | 141 AudioParameters parameters( |
140 AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, | 142 AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, |
141 AudioParameters::kAudioCDSampleRate, 16, | 143 AudioParameters::kAudioCDSampleRate, 16, |
142 1024); | 144 1024); |
143 scoped_ptr<PCMWaveInAudioInputStream> stream( | 145 std::unique_ptr<PCMWaveInAudioInputStream> stream( |
144 static_cast<PCMWaveInAudioInputStream*>( | 146 static_cast<PCMWaveInAudioInputStream*>( |
145 amw->CreatePCMWaveInAudioInputStream(parameters, device_id))); | 147 amw->CreatePCMWaveInAudioInputStream(parameters, device_id))); |
146 return stream.get() ? stream->device_id_ : std::string(); | 148 return stream.get() ? stream->device_id_ : std::string(); |
147 } | 149 } |
148 #endif | 150 #endif |
149 | 151 |
150 // Helper method which verifies that the device list starts with a valid | 152 // Helper method which verifies that the device list starts with a valid |
151 // default record followed by non-default device names. | 153 // default record followed by non-default device names. |
152 static void CheckDeviceNames(const AudioDeviceNames& device_names) { | 154 static void CheckDeviceNames(const AudioDeviceNames& device_names) { |
153 DVLOG(2) << "Got " << device_names.size() << " audio devices."; | 155 DVLOG(2) << "Got " << device_names.size() << " audio devices."; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 DVLOG(2) << it->unique_id << " matches with " << output_device_id; | 422 DVLOG(2) << it->unique_id << " matches with " << output_device_id; |
421 found_an_associated_device = true; | 423 found_an_associated_device = true; |
422 } | 424 } |
423 } | 425 } |
424 | 426 |
425 EXPECT_TRUE(found_an_associated_device); | 427 EXPECT_TRUE(found_an_associated_device); |
426 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 428 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
427 } | 429 } |
428 | 430 |
429 } // namespace media | 431 } // namespace media |
OLD | NEW |