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 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // AVAudioSession object. | 79 // AVAudioSession object. |
80 AVAudioSession* session = [AVAudioSession sharedInstance]; | 80 AVAudioSession* session = [AVAudioSession sharedInstance]; |
81 // Always get values when the audio session is active. | 81 // Always get values when the audio session is active. |
82 ActivateAudioSession(session, true); | 82 ActivateAudioSession(session, true); |
83 CHECK(session.isInputAvailable) << "No input path is available!"; | 83 CHECK(session.isInputAvailable) << "No input path is available!"; |
84 // Get current hardware parameters. | 84 // Get current hardware parameters. |
85 double sample_rate = (double)session.sampleRate; | 85 double sample_rate = (double)session.sampleRate; |
86 double io_buffer_duration = (double)session.IOBufferDuration; | 86 double io_buffer_duration = (double)session.IOBufferDuration; |
87 int output_channels = (int)session.outputNumberOfChannels; | 87 int output_channels = (int)session.outputNumberOfChannels; |
88 int input_channels = (int)session.inputNumberOfChannels; | 88 int input_channels = (int)session.inputNumberOfChannels; |
89 int frames_per_buffer = | 89 size_t frames_per_buffer = |
90 static_cast<int>(sample_rate * io_buffer_duration + 0.5); | 90 static_cast<size_t>(sample_rate * io_buffer_duration + 0.5); |
91 // Copy hardware parameters to output parameters. | 91 // Copy hardware parameters to output parameters. |
92 playout_parameters->reset(sample_rate, output_channels, frames_per_buffer); | 92 playout_parameters->reset(sample_rate, output_channels, frames_per_buffer); |
93 record_parameters->reset(sample_rate, input_channels, frames_per_buffer); | 93 record_parameters->reset(sample_rate, input_channels, frames_per_buffer); |
94 // Add logging for debugging purposes. | 94 // Add logging for debugging purposes. |
95 LOG(LS_INFO) << " sample rate: " << sample_rate; | 95 LOG(LS_INFO) << " sample rate: " << sample_rate; |
96 LOG(LS_INFO) << " IO buffer duration: " << io_buffer_duration; | 96 LOG(LS_INFO) << " IO buffer duration: " << io_buffer_duration; |
97 LOG(LS_INFO) << " frames_per_buffer: " << frames_per_buffer; | 97 LOG(LS_INFO) << " frames_per_buffer: " << frames_per_buffer; |
98 LOG(LS_INFO) << " output channels: " << output_channels; | 98 LOG(LS_INFO) << " output channels: " << output_channels; |
99 LOG(LS_INFO) << " input channels: " << input_channels; | 99 LOG(LS_INFO) << " input channels: " << input_channels; |
100 LOG(LS_INFO) << " output latency: " << (double)session.outputLatency; | 100 LOG(LS_INFO) << " output latency: " << (double)session.outputLatency; |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 // Device Buffer? | 1045 // Device Buffer? |
1046 timespec t; | 1046 timespec t; |
1047 t.tv_sec = 0; | 1047 t.tv_sec = 0; |
1048 t.tv_nsec = 5 * 1000 * 1000; | 1048 t.tv_nsec = 5 * 1000 * 1000; |
1049 nanosleep(&t, nullptr); | 1049 nanosleep(&t, nullptr); |
1050 } | 1050 } |
1051 return true; | 1051 return true; |
1052 } | 1052 } |
1053 | 1053 |
1054 } // namespace webrtc | 1054 } // namespace webrtc |
OLD | NEW |