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

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

Issue 2859483005: NetEq: Fix a bug in expand_rate and speech_expand_rate calculation (Closed)
Patch Set: Changing to Minyue's suggestion Created 3 years, 7 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 (*output)[channel].OverwriteAt(temp_data_.data(), output_length, 0); 151 (*output)[channel].OverwriteAt(temp_data_.data(), output_length, 0);
152 } 152 }
153 153
154 // Copy back the first part of the data to |sync_buffer_| and remove it from 154 // Copy back the first part of the data to |sync_buffer_| and remove it from
155 // |output|. 155 // |output|.
156 sync_buffer_->ReplaceAtIndex(*output, old_length, sync_buffer_->next_index()); 156 sync_buffer_->ReplaceAtIndex(*output, old_length, sync_buffer_->next_index());
157 output->PopFront(old_length); 157 output->PopFront(old_length);
158 158
159 // Return new added length. |old_length| samples were borrowed from 159 // Return new added length. |old_length| samples were borrowed from
160 // |sync_buffer_|. 160 // |sync_buffer_|.
161 RTC_DCHECK_GE(output_length, old_length);
161 return output_length - old_length; 162 return output_length - old_length;
162 } 163 }
163 164
164 size_t Merge::GetExpandedSignal(size_t* old_length, size_t* expand_period) { 165 size_t Merge::GetExpandedSignal(size_t* old_length, size_t* expand_period) {
165 // Check how much data that is left since earlier. 166 // Check how much data that is left since earlier.
166 *old_length = sync_buffer_->FutureLength(); 167 *old_length = sync_buffer_->FutureLength();
167 // Should never be less than overlap_length. 168 // Should never be less than overlap_length.
168 assert(*old_length >= expand_->overlap_length()); 169 assert(*old_length >= expand_->overlap_length());
169 // Generate data to merge the overlap with using expand. 170 // Generate data to merge the overlap with using expand.
170 expand_->SetParametersForMergeAfterExpand(); 171 expand_->SetParametersForMergeAfterExpand();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 372 }
372 return best_correlation_index; 373 return best_correlation_index;
373 } 374 }
374 375
375 size_t Merge::RequiredFutureSamples() { 376 size_t Merge::RequiredFutureSamples() {
376 return fs_hz_ / 100 * num_channels_; // 10 ms. 377 return fs_hz_ / 100 * num_channels_; // 10 ms.
377 } 378 }
378 379
379 380
380 } // namespace webrtc 381 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698