Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc

Issue 1418423010: Pass audio to AudioEncoder::Encode() in an ArrayView (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 input_data.input_timestamp - last_timestamp_, 142 input_data.input_timestamp - last_timestamp_,
143 static_cast<uint32_t>(rtc::CheckedDivExact( 143 static_cast<uint32_t>(rtc::CheckedDivExact(
144 audio_encoder->SampleRateHz(), 144 audio_encoder->SampleRateHz(),
145 audio_encoder->RtpTimestampRateHz()))); 145 audio_encoder->RtpTimestampRateHz())));
146 last_timestamp_ = input_data.input_timestamp; 146 last_timestamp_ = input_data.input_timestamp;
147 last_rtp_timestamp_ = rtp_timestamp; 147 last_rtp_timestamp_ = rtp_timestamp;
148 first_frame_ = false; 148 first_frame_ = false;
149 149
150 encode_buffer_.SetSize(audio_encoder->MaxEncodedBytes()); 150 encode_buffer_.SetSize(audio_encoder->MaxEncodedBytes());
151 encoded_info = audio_encoder->Encode( 151 encoded_info = audio_encoder->Encode(
152 rtp_timestamp, input_data.audio, input_data.length_per_channel, 152 rtp_timestamp, rtc::ArrayView<const int16_t>(
153 input_data.audio, input_data.audio_channel *
154 input_data.length_per_channel),
153 encode_buffer_.size(), encode_buffer_.data()); 155 encode_buffer_.size(), encode_buffer_.data());
154 encode_buffer_.SetSize(encoded_info.encoded_bytes); 156 encode_buffer_.SetSize(encoded_info.encoded_bytes);
155 bitrate_logger_.MaybeLog(audio_encoder->GetTargetBitrate() / 1000); 157 bitrate_logger_.MaybeLog(audio_encoder->GetTargetBitrate() / 1000);
156 if (encode_buffer_.size() == 0 && !encoded_info.send_even_if_empty) { 158 if (encode_buffer_.size() == 0 && !encoded_info.send_even_if_empty) {
157 // Not enough data. 159 // Not enough data.
158 return 0; 160 return 0;
159 } 161 }
160 previous_pltype = previous_pltype_; // Read it while we have the critsect. 162 previous_pltype = previous_pltype_; // Read it while we have the critsect.
161 163
162 RTPFragmentationHeader my_fragmentation; 164 RTPFragmentationHeader my_fragmentation;
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 return receiver_.LeastRequiredDelayMs(); 783 return receiver_.LeastRequiredDelayMs();
782 } 784 }
783 785
784 void AudioCodingModuleImpl::GetDecodingCallStatistics( 786 void AudioCodingModuleImpl::GetDecodingCallStatistics(
785 AudioDecodingCallStats* call_stats) const { 787 AudioDecodingCallStats* call_stats) const {
786 receiver_.GetDecodingCallStatistics(call_stats); 788 receiver_.GetDecodingCallStatistics(call_stats);
787 } 789 }
788 790
789 } // namespace acm2 791 } // namespace acm2
790 } // namespace webrtc 792 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698