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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 probability_average += WebRtcNs_prior_speech_probability(my_handle); | 127 probability_average += WebRtcNs_prior_speech_probability(my_handle); |
128 } | 128 } |
129 return probability_average / num_handles(); | 129 return probability_average / num_handles(); |
130 #elif defined(WEBRTC_NS_FIXED) | 130 #elif defined(WEBRTC_NS_FIXED) |
131 // Currently not available for the fixed point implementation. | 131 // Currently not available for the fixed point implementation. |
132 return apm_->kUnsupportedFunctionError; | 132 return apm_->kUnsupportedFunctionError; |
133 #endif | 133 #endif |
134 } | 134 } |
135 | 135 |
136 void* NoiseSuppressionImpl::CreateHandle() const { | 136 void* NoiseSuppressionImpl::CreateHandle() const { |
137 Handle* handle = NULL; | |
138 #if defined(WEBRTC_NS_FLOAT) | 137 #if defined(WEBRTC_NS_FLOAT) |
139 if (WebRtcNs_Create(&handle) != apm_->kNoError) | 138 return WebRtcNs_Create(); |
140 #elif defined(WEBRTC_NS_FIXED) | 139 #elif defined(WEBRTC_NS_FIXED) |
141 if (WebRtcNsx_Create(&handle) != apm_->kNoError) | 140 return WebRtcNsx_Create(); |
142 #endif | 141 #endif |
143 { | |
144 handle = NULL; | |
145 } else { | |
146 assert(handle != NULL); | |
147 } | |
148 | |
149 return handle; | |
150 } | 142 } |
151 | 143 |
152 void NoiseSuppressionImpl::DestroyHandle(void* handle) const { | 144 void NoiseSuppressionImpl::DestroyHandle(void* handle) const { |
153 #if defined(WEBRTC_NS_FLOAT) | 145 #if defined(WEBRTC_NS_FLOAT) |
154 WebRtcNs_Free(static_cast<Handle*>(handle)); | 146 WebRtcNs_Free(static_cast<Handle*>(handle)); |
155 #elif defined(WEBRTC_NS_FIXED) | 147 #elif defined(WEBRTC_NS_FIXED) |
156 WebRtcNsx_Free(static_cast<Handle*>(handle)); | 148 WebRtcNsx_Free(static_cast<Handle*>(handle)); |
157 #endif | 149 #endif |
158 } | 150 } |
159 | 151 |
(...skipping 20 matching lines...) Expand all Loading... |
180 int NoiseSuppressionImpl::num_handles_required() const { | 172 int NoiseSuppressionImpl::num_handles_required() const { |
181 return apm_->num_output_channels(); | 173 return apm_->num_output_channels(); |
182 } | 174 } |
183 | 175 |
184 int NoiseSuppressionImpl::GetHandleError(void* handle) const { | 176 int NoiseSuppressionImpl::GetHandleError(void* handle) const { |
185 // The NS has no get_error() function. | 177 // The NS has no get_error() function. |
186 assert(handle != NULL); | 178 assert(handle != NULL); |
187 return apm_->kUnspecifiedError; | 179 return apm_->kUnspecifiedError; |
188 } | 180 } |
189 } // namespace webrtc | 181 } // namespace webrtc |
OLD | NEW |