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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 sid_frame_interval_ms_(config.sid_frame_interval_ms), | 75 sid_frame_interval_ms_(config.sid_frame_interval_ms), |
76 last_frame_active_(true), | 76 last_frame_active_(true), |
77 vad_(config.vad ? std::unique_ptr<Vad>(config.vad) | 77 vad_(config.vad ? std::unique_ptr<Vad>(config.vad) |
78 : CreateVad(config.vad_mode)) { | 78 : CreateVad(config.vad_mode)) { |
79 cng_inst_ = CreateCngInst(SampleRateHz(), sid_frame_interval_ms_, | 79 cng_inst_ = CreateCngInst(SampleRateHz(), sid_frame_interval_ms_, |
80 num_cng_coefficients_); | 80 num_cng_coefficients_); |
81 } | 81 } |
82 | 82 |
83 AudioEncoderCng::~AudioEncoderCng() = default; | 83 AudioEncoderCng::~AudioEncoderCng() = default; |
84 | 84 |
85 size_t AudioEncoderCng::MaxEncodedBytes() const { | |
86 const size_t max_encoded_bytes_active = speech_encoder_->MaxEncodedBytes(); | |
87 const size_t max_encoded_bytes_passive = | |
88 rtc::CheckedDivExact(kMaxFrameSizeMs, 10) * SamplesPer10msFrame(); | |
89 return std::max(max_encoded_bytes_active, max_encoded_bytes_passive); | |
90 } | |
91 | |
92 int AudioEncoderCng::SampleRateHz() const { | 85 int AudioEncoderCng::SampleRateHz() const { |
93 return speech_encoder_->SampleRateHz(); | 86 return speech_encoder_->SampleRateHz(); |
94 } | 87 } |
95 | 88 |
96 size_t AudioEncoderCng::NumChannels() const { | 89 size_t AudioEncoderCng::NumChannels() const { |
97 return 1; | 90 return 1; |
98 } | 91 } |
99 | 92 |
100 int AudioEncoderCng::RtpTimestampRateHz() const { | 93 int AudioEncoderCng::RtpTimestampRateHz() const { |
101 return speech_encoder_->RtpTimestampRateHz(); | 94 return speech_encoder_->RtpTimestampRateHz(); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 268 } |
276 } | 269 } |
277 return info; | 270 return info; |
278 } | 271 } |
279 | 272 |
280 size_t AudioEncoderCng::SamplesPer10msFrame() const { | 273 size_t AudioEncoderCng::SamplesPer10msFrame() const { |
281 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); | 274 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); |
282 } | 275 } |
283 | 276 |
284 } // namespace webrtc | 277 } // namespace webrtc |
OLD | NEW |