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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 int16_t ret = WebRtcG722_Decode(dec_state_left_, encoded_deinterleaved, | 249 int16_t ret = WebRtcG722_Decode(dec_state_left_, encoded_deinterleaved, |
250 static_cast<int16_t>(encoded_len / 2), | 250 static_cast<int16_t>(encoded_len / 2), |
251 decoded, &temp_type); | 251 decoded, &temp_type); |
252 if (ret >= 0) { | 252 if (ret >= 0) { |
253 int decoded_len = ret; | 253 int decoded_len = ret; |
254 ret = WebRtcG722_Decode(dec_state_right_, | 254 ret = WebRtcG722_Decode(dec_state_right_, |
255 &encoded_deinterleaved[encoded_len / 2], | 255 &encoded_deinterleaved[encoded_len / 2], |
256 static_cast<int16_t>(encoded_len / 2), | 256 static_cast<int16_t>(encoded_len / 2), |
257 &decoded[decoded_len], &temp_type); | 257 &decoded[decoded_len], &temp_type); |
258 if (ret == decoded_len) { | 258 if (ret == decoded_len) { |
259 decoded_len += ret; | 259 ret += decoded_len; // Return total number of samples. |
260 // Interleave output. | 260 // Interleave output. |
261 for (int k = decoded_len / 2; k < decoded_len; k++) { | 261 for (int k = ret / 2; k < ret; k++) { |
262 int16_t temp = decoded[k]; | 262 int16_t temp = decoded[k]; |
263 memmove(&decoded[2 * k - decoded_len + 2], | 263 memmove(&decoded[2 * k - ret + 2], &decoded[2 * k - ret + 1], |
264 &decoded[2 * k - decoded_len + 1], | 264 (ret - k - 1) * sizeof(int16_t)); |
265 (decoded_len - k - 1) * sizeof(int16_t)); | 265 decoded[2 * k - ret + 1] = temp; |
266 decoded[2 * k - decoded_len + 1] = temp; | |
267 } | 266 } |
268 ret = decoded_len; // Return total number of samples. | |
269 } | 267 } |
270 } | 268 } |
271 *speech_type = ConvertSpeechType(temp_type); | 269 *speech_type = ConvertSpeechType(temp_type); |
272 delete [] encoded_deinterleaved; | 270 delete [] encoded_deinterleaved; |
273 return ret; | 271 return ret; |
274 } | 272 } |
275 | 273 |
276 size_t AudioDecoderG722Stereo::Channels() const { | 274 size_t AudioDecoderG722Stereo::Channels() const { |
277 return 2; | 275 return 2; |
278 } | 276 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 case kDecoderRED: | 610 case kDecoderRED: |
613 case kDecoderAVT: | 611 case kDecoderAVT: |
614 case kDecoderArbitrary: | 612 case kDecoderArbitrary: |
615 default: { | 613 default: { |
616 return NULL; | 614 return NULL; |
617 } | 615 } |
618 } | 616 } |
619 } | 617 } |
620 | 618 |
621 } // namespace webrtc | 619 } // namespace webrtc |
OLD | NEW |