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 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 const size_t required_samples = 240 * fs_mult_; // Must have 30 ms. | 1513 const size_t required_samples = 240 * fs_mult_; // Must have 30 ms. |
1514 size_t num_channels = algorithm_buffer_->Channels(); | 1514 size_t num_channels = algorithm_buffer_->Channels(); |
1515 int borrowed_samples_per_channel = 0; | 1515 int borrowed_samples_per_channel = 0; |
1516 int old_borrowed_samples_per_channel = 0; | 1516 int old_borrowed_samples_per_channel = 0; |
1517 size_t decoded_length_per_channel = decoded_length / num_channels; | 1517 size_t decoded_length_per_channel = decoded_length / num_channels; |
1518 if (decoded_length_per_channel < required_samples) { | 1518 if (decoded_length_per_channel < required_samples) { |
1519 // Must move data from the |sync_buffer_| in order to get 30 ms. | 1519 // Must move data from the |sync_buffer_| in order to get 30 ms. |
1520 borrowed_samples_per_channel = static_cast<int>(required_samples - | 1520 borrowed_samples_per_channel = static_cast<int>(required_samples - |
1521 decoded_length_per_channel); | 1521 decoded_length_per_channel); |
1522 // Calculate how many of these were already played out. | 1522 // Calculate how many of these were already played out. |
1523 old_borrowed_samples_per_channel = static_cast<int>( | 1523 const int future_length = static_cast<int>(sync_buffer_->FutureLength()); |
1524 borrowed_samples_per_channel - sync_buffer_->FutureLength()); | 1524 old_borrowed_samples_per_channel = |
1525 old_borrowed_samples_per_channel = std::max( | 1525 (borrowed_samples_per_channel > future_length) ? |
1526 0, old_borrowed_samples_per_channel); | 1526 (borrowed_samples_per_channel - future_length) : 0; |
1527 memmove(&decoded_buffer[borrowed_samples_per_channel * num_channels], | 1527 memmove(&decoded_buffer[borrowed_samples_per_channel * num_channels], |
1528 decoded_buffer, | 1528 decoded_buffer, |
1529 sizeof(int16_t) * decoded_length); | 1529 sizeof(int16_t) * decoded_length); |
1530 sync_buffer_->ReadInterleavedFromEnd(borrowed_samples_per_channel, | 1530 sync_buffer_->ReadInterleavedFromEnd(borrowed_samples_per_channel, |
1531 decoded_buffer); | 1531 decoded_buffer); |
1532 decoded_length = required_samples * num_channels; | 1532 decoded_length = required_samples * num_channels; |
1533 } | 1533 } |
1534 | 1534 |
1535 int16_t samples_added; | 1535 int16_t samples_added; |
1536 PreemptiveExpand::ReturnCodes return_code = preemptive_expand_->Process( | 1536 PreemptiveExpand::ReturnCodes return_code = preemptive_expand_->Process( |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 | 1985 |
1986 void NetEqImpl::CreateDecisionLogic() { | 1986 void NetEqImpl::CreateDecisionLogic() { |
1987 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, | 1987 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, |
1988 playout_mode_, | 1988 playout_mode_, |
1989 decoder_database_.get(), | 1989 decoder_database_.get(), |
1990 *packet_buffer_.get(), | 1990 *packet_buffer_.get(), |
1991 delay_manager_.get(), | 1991 delay_manager_.get(), |
1992 buffer_level_filter_.get())); | 1992 buffer_level_filter_.get())); |
1993 } | 1993 } |
1994 } // namespace webrtc | 1994 } // namespace webrtc |
OLD | NEW |