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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 (32 - fraction) * expanded[channel_ix][i] + 8) >> 5); | 142 (32 - fraction) * expanded[channel_ix][i] + 8) >> 5); |
143 fraction += increment; | 143 fraction += increment; |
144 } | 144 } |
145 } | 145 } |
146 } else if (last_mode == kModeRfc3389Cng) { | 146 } else if (last_mode == kModeRfc3389Cng) { |
147 assert(output->Channels() == 1); // Not adapted for multi-channel yet. | 147 assert(output->Channels() == 1); // Not adapted for multi-channel yet. |
148 static const size_t kCngLength = 32; | 148 static const size_t kCngLength = 32; |
149 int16_t cng_output[kCngLength]; | 149 int16_t cng_output[kCngLength]; |
150 // Reset mute factor and start up fresh. | 150 // Reset mute factor and start up fresh. |
151 external_mute_factor_array[0] = 16384; | 151 external_mute_factor_array[0] = 16384; |
152 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); | 152 CNG_dec_inst* cng_decoder = decoder_database_->GetActiveCngDecoder(); |
153 | 153 |
154 if (cng_decoder) { | 154 if (cng_decoder) { |
155 // Generate long enough for 32kHz. | 155 // Generate long enough for 32kHz. |
156 if (WebRtcCng_Generate(cng_decoder->CngDecoderInstance(), cng_output, | 156 if (WebRtcCng_Generate(cng_decoder, cng_output, |
157 kCngLength, 0) < 0) { | 157 kCngLength, 0) < 0) { |
158 // Error returned; set return vector to all zeros. | 158 // Error returned; set return vector to all zeros. |
159 memset(cng_output, 0, sizeof(cng_output)); | 159 memset(cng_output, 0, sizeof(cng_output)); |
160 } | 160 } |
161 } else { | 161 } else { |
162 // If no CNG instance is defined, just copy from the decoded data. | 162 // If no CNG instance is defined, just copy from the decoded data. |
163 // (This will result in interpolating the decoded with itself.) | 163 // (This will result in interpolating the decoded with itself.) |
164 memcpy(cng_output, signal, fs_mult * 8 * sizeof(int16_t)); | 164 memcpy(cng_output, signal, fs_mult * 8 * sizeof(int16_t)); |
165 } | 165 } |
166 // Interpolate the CNG into the new vector. | 166 // Interpolate the CNG into the new vector. |
(...skipping 29 matching lines...) Expand all Loading... |
196 external_mute_factor_array[channel_ix] = static_cast<int16_t>(std::min( | 196 external_mute_factor_array[channel_ix] = static_cast<int16_t>(std::min( |
197 16384, external_mute_factor_array[channel_ix] + increment)); | 197 16384, external_mute_factor_array[channel_ix] + increment)); |
198 } | 198 } |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 return static_cast<int>(length); | 202 return static_cast<int>(length); |
203 } | 203 } |
204 | 204 |
205 } // namespace webrtc | 205 } // namespace webrtc |
OLD | NEW |