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 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1638 decoder_error_code_ = comfort_noise_->internal_error_code(); | 1638 decoder_error_code_ = comfort_noise_->internal_error_code(); |
1639 return kComfortNoiseErrorCode; | 1639 return kComfortNoiseErrorCode; |
1640 } else if (cn_return == ComfortNoise::kUnknownPayloadType) { | 1640 } else if (cn_return == ComfortNoise::kUnknownPayloadType) { |
1641 return kUnknownRtpPayloadType; | 1641 return kUnknownRtpPayloadType; |
1642 } | 1642 } |
1643 return 0; | 1643 return 0; |
1644 } | 1644 } |
1645 | 1645 |
1646 void NetEqImpl::DoCodecInternalCng() { | 1646 void NetEqImpl::DoCodecInternalCng() { |
1647 int length = 0; | 1647 int length = 0; |
1648 // TODO(hlundin): Will probably need a longer buffer for multi-channel. | |
1649 int16_t decoded_buffer[kMaxFrameSize]; | |
1650 AudioDecoder* decoder = decoder_database_->GetActiveDecoder(); | 1648 AudioDecoder* decoder = decoder_database_->GetActiveDecoder(); |
1651 if (decoder) { | 1649 if (decoder) { |
1652 const uint8_t* dummy_payload = NULL; | 1650 const uint8_t* dummy_payload = NULL; |
1653 AudioDecoder::SpeechType speech_type; | 1651 AudioDecoder::SpeechType speech_type; |
1654 length = decoder->Decode( | 1652 length = decoder->Decode( |
1655 dummy_payload, 0, fs_hz_, kMaxFrameSize * sizeof(int16_t), | 1653 dummy_payload, 0, fs_hz_, decoded_buffer_length_ * sizeof(int16_t), |
1656 decoded_buffer, &speech_type); | 1654 decoded_buffer_.get(), &speech_type); |
1657 } | 1655 } |
1658 assert(mute_factor_array_.get()); | 1656 assert(mute_factor_array_.get()); |
1659 normal_->Process(decoded_buffer, length, last_mode_, mute_factor_array_.get(), | 1657 if (length > 0) { |
hlundin-webrtc
2015/09/15 13:05:09
I think you'll have to handle the error differentl
minyue-webrtc
2015/09/16 08:05:31
May I suggest yet another solution? When normal de
| |
1660 algorithm_buffer_.get()); | 1658 normal_->Process(decoded_buffer_.get(), length, last_mode_, |
1661 last_mode_ = kModeCodecInternalCng; | 1659 mute_factor_array_.get(), algorithm_buffer_.get()); |
1662 expand_->Reset(); | 1660 last_mode_ = kModeCodecInternalCng; |
1661 expand_->Reset(); | |
1662 } else { | |
1663 LOG(LS_WARNING) << "Codec internal Cng decode error."; | |
1664 } | |
1663 } | 1665 } |
1664 | 1666 |
1665 int NetEqImpl::DoDtmf(const DtmfEvent& dtmf_event, bool* play_dtmf) { | 1667 int NetEqImpl::DoDtmf(const DtmfEvent& dtmf_event, bool* play_dtmf) { |
1666 // This block of the code and the block further down, handling |dtmf_switch| | 1668 // This block of the code and the block further down, handling |dtmf_switch| |
1667 // are commented out. Otherwise playing out-of-band DTMF would fail in VoE | 1669 // are commented out. Otherwise playing out-of-band DTMF would fail in VoE |
1668 // test, DtmfTest.ManualSuccessfullySendsOutOfBandTelephoneEvents. This is | 1670 // test, DtmfTest.ManualSuccessfullySendsOutOfBandTelephoneEvents. This is |
1669 // equivalent to |dtmf_switch| always be false. | 1671 // equivalent to |dtmf_switch| always be false. |
1670 // | 1672 // |
1671 // See http://webrtc-codereview.appspot.com/1195004/ for discussion | 1673 // See http://webrtc-codereview.appspot.com/1195004/ for discussion |
1672 // On this issue. This change might cause some glitches at the point of | 1674 // On this issue. This change might cause some glitches at the point of |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1993 | 1995 |
1994 void NetEqImpl::CreateDecisionLogic() { | 1996 void NetEqImpl::CreateDecisionLogic() { |
1995 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, | 1997 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, |
1996 playout_mode_, | 1998 playout_mode_, |
1997 decoder_database_.get(), | 1999 decoder_database_.get(), |
1998 *packet_buffer_.get(), | 2000 *packet_buffer_.get(), |
1999 delay_manager_.get(), | 2001 delay_manager_.get(), |
2000 buffer_level_filter_.get())); | 2002 buffer_level_filter_.get())); |
2001 } | 2003 } |
2002 } // namespace webrtc | 2004 } // namespace webrtc |
OLD | NEW |