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 "base/environment.h" | 5 #include "base/environment.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/win/scoped_com_initializer.h" | 7 #include "base/win/scoped_com_initializer.h" |
8 #include "media/audio/audio_manager.h" | 8 #include "media/audio/audio_manager.h" |
9 #include "media/audio/audio_manager_base.h" | 9 #include "media/audio/audio_manager_base.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 void SetWaveEnumeration() { | 42 void SetWaveEnumeration() { |
43 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); | 43 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); |
44 amw->SetEnumerationType(AudioManagerWin::kWaveEnumeration); | 44 amw->SetEnumerationType(AudioManagerWin::kWaveEnumeration); |
45 } | 45 } |
46 | 46 |
47 std::string GetDeviceIdFromPCMWaveInAudioInputStream( | 47 std::string GetDeviceIdFromPCMWaveInAudioInputStream( |
48 const std::string& device_id) { | 48 const std::string& device_id) { |
49 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); | 49 AudioManagerWin* amw = static_cast<AudioManagerWin*>(audio_manager_.get()); |
50 AudioParameters parameters( | 50 AudioParameters parameters( |
51 AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, | 51 AudioParameters::AUDIO_PCM_LINEAR, false, CHANNEL_LAYOUT_STEREO, |
52 AudioParameters::kAudioCDSampleRate, 16, | 52 AudioParameters::kAudioCDSampleRate, 16, 1024); |
53 1024); | |
54 scoped_ptr<PCMWaveInAudioInputStream> stream( | 53 scoped_ptr<PCMWaveInAudioInputStream> stream( |
55 static_cast<PCMWaveInAudioInputStream*>( | 54 static_cast<PCMWaveInAudioInputStream*>( |
56 amw->CreatePCMWaveInAudioInputStream(parameters, device_id))); | 55 amw->CreatePCMWaveInAudioInputStream(parameters, device_id))); |
57 return stream.get() ? stream->device_id_ : std::string(); | 56 return stream.get() ? stream->device_id_ : std::string(); |
58 } | 57 } |
59 #endif | 58 #endif |
60 | 59 |
61 // Helper method which verifies that the device list starts with a valid | 60 // Helper method which verifies that the device list starts with a valid |
62 // default record followed by non-default device names. | 61 // default record followed by non-default device names. |
63 static void CheckDeviceNames(const AudioDeviceNames& device_names) { | 62 static void CheckDeviceNames(const AudioDeviceNames& device_names) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 EXPECT_EQ(i->unique_id, converted_id); | 163 EXPECT_EQ(i->unique_id, converted_id); |
165 } else { | 164 } else { |
166 // MMDevice-style device IDs should be converted to WaveIn-style device | 165 // MMDevice-style device IDs should be converted to WaveIn-style device |
167 // IDs. | 166 // IDs. |
168 EXPECT_NE(i->unique_id, converted_id); | 167 EXPECT_NE(i->unique_id, converted_id); |
169 } | 168 } |
170 } | 169 } |
171 } | 170 } |
172 | 171 |
173 #endif | 172 #endif |
OLD | NEW |