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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 return false; | 47 return false; |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 AudioEncoderCng::AudioEncoderCng(const Config& config) | 51 AudioEncoderCng::AudioEncoderCng(const Config& config) |
52 : speech_encoder_(config.speech_encoder), | 52 : speech_encoder_(config.speech_encoder), |
53 cng_payload_type_(config.payload_type), | 53 cng_payload_type_(config.payload_type), |
54 num_cng_coefficients_(config.num_cng_coefficients), | 54 num_cng_coefficients_(config.num_cng_coefficients), |
55 sid_frame_interval_ms_(config.sid_frame_interval_ms), | 55 sid_frame_interval_ms_(config.sid_frame_interval_ms), |
56 last_frame_active_(true), | 56 last_frame_active_(true), |
57 vad_(config.vad ? config.vad : new Vad(config.vad_mode)) { | 57 vad_(config.vad ? rtc_make_scoped_ptr(config.vad) |
| 58 : CreateVad(config.vad_mode)) { |
58 CHECK(config.IsOk()) << "Invalid configuration."; | 59 CHECK(config.IsOk()) << "Invalid configuration."; |
59 cng_inst_ = CreateCngInst(SampleRateHz(), sid_frame_interval_ms_, | 60 cng_inst_ = CreateCngInst(SampleRateHz(), sid_frame_interval_ms_, |
60 num_cng_coefficients_); | 61 num_cng_coefficients_); |
61 } | 62 } |
62 | 63 |
63 AudioEncoderCng::~AudioEncoderCng() = default; | 64 AudioEncoderCng::~AudioEncoderCng() = default; |
64 | 65 |
65 size_t AudioEncoderCng::MaxEncodedBytes() const { | 66 size_t AudioEncoderCng::MaxEncodedBytes() const { |
66 const size_t max_encoded_bytes_active = speech_encoder_->MaxEncodedBytes(); | 67 const size_t max_encoded_bytes_active = speech_encoder_->MaxEncodedBytes(); |
67 const size_t max_encoded_bytes_passive = | 68 const size_t max_encoded_bytes_passive = |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 257 } |
257 } | 258 } |
258 return info; | 259 return info; |
259 } | 260 } |
260 | 261 |
261 size_t AudioEncoderCng::SamplesPer10msFrame() const { | 262 size_t AudioEncoderCng::SamplesPer10msFrame() const { |
262 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); | 263 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); |
263 } | 264 } |
264 | 265 |
265 } // namespace webrtc | 266 } // namespace webrtc |
OLD | NEW |