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 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 default: | 129 default: |
130 RTC_CHECK(false); | 130 RTC_CHECK(false); |
131 return AudioProcessing::kMono; | 131 return AudioProcessing::kMono; |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions) { | 135 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions) { |
136 const std::vector<float> values = ParseList<float>(mic_positions); | 136 const std::vector<float> values = ParseList<float>(mic_positions); |
137 const size_t num_mics = | 137 const size_t num_mics = |
138 rtc::CheckedDivExact(values.size(), static_cast<size_t>(3)); | 138 rtc::CheckedDivExact(values.size(), static_cast<size_t>(3)); |
139 RTC_CHECK_GT(num_mics, 0u) << "mic_positions is not large enough."; | 139 RTC_CHECK_GT(num_mics, 0) << "mic_positions is not large enough."; |
140 | 140 |
141 std::vector<Point> result; | 141 std::vector<Point> result; |
142 result.reserve(num_mics); | 142 result.reserve(num_mics); |
143 for (size_t i = 0; i < values.size(); i += 3) { | 143 for (size_t i = 0; i < values.size(); i += 3) { |
144 result.push_back(Point(values[i + 0], values[i + 1], values[i + 2])); | 144 result.push_back(Point(values[i + 0], values[i + 1], values[i + 2])); |
145 } | 145 } |
146 | 146 |
147 return result; | 147 return result; |
148 } | 148 } |
149 | 149 |
150 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions, | 150 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions, |
151 size_t num_mics) { | 151 size_t num_mics) { |
152 std::vector<Point> result = ParseArrayGeometry(mic_positions); | 152 std::vector<Point> result = ParseArrayGeometry(mic_positions); |
153 RTC_CHECK_EQ(result.size(), num_mics) | 153 RTC_CHECK_EQ(result.size(), num_mics) |
154 << "Could not parse mic_positions or incorrect number of points."; | 154 << "Could not parse mic_positions or incorrect number of points."; |
155 return result; | 155 return result; |
156 } | 156 } |
157 | 157 |
158 } // namespace webrtc | 158 } // namespace webrtc |
OLD | NEW |