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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |