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 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 } | 1593 } |
1594 } | 1594 } |
1595 | 1595 |
1596 void NetEqImpl::DoMerge(int16_t* decoded_buffer, size_t decoded_length, | 1596 void NetEqImpl::DoMerge(int16_t* decoded_buffer, size_t decoded_length, |
1597 AudioDecoder::SpeechType speech_type, bool play_dtmf) { | 1597 AudioDecoder::SpeechType speech_type, bool play_dtmf) { |
1598 assert(mute_factor_array_.get()); | 1598 assert(mute_factor_array_.get()); |
1599 assert(merge_.get()); | 1599 assert(merge_.get()); |
1600 size_t new_length = merge_->Process(decoded_buffer, decoded_length, | 1600 size_t new_length = merge_->Process(decoded_buffer, decoded_length, |
1601 mute_factor_array_.get(), | 1601 mute_factor_array_.get(), |
1602 algorithm_buffer_.get()); | 1602 algorithm_buffer_.get()); |
1603 size_t expand_length_correction = new_length - | 1603 // Correction can be negative. |
1604 decoded_length / algorithm_buffer_->Channels(); | 1604 int expand_length_correction = |
| 1605 rtc::dchecked_cast<int>(new_length) - |
| 1606 rtc::dchecked_cast<int>(decoded_length / algorithm_buffer_->Channels()); |
1605 | 1607 |
1606 // Update in-call and post-call statistics. | 1608 // Update in-call and post-call statistics. |
1607 if (expand_->MuteFactor(0) == 0) { | 1609 if (expand_->MuteFactor(0) == 0) { |
1608 // Expand generates only noise. | 1610 // Expand generates only noise. |
1609 stats_.ExpandedNoiseSamples(expand_length_correction); | 1611 stats_.ExpandedNoiseSamplesCorrection(expand_length_correction); |
1610 } else { | 1612 } else { |
1611 // Expansion generates more than only noise. | 1613 // Expansion generates more than only noise. |
1612 stats_.ExpandedVoiceSamples(expand_length_correction); | 1614 stats_.ExpandedVoiceSamplesCorrection(expand_length_correction); |
1613 } | 1615 } |
1614 | 1616 |
1615 last_mode_ = kModeMerge; | 1617 last_mode_ = kModeMerge; |
1616 // If last packet was decoded as an inband CNG, set mode to CNG instead. | 1618 // If last packet was decoded as an inband CNG, set mode to CNG instead. |
1617 if (speech_type == AudioDecoder::kComfortNoise) { | 1619 if (speech_type == AudioDecoder::kComfortNoise) { |
1618 last_mode_ = kModeCodecInternalCng; | 1620 last_mode_ = kModeCodecInternalCng; |
1619 } | 1621 } |
1620 expand_->Reset(); | 1622 expand_->Reset(); |
1621 if (!play_dtmf) { | 1623 if (!play_dtmf) { |
1622 dtmf_tone_generator_->Reset(); | 1624 dtmf_tone_generator_->Reset(); |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 } | 2172 } |
2171 } | 2173 } |
2172 | 2174 |
2173 void NetEqImpl::CreateDecisionLogic() { | 2175 void NetEqImpl::CreateDecisionLogic() { |
2174 decision_logic_.reset(DecisionLogic::Create( | 2176 decision_logic_.reset(DecisionLogic::Create( |
2175 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2177 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
2176 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2178 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
2177 tick_timer_.get())); | 2179 tick_timer_.get())); |
2178 } | 2180 } |
2179 } // namespace webrtc | 2181 } // namespace webrtc |
OLD | NEW |