OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <math.h> | 11 #include <math.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include <memory> | 15 #include <memory> |
16 | 16 |
| 17 #include "webrtc/base/location.h" |
| 18 #include "webrtc/modules/audio_device/audio_device_config.h" |
| 19 #include "webrtc/modules/audio_device/audio_device_impl.h" |
17 #include "webrtc/modules/audio_device/test/audio_device_test_defines.h" | 20 #include "webrtc/modules/audio_device/test/audio_device_test_defines.h" |
18 | 21 #include "webrtc/modules/utility/include/process_thread.h" |
| 22 #include "webrtc/system_wrappers/include/sleep.h" |
19 #include "webrtc/test/gtest.h" | 23 #include "webrtc/test/gtest.h" |
20 #include "webrtc/test/testsupport/fileutils.h" | 24 #include "webrtc/test/testsupport/fileutils.h" |
21 | 25 |
22 #include "webrtc/modules/audio_device/audio_device_config.h" | |
23 #include "webrtc/modules/audio_device/audio_device_impl.h" | |
24 #include "webrtc/modules/utility/include/process_thread.h" | |
25 #include "webrtc/system_wrappers/include/sleep.h" | |
26 | |
27 // Helper functions | 26 // Helper functions |
28 #if defined(ANDROID) | 27 #if defined(ANDROID) |
29 char filenameStr[2][256] = | 28 char filenameStr[2][256] = |
30 { {0}, | 29 { {0}, |
31 {0}, | 30 {0}, |
32 }; // Allow two buffers for those API calls taking two filenames | 31 }; // Allow two buffers for those API calls taking two filenames |
33 int currentStr = 0; | 32 int currentStr = 0; |
34 | 33 |
35 const char* GetFilename(const char* filename) | 34 const char* GetFilename(const char* filename) |
36 { | 35 { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 kId, AudioDeviceModule::kLinuxPulseAudio)) == NULL); | 210 kId, AudioDeviceModule::kLinuxPulseAudio)) == NULL); |
212 // Create default implementation instance | 211 // Create default implementation instance |
213 EXPECT_TRUE((audio_device_ = AudioDeviceModule::Create( | 212 EXPECT_TRUE((audio_device_ = AudioDeviceModule::Create( |
214 kId, AudioDeviceModule::kPlatformDefaultAudio)) != NULL); | 213 kId, AudioDeviceModule::kPlatformDefaultAudio)) != NULL); |
215 #endif | 214 #endif |
216 | 215 |
217 if (audio_device_ == NULL) { | 216 if (audio_device_ == NULL) { |
218 FAIL() << "Failed creating audio device object!"; | 217 FAIL() << "Failed creating audio device object!"; |
219 } | 218 } |
220 | 219 |
221 process_thread_->RegisterModule(audio_device_); | 220 process_thread_->RegisterModule(audio_device_, RTC_FROM_HERE); |
222 | 221 |
223 AudioDeviceModule::AudioLayer audio_layer = | 222 AudioDeviceModule::AudioLayer audio_layer = |
224 AudioDeviceModule::kPlatformDefaultAudio; | 223 AudioDeviceModule::kPlatformDefaultAudio; |
225 EXPECT_EQ(0, audio_device_->ActiveAudioLayer(&audio_layer)); | 224 EXPECT_EQ(0, audio_device_->ActiveAudioLayer(&audio_layer)); |
226 if (audio_layer == AudioDeviceModule::kLinuxAlsaAudio) { | 225 if (audio_layer == AudioDeviceModule::kLinuxAlsaAudio) { |
227 linux_alsa_ = true; | 226 linux_alsa_ = true; |
228 } | 227 } |
229 } | 228 } |
230 | 229 |
231 static void TearDownTestCase() { | 230 static void TearDownTestCase() { |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 EXPECT_EQ(48000, sampleRate); | 1599 EXPECT_EQ(48000, sampleRate); |
1601 #elif defined(ANDROID) | 1600 #elif defined(ANDROID) |
1602 TEST_LOG("Playout sample rate is %u\n\n", sampleRate); | 1601 TEST_LOG("Playout sample rate is %u\n\n", sampleRate); |
1603 EXPECT_TRUE((sampleRate == 44000) || (sampleRate == 16000)); | 1602 EXPECT_TRUE((sampleRate == 44000) || (sampleRate == 16000)); |
1604 #elif defined(WEBRTC_IOS) | 1603 #elif defined(WEBRTC_IOS) |
1605 TEST_LOG("Playout sample rate is %u\n\n", sampleRate); | 1604 TEST_LOG("Playout sample rate is %u\n\n", sampleRate); |
1606 EXPECT_TRUE((sampleRate == 44000) || (sampleRate == 16000) || | 1605 EXPECT_TRUE((sampleRate == 44000) || (sampleRate == 16000) || |
1607 (sampleRate == 8000)); | 1606 (sampleRate == 8000)); |
1608 #endif | 1607 #endif |
1609 } | 1608 } |
OLD | NEW |