OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 | 192 |
193 void AudioEncoderCng::SetProjectedPacketLossRate(double fraction) { | 193 void AudioEncoderCng::SetProjectedPacketLossRate(double fraction) { |
194 speech_encoder_->SetProjectedPacketLossRate(fraction); | 194 speech_encoder_->SetProjectedPacketLossRate(fraction); |
195 } | 195 } |
196 | 196 |
197 void AudioEncoderCng::SetTargetBitrate(int bits_per_second) { | 197 void AudioEncoderCng::SetTargetBitrate(int bits_per_second) { |
198 speech_encoder_->SetTargetBitrate(bits_per_second); | 198 speech_encoder_->SetTargetBitrate(bits_per_second); |
199 } | 199 } |
200 | 200 |
201 void AudioEncoderCng::SetMaxBitrate(int max_bps) { | |
202 speech_encoder_->SetMaxBitrate(max_bps); | |
203 } | |
204 | |
205 void AudioEncoderCng::SetMaxPayloadSize(int max_payload_size_bytes) { | |
206 speech_encoder_->SetMaxPayloadSize(max_payload_size_bytes); | |
207 } | |
208 | |
209 AudioEncoder::EncodedInfo AudioEncoderCng::EncodePassive( | 201 AudioEncoder::EncodedInfo AudioEncoderCng::EncodePassive( |
210 size_t frames_to_encode, | 202 size_t frames_to_encode, |
211 size_t max_encoded_bytes, | 203 size_t max_encoded_bytes, |
212 uint8_t* encoded) { | 204 uint8_t* encoded) { |
213 bool force_sid = last_frame_active_; | 205 bool force_sid = last_frame_active_; |
214 bool output_produced = false; | 206 bool output_produced = false; |
215 const size_t samples_per_10ms_frame = SamplesPer10msFrame(); | 207 const size_t samples_per_10ms_frame = SamplesPer10msFrame(); |
216 CHECK_GE(max_encoded_bytes, frames_to_encode * samples_per_10ms_frame); | 208 CHECK_GE(max_encoded_bytes, frames_to_encode * samples_per_10ms_frame); |
217 AudioEncoder::EncodedInfo info; | 209 AudioEncoder::EncodedInfo info; |
218 for (size_t i = 0; i < frames_to_encode; ++i) { | 210 for (size_t i = 0; i < frames_to_encode; ++i) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 248 } |
257 } | 249 } |
258 return info; | 250 return info; |
259 } | 251 } |
260 | 252 |
261 size_t AudioEncoderCng::SamplesPer10msFrame() const { | 253 size_t AudioEncoderCng::SamplesPer10msFrame() const { |
262 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); | 254 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); |
263 } | 255 } |
264 | 256 |
265 } // namespace webrtc | 257 } // namespace webrtc |
OLD | NEW |