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 <cmath> | 5 #include <cmath> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/win/scoped_com_initializer.h" | 8 #include "base/win/scoped_com_initializer.h" |
9 #include "media/audio/audio_io.h" | 9 #include "media/audio/audio_io.h" |
10 #include "media/audio/audio_manager_base.h" | 10 #include "media/audio/audio_manager_base.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 samples_per_packet = (sample_rate / 100); | 57 samples_per_packet = (sample_rate / 100); |
58 #elif defined(OS_WIN) | 58 #elif defined(OS_WIN) |
59 if (sample_rate == 44100) | 59 if (sample_rate == 44100) |
60 samples_per_packet = 448; | 60 samples_per_packet = 448; |
61 else | 61 else |
62 samples_per_packet = (sample_rate / 100); | 62 samples_per_packet = (sample_rate / 100); |
63 #else | 63 #else |
64 #error Unsupported platform | 64 #error Unsupported platform |
65 #endif | 65 #endif |
66 AudioInputStream* ais = audio_manager_->MakeAudioInputStream( | 66 AudioInputStream* ais = audio_manager_->MakeAudioInputStream( |
67 AudioParameters(format, channel_layout, sample_rate, bits_per_sample, | 67 AudioParameters(format, false, |
| 68 channel_layout, sample_rate, bits_per_sample, |
68 samples_per_packet), | 69 samples_per_packet), |
69 device_id); | 70 device_id); |
70 EXPECT_TRUE(NULL != ais); | 71 EXPECT_TRUE(NULL != ais); |
71 | 72 |
72 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 73 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
73 // Some linux devices do not support our settings, we may fail to open | 74 // Some linux devices do not support our settings, we may fail to open |
74 // those devices. | 75 // those devices. |
75 if (!ais->Open()) { | 76 if (!ais->Open()) { |
76 // Default device should always be able to be opened. | 77 // Default device should always be able to be opened. |
77 EXPECT_TRUE(AudioManagerBase::kDefaultDeviceId != device_id); | 78 EXPECT_TRUE(AudioManagerBase::kDefaultDeviceId != device_id); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 EXPECT_NEAR(current_volume, new_volume, 0.25 * max_volume); | 151 EXPECT_NEAR(current_volume, new_volume, 0.25 * max_volume); |
151 | 152 |
152 // Restores the volume to the original value. | 153 // Restores the volume to the original value. |
153 ais->SetVolume(original_volume); | 154 ais->SetVolume(original_volume); |
154 current_volume = ais->GetVolume(); | 155 current_volume = ais->GetVolume(); |
155 EXPECT_EQ(original_volume, current_volume); | 156 EXPECT_EQ(original_volume, current_volume); |
156 | 157 |
157 ais->Close(); | 158 ais->Close(); |
158 } | 159 } |
159 } | 160 } |
OLD | NEW |