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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 void AudioEncoderOpus::SetTargetBitrate(int bits_per_second) { | 178 void AudioEncoderOpus::SetTargetBitrate(int bits_per_second) { |
179 config_.bitrate_bps = | 179 config_.bitrate_bps = |
180 std::max(std::min(bits_per_second, kMaxBitrateBps), kMinBitrateBps); | 180 std::max(std::min(bits_per_second, kMaxBitrateBps), kMinBitrateBps); |
181 RTC_DCHECK(config_.IsOk()); | 181 RTC_DCHECK(config_.IsOk()); |
182 RTC_CHECK_EQ(0, WebRtcOpus_SetBitRate(inst_, config_.bitrate_bps)); | 182 RTC_CHECK_EQ(0, WebRtcOpus_SetBitRate(inst_, config_.bitrate_bps)); |
183 } | 183 } |
184 | 184 |
185 AudioEncoder::EncodedInfo AudioEncoderOpus::EncodeInternal( | 185 AudioEncoder::EncodedInfo AudioEncoderOpus::EncodeImpl( |
186 uint32_t rtp_timestamp, | 186 uint32_t rtp_timestamp, |
187 rtc::ArrayView<const int16_t> audio, | 187 rtc::ArrayView<const int16_t> audio, |
188 rtc::Buffer* encoded) { | 188 rtc::Buffer* encoded) { |
189 | 189 |
190 if (input_buffer_.empty()) | 190 if (input_buffer_.empty()) |
191 first_timestamp_in_buffer_ = rtp_timestamp; | 191 first_timestamp_in_buffer_ = rtp_timestamp; |
192 | 192 |
193 input_buffer_.insert(input_buffer_.end(), audio.cbegin(), audio.cend()); | 193 input_buffer_.insert(input_buffer_.end(), audio.cbegin(), audio.cend()); |
194 if (input_buffer_.size() < | 194 if (input_buffer_.size() < |
195 (Num10msFramesPerPacket() * SamplesPer10msFrame())) { | 195 (Num10msFramesPerPacket() * SamplesPer10msFrame())) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_)); | 258 RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_)); |
259 } | 259 } |
260 RTC_CHECK_EQ(0, | 260 RTC_CHECK_EQ(0, |
261 WebRtcOpus_SetPacketLossRate( | 261 WebRtcOpus_SetPacketLossRate( |
262 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); | 262 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); |
263 config_ = config; | 263 config_ = config; |
264 return true; | 264 return true; |
265 } | 265 } |
266 | 266 |
267 } // namespace webrtc | 267 } // namespace webrtc |
OLD | NEW |