Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: webrtc/modules/audio_coding/neteq/comfort_noise.cc

Issue 1228843002: Update audio code to use size_t more correctly, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 output->AssertSize(number_of_samples); 69 output->AssertSize(number_of_samples);
70 // Get the decoder from the database. 70 // Get the decoder from the database.
71 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); 71 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder();
72 if (!cng_decoder) { 72 if (!cng_decoder) {
73 return kUnknownPayloadType; 73 return kUnknownPayloadType;
74 } 74 }
75 CNG_dec_inst* cng_inst = cng_decoder->CngDecoderInstance(); 75 CNG_dec_inst* cng_inst = cng_decoder->CngDecoderInstance();
76 // The expression &(*output)[0][0] is a pointer to the first element in 76 // The expression &(*output)[0][0] is a pointer to the first element in
77 // the first channel. 77 // the first channel.
78 if (WebRtcCng_Generate(cng_inst, &(*output)[0][0], 78 if (WebRtcCng_Generate(cng_inst, &(*output)[0][0], number_of_samples,
79 static_cast<int16_t>(number_of_samples),
80 new_period) < 0) { 79 new_period) < 0) {
81 // Error returned. 80 // Error returned.
82 output->Zeros(requested_length); 81 output->Zeros(requested_length);
83 internal_error_code_ = WebRtcCng_GetErrorCodeDec(cng_inst); 82 internal_error_code_ = WebRtcCng_GetErrorCodeDec(cng_inst);
84 return kInternalError; 83 return kInternalError;
85 } 84 }
86 85
87 if (first_call_) { 86 if (first_call_) {
88 // Set tapering window parameters. Values are in Q15. 87 // Set tapering window parameters. Values are in Q15.
89 int16_t muting_window; // Mixing factor for overlap data. 88 int16_t muting_window; // Mixing factor for overlap data.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 125 }
127 // Remove |overlap_length_| samples from the front of |output| since they 126 // Remove |overlap_length_| samples from the front of |output| since they
128 // were mixed into |sync_buffer_| above. 127 // were mixed into |sync_buffer_| above.
129 output->PopFront(overlap_length_); 128 output->PopFront(overlap_length_);
130 } 129 }
131 first_call_ = false; 130 first_call_ = false;
132 return kOK; 131 return kOK;
133 } 132 }
134 133
135 } // namespace webrtc 134 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698