| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 output->AssertSize(number_of_samples); | 72 output->AssertSize(number_of_samples); |
| 73 // Get the decoder from the database. | 73 // Get the decoder from the database. |
| 74 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); | 74 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); |
| 75 if (!cng_decoder) { | 75 if (!cng_decoder) { |
| 76 LOG(LS_ERROR) << "Unknwown payload type"; | 76 LOG(LS_ERROR) << "Unknwown payload type"; |
| 77 return kUnknownPayloadType; | 77 return kUnknownPayloadType; |
| 78 } | 78 } |
| 79 CNG_dec_inst* cng_inst = cng_decoder->CngDecoderInstance(); | 79 CNG_dec_inst* cng_inst = cng_decoder->CngDecoderInstance(); |
| 80 // The expression &(*output)[0][0] is a pointer to the first element in | 80 // The expression &(*output)[0][0] is a pointer to the first element in |
| 81 // the first channel. | 81 // the first channel. |
| 82 if (WebRtcCng_Generate(cng_inst, &(*output)[0][0], | 82 if (WebRtcCng_Generate(cng_inst, &(*output)[0][0], number_of_samples, |
| 83 static_cast<int16_t>(number_of_samples), | |
| 84 new_period) < 0) { | 83 new_period) < 0) { |
| 85 // Error returned. | 84 // Error returned. |
| 86 output->Zeros(requested_length); | 85 output->Zeros(requested_length); |
| 87 internal_error_code_ = WebRtcCng_GetErrorCodeDec(cng_inst); | 86 internal_error_code_ = WebRtcCng_GetErrorCodeDec(cng_inst); |
| 88 LOG(LS_ERROR) << "WebRtcCng_Generate produced " << internal_error_code_; | 87 LOG(LS_ERROR) << "WebRtcCng_Generate produced " << internal_error_code_; |
| 89 return kInternalError; | 88 return kInternalError; |
| 90 } | 89 } |
| 91 | 90 |
| 92 if (first_call_) { | 91 if (first_call_) { |
| 93 // Set tapering window parameters. Values are in Q15. | 92 // Set tapering window parameters. Values are in Q15. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 130 } |
| 132 // Remove |overlap_length_| samples from the front of |output| since they | 131 // Remove |overlap_length_| samples from the front of |output| since they |
| 133 // were mixed into |sync_buffer_| above. | 132 // were mixed into |sync_buffer_| above. |
| 134 output->PopFront(overlap_length_); | 133 output->PopFront(overlap_length_); |
| 135 } | 134 } |
| 136 first_call_ = false; | 135 first_call_ = false; |
| 137 return kOK; | 136 return kOK; |
| 138 } | 137 } |
| 139 | 138 |
| 140 } // namespace webrtc | 139 } // namespace webrtc |
| OLD | NEW |