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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 RTC_DCHECK_LT(i, output->Size()); | 145 RTC_DCHECK_LT(i, output->Size()); |
146 (*output)[channel_ix][i] = | 146 (*output)[channel_ix][i] = |
147 static_cast<int16_t>((fraction * (*output)[channel_ix][i] + | 147 static_cast<int16_t>((fraction * (*output)[channel_ix][i] + |
148 (32 - fraction) * expanded[channel_ix][i] + 8) >> 5); | 148 (32 - fraction) * expanded[channel_ix][i] + 8) >> 5); |
149 fraction += increment; | 149 fraction += increment; |
150 } | 150 } |
151 } | 151 } |
152 } else if (last_mode == kModeRfc3389Cng) { | 152 } else if (last_mode == kModeRfc3389Cng) { |
153 RTC_DCHECK_EQ(output->Channels(), 1); // Not adapted for multi-channel yet. | 153 RTC_DCHECK_EQ(output->Channels(), 1); // Not adapted for multi-channel yet. |
154 static const size_t kCngLength = 48; | 154 static const size_t kCngLength = 48; |
155 RTC_DCHECK_LE(static_cast<size_t>(8 * fs_mult), kCngLength); | 155 RTC_DCHECK_LE(8 * fs_mult, kCngLength); |
156 int16_t cng_output[kCngLength]; | 156 int16_t cng_output[kCngLength]; |
157 // Reset mute factor and start up fresh. | 157 // Reset mute factor and start up fresh. |
158 external_mute_factor_array[0] = 16384; | 158 external_mute_factor_array[0] = 16384; |
159 ComfortNoiseDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); | 159 ComfortNoiseDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); |
160 | 160 |
161 if (cng_decoder) { | 161 if (cng_decoder) { |
162 // Generate long enough for 48kHz. | 162 // Generate long enough for 48kHz. |
163 if (!cng_decoder->Generate(cng_output, 0)) { | 163 if (!cng_decoder->Generate(cng_output, 0)) { |
164 // Error returned; set return vector to all zeros. | 164 // Error returned; set return vector to all zeros. |
165 memset(cng_output, 0, sizeof(cng_output)); | 165 memset(cng_output, 0, sizeof(cng_output)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 external_mute_factor_array[channel_ix] = static_cast<int16_t>(std::min( | 202 external_mute_factor_array[channel_ix] = static_cast<int16_t>(std::min( |
203 16384, external_mute_factor_array[channel_ix] + increment)); | 203 16384, external_mute_factor_array[channel_ix] + increment)); |
204 } | 204 } |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 return static_cast<int>(length); | 208 return static_cast<int>(length); |
209 } | 209 } |
210 | 210 |
211 } // namespace webrtc | 211 } // namespace webrtc |
OLD | NEW |