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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 : last_rtp_timestamp_ + | 138 : last_rtp_timestamp_ + |
139 rtc::CheckedDivExact( | 139 rtc::CheckedDivExact( |
140 input_data.input_timestamp - last_timestamp_, | 140 input_data.input_timestamp - last_timestamp_, |
141 static_cast<uint32_t>(rtc::CheckedDivExact( | 141 static_cast<uint32_t>(rtc::CheckedDivExact( |
142 encoder_stack_->SampleRateHz(), | 142 encoder_stack_->SampleRateHz(), |
143 encoder_stack_->RtpTimestampRateHz()))); | 143 encoder_stack_->RtpTimestampRateHz()))); |
144 last_timestamp_ = input_data.input_timestamp; | 144 last_timestamp_ = input_data.input_timestamp; |
145 last_rtp_timestamp_ = rtp_timestamp; | 145 last_rtp_timestamp_ = rtp_timestamp; |
146 first_frame_ = false; | 146 first_frame_ = false; |
147 | 147 |
148 encode_buffer_.SetSize(encoder_stack_->MaxEncodedBytes()); | 148 // Clear the buffer before reuse - encoded data will get appended. |
| 149 encode_buffer_.Clear(); |
149 encoded_info = encoder_stack_->Encode( | 150 encoded_info = encoder_stack_->Encode( |
150 rtp_timestamp, rtc::ArrayView<const int16_t>( | 151 rtp_timestamp, rtc::ArrayView<const int16_t>( |
151 input_data.audio, input_data.audio_channel * | 152 input_data.audio, input_data.audio_channel * |
152 input_data.length_per_channel), | 153 input_data.length_per_channel), |
153 encode_buffer_.size(), encode_buffer_.data()); | 154 &encode_buffer_); |
154 encode_buffer_.SetSize(encoded_info.encoded_bytes); | 155 |
155 bitrate_logger_.MaybeLog(encoder_stack_->GetTargetBitrate() / 1000); | 156 bitrate_logger_.MaybeLog(encoder_stack_->GetTargetBitrate() / 1000); |
156 if (encode_buffer_.size() == 0 && !encoded_info.send_even_if_empty) { | 157 if (encode_buffer_.size() == 0 && !encoded_info.send_even_if_empty) { |
157 // Not enough data. | 158 // Not enough data. |
158 return 0; | 159 return 0; |
159 } | 160 } |
160 previous_pltype = previous_pltype_; // Read it while we have the critsect. | 161 previous_pltype = previous_pltype_; // Read it while we have the critsect. |
161 | 162 |
162 RTPFragmentationHeader my_fragmentation; | 163 RTPFragmentationHeader my_fragmentation; |
163 ConvertEncodedInfoToFragmentationHeader(encoded_info, &my_fragmentation); | 164 ConvertEncodedInfoToFragmentationHeader(encoded_info, &my_fragmentation); |
164 FrameType frame_type; | 165 FrameType frame_type; |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 return receiver_.LeastRequiredDelayMs(); | 817 return receiver_.LeastRequiredDelayMs(); |
817 } | 818 } |
818 | 819 |
819 void AudioCodingModuleImpl::GetDecodingCallStatistics( | 820 void AudioCodingModuleImpl::GetDecodingCallStatistics( |
820 AudioDecodingCallStats* call_stats) const { | 821 AudioDecodingCallStats* call_stats) const { |
821 receiver_.GetDecodingCallStatistics(call_stats); | 822 receiver_.GetDecodingCallStatistics(call_stats); |
822 } | 823 } |
823 | 824 |
824 } // namespace acm2 | 825 } // namespace acm2 |
825 } // namespace webrtc | 826 } // namespace webrtc |
OLD | NEW |