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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 }); | 208 }); |
209 input_buffer_.clear(); | 209 input_buffer_.clear(); |
210 | 210 |
211 info.encoded_timestamp = first_timestamp_in_buffer_; | 211 info.encoded_timestamp = first_timestamp_in_buffer_; |
212 info.payload_type = config_.payload_type; | 212 info.payload_type = config_.payload_type; |
213 info.send_even_if_empty = true; // Allows Opus to send empty packets. | 213 info.send_even_if_empty = true; // Allows Opus to send empty packets. |
214 info.speech = (info.encoded_bytes > 0); | 214 info.speech = (info.encoded_bytes > 0); |
215 return info; | 215 return info; |
216 } | 216 } |
217 | 217 |
| 218 const char* AudioEncoderOpus::GetCodecName() const { |
| 219 return "Opus"; |
| 220 } |
| 221 |
218 size_t AudioEncoderOpus::Num10msFramesPerPacket() const { | 222 size_t AudioEncoderOpus::Num10msFramesPerPacket() const { |
219 return static_cast<size_t>(rtc::CheckedDivExact(config_.frame_size_ms, 10)); | 223 return static_cast<size_t>(rtc::CheckedDivExact(config_.frame_size_ms, 10)); |
220 } | 224 } |
221 | 225 |
222 size_t AudioEncoderOpus::SamplesPer10msFrame() const { | 226 size_t AudioEncoderOpus::SamplesPer10msFrame() const { |
223 return rtc::CheckedDivExact(kSampleRateHz, 100) * config_.num_channels; | 227 return rtc::CheckedDivExact(kSampleRateHz, 100) * config_.num_channels; |
224 } | 228 } |
225 | 229 |
226 size_t AudioEncoderOpus::SufficientOutputBufferSize() const { | 230 size_t AudioEncoderOpus::SufficientOutputBufferSize() const { |
227 // Calculate the number of bytes we expect the encoder to produce, | 231 // Calculate the number of bytes we expect the encoder to produce, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_)); | 264 RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_)); |
261 } | 265 } |
262 RTC_CHECK_EQ(0, | 266 RTC_CHECK_EQ(0, |
263 WebRtcOpus_SetPacketLossRate( | 267 WebRtcOpus_SetPacketLossRate( |
264 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); | 268 inst_, static_cast<int32_t>(packet_loss_rate_ * 100 + .5))); |
265 config_ = config; | 269 config_ = config; |
266 return true; | 270 return true; |
267 } | 271 } |
268 | 272 |
269 } // namespace webrtc | 273 } // namespace webrtc |
OLD | NEW |