| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "webrtc/base/format_macros.h" |
| 12 #include "webrtc/base/scoped_ptr.h" | 13 #include "webrtc/base/scoped_ptr.h" |
| 13 #include "webrtc/modules/audio_device/android/build_info.h" | 14 #include "webrtc/modules/audio_device/android/build_info.h" |
| 14 #include "webrtc/modules/audio_device/android/audio_manager.h" | 15 #include "webrtc/modules/audio_device/android/audio_manager.h" |
| 15 #include "webrtc/modules/audio_device/android/ensure_initialized.h" | 16 #include "webrtc/modules/audio_device/android/ensure_initialized.h" |
| 16 | 17 |
| 17 #define PRINT(...) fprintf(stderr, __VA_ARGS__); | 18 #define PRINT(...) fprintf(stderr, __VA_ARGS__); |
| 18 | 19 |
| 19 namespace webrtc { | 20 namespace webrtc { |
| 20 | 21 |
| 21 static const char kTag[] = " "; | 22 static const char kTag[] = " "; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 PRINT("%sLow latency output support: %s\n", kTag, | 65 PRINT("%sLow latency output support: %s\n", kTag, |
| 65 audio_manager()->IsLowLatencyPlayoutSupported() ? "Yes" : "No"); | 66 audio_manager()->IsLowLatencyPlayoutSupported() ? "Yes" : "No"); |
| 66 } | 67 } |
| 67 | 68 |
| 68 TEST_F(AudioManagerTest, ShowAudioParameterInfo) { | 69 TEST_F(AudioManagerTest, ShowAudioParameterInfo) { |
| 69 const bool low_latency_out = audio_manager()->IsLowLatencyPlayoutSupported(); | 70 const bool low_latency_out = audio_manager()->IsLowLatencyPlayoutSupported(); |
| 70 PRINT("PLAYOUT:\n"); | 71 PRINT("PLAYOUT:\n"); |
| 71 PRINT("%saudio layer: %s\n", kTag, | 72 PRINT("%saudio layer: %s\n", kTag, |
| 72 low_latency_out ? "Low latency OpenSL" : "Java/JNI based AudioTrack"); | 73 low_latency_out ? "Low latency OpenSL" : "Java/JNI based AudioTrack"); |
| 73 PRINT("%ssample rate: %d Hz\n", kTag, playout_parameters_.sample_rate()); | 74 PRINT("%ssample rate: %d Hz\n", kTag, playout_parameters_.sample_rate()); |
| 74 PRINT("%schannels: %d\n", kTag, playout_parameters_.channels()); | 75 PRINT("%schannels: %" PRIuS "\n", kTag, playout_parameters_.channels()); |
| 75 PRINT("%sframes per buffer: %d <=> %.2f ms\n", kTag, | 76 PRINT("%sframes per buffer: %d <=> %.2f ms\n", kTag, |
| 76 playout_parameters_.frames_per_buffer(), | 77 playout_parameters_.frames_per_buffer(), |
| 77 playout_parameters_.GetBufferSizeInMilliseconds()); | 78 playout_parameters_.GetBufferSizeInMilliseconds()); |
| 78 PRINT("RECORD: \n"); | 79 PRINT("RECORD: \n"); |
| 79 PRINT("%saudio layer: %s\n", kTag, "Java/JNI based AudioRecord"); | 80 PRINT("%saudio layer: %s\n", kTag, "Java/JNI based AudioRecord"); |
| 80 PRINT("%ssample rate: %d Hz\n", kTag, record_parameters_.sample_rate()); | 81 PRINT("%ssample rate: %d Hz\n", kTag, record_parameters_.sample_rate()); |
| 81 PRINT("%schannels: %d\n", kTag, record_parameters_.channels()); | 82 PRINT("%schannels: %d\n", kTag, record_parameters_.channels()); |
| 82 PRINT("%sframes per buffer: %d <=> %.2f ms\n", kTag, | 83 PRINT("%sframes per buffer: %d <=> %.2f ms\n", kTag, |
| 83 record_parameters_.frames_per_buffer(), | 84 record_parameters_.frames_per_buffer(), |
| 84 record_parameters_.GetBufferSizeInMilliseconds()); | 85 record_parameters_.GetBufferSizeInMilliseconds()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 params.frames_per_10ms_buffer()); | 135 params.frames_per_10ms_buffer()); |
| 135 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); | 136 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); |
| 136 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); | 137 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); |
| 137 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, | 138 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, |
| 138 params.GetBytesPer10msBuffer()); | 139 params.GetBytesPer10msBuffer()); |
| 139 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); | 140 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); |
| 140 } | 141 } |
| 141 | 142 |
| 142 } // namespace webrtc | 143 } // namespace webrtc |
| 143 | 144 |
| OLD | NEW |