| 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 *num_channels = static_cast<int>(sync_buffer_->Channels()); | 833 *num_channels = static_cast<int>(sync_buffer_->Channels()); |
| 834 LOG(LS_VERBOSE) << "Sync buffer (" << *num_channels << " channel(s)):" << | 834 LOG(LS_VERBOSE) << "Sync buffer (" << *num_channels << " channel(s)):" << |
| 835 " insert " << algorithm_buffer_->Size() << " samples, extract " << | 835 " insert " << algorithm_buffer_->Size() << " samples, extract " << |
| 836 samples_from_sync << " samples"; | 836 samples_from_sync << " samples"; |
| 837 if (sync_buffer_->FutureLength() < expand_->overlap_length()) { | 837 if (sync_buffer_->FutureLength() < expand_->overlap_length()) { |
| 838 // The sync buffer should always contain |overlap_length| samples, but now | 838 // The sync buffer should always contain |overlap_length| samples, but now |
| 839 // too many samples have been extracted. Reinstall the |overlap_length| | 839 // too many samples have been extracted. Reinstall the |overlap_length| |
| 840 // lookahead by moving the index. | 840 // lookahead by moving the index. |
| 841 const size_t missing_lookahead_samples = | 841 const size_t missing_lookahead_samples = |
| 842 expand_->overlap_length() - sync_buffer_->FutureLength(); | 842 expand_->overlap_length() - sync_buffer_->FutureLength(); |
| 843 DCHECK_GE(sync_buffer_->next_index(), missing_lookahead_samples); | 843 RTC_DCHECK_GE(sync_buffer_->next_index(), missing_lookahead_samples); |
| 844 sync_buffer_->set_next_index(sync_buffer_->next_index() - | 844 sync_buffer_->set_next_index(sync_buffer_->next_index() - |
| 845 missing_lookahead_samples); | 845 missing_lookahead_samples); |
| 846 } | 846 } |
| 847 if (samples_from_sync != output_size_samples_) { | 847 if (samples_from_sync != output_size_samples_) { |
| 848 LOG(LS_ERROR) << "samples_from_sync (" << samples_from_sync | 848 LOG(LS_ERROR) << "samples_from_sync (" << samples_from_sync |
| 849 << ") != output_size_samples_ (" << output_size_samples_ | 849 << ") != output_size_samples_ (" << output_size_samples_ |
| 850 << ")"; | 850 << ")"; |
| 851 // TODO(minyue): treatment of under-run, filling zeros | 851 // TODO(minyue): treatment of under-run, filling zeros |
| 852 memset(output, 0, num_output_samples * sizeof(int16_t)); | 852 memset(output, 0, num_output_samples * sizeof(int16_t)); |
| 853 *samples_per_channel = output_size_samples_; | 853 *samples_per_channel = output_size_samples_; |
| 854 return kSampleUnderrun; | 854 return kSampleUnderrun; |
| 855 } | 855 } |
| 856 *samples_per_channel = output_size_samples_; | 856 *samples_per_channel = output_size_samples_; |
| 857 | 857 |
| 858 // Should always have overlap samples left in the |sync_buffer_|. | 858 // Should always have overlap samples left in the |sync_buffer_|. |
| 859 DCHECK_GE(sync_buffer_->FutureLength(), expand_->overlap_length()); | 859 RTC_DCHECK_GE(sync_buffer_->FutureLength(), expand_->overlap_length()); |
| 860 | 860 |
| 861 if (play_dtmf) { | 861 if (play_dtmf) { |
| 862 return_value = DtmfOverdub(dtmf_event, sync_buffer_->Channels(), output); | 862 return_value = DtmfOverdub(dtmf_event, sync_buffer_->Channels(), output); |
| 863 } | 863 } |
| 864 | 864 |
| 865 // Update the background noise parameters if last operation wrote data | 865 // Update the background noise parameters if last operation wrote data |
| 866 // straight from the decoder to the |sync_buffer_|. That is, none of the | 866 // straight from the decoder to the |sync_buffer_|. That is, none of the |
| 867 // operations that modify the signal can be followed by a parameter update. | 867 // operations that modify the signal can be followed by a parameter update. |
| 868 if ((last_mode_ == kModeNormal) || | 868 if ((last_mode_ == kModeNormal) || |
| 869 (last_mode_ == kModeAccelerateFail) || | 869 (last_mode_ == kModeAccelerateFail) || |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 | 1993 |
| 1994 void NetEqImpl::CreateDecisionLogic() { | 1994 void NetEqImpl::CreateDecisionLogic() { |
| 1995 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, | 1995 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, |
| 1996 playout_mode_, | 1996 playout_mode_, |
| 1997 decoder_database_.get(), | 1997 decoder_database_.get(), |
| 1998 *packet_buffer_.get(), | 1998 *packet_buffer_.get(), |
| 1999 delay_manager_.get(), | 1999 delay_manager_.get(), |
| 2000 buffer_level_filter_.get())); | 2000 buffer_level_filter_.get())); |
| 2001 } | 2001 } |
| 2002 } // namespace webrtc | 2002 } // namespace webrtc |
| OLD | NEW |