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 19 matching lines...) Expand all Loading... |
30 std::unique_ptr<CNG_enc_inst, CngInstDeleter> cng_inst(ci); | 30 std::unique_ptr<CNG_enc_inst, CngInstDeleter> cng_inst(ci); |
31 RTC_CHECK_EQ(0, | 31 RTC_CHECK_EQ(0, |
32 WebRtcCng_InitEnc(cng_inst.get(), sample_rate_hz, | 32 WebRtcCng_InitEnc(cng_inst.get(), sample_rate_hz, |
33 sid_frame_interval_ms, num_cng_coefficients)); | 33 sid_frame_interval_ms, num_cng_coefficients)); |
34 return cng_inst; | 34 return cng_inst; |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 AudioEncoderCng::Config::Config() = default; | 39 AudioEncoderCng::Config::Config() = default; |
40 | 40 AudioEncoderCng::Config::Config(Config&&) = default; |
41 // TODO(kwiberg): =default this when Visual Studio learns to handle it. | |
42 AudioEncoderCng::Config::Config(Config&& c) | |
43 : num_channels(c.num_channels), | |
44 payload_type(c.payload_type), | |
45 speech_encoder(std::move(c.speech_encoder)), | |
46 vad_mode(c.vad_mode), | |
47 sid_frame_interval_ms(c.sid_frame_interval_ms), | |
48 num_cng_coefficients(c.num_cng_coefficients), | |
49 vad(c.vad) {} | |
50 | |
51 AudioEncoderCng::Config::~Config() = default; | 41 AudioEncoderCng::Config::~Config() = default; |
52 | 42 |
53 bool AudioEncoderCng::Config::IsOk() const { | 43 bool AudioEncoderCng::Config::IsOk() const { |
54 if (num_channels != 1) | 44 if (num_channels != 1) |
55 return false; | 45 return false; |
56 if (!speech_encoder) | 46 if (!speech_encoder) |
57 return false; | 47 return false; |
58 if (num_channels != speech_encoder->NumChannels()) | 48 if (num_channels != speech_encoder->NumChannels()) |
59 return false; | 49 return false; |
60 if (sid_frame_interval_ms < | 50 if (sid_frame_interval_ms < |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 265 } |
276 } | 266 } |
277 return info; | 267 return info; |
278 } | 268 } |
279 | 269 |
280 size_t AudioEncoderCng::SamplesPer10msFrame() const { | 270 size_t AudioEncoderCng::SamplesPer10msFrame() const { |
281 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); | 271 return rtc::CheckedDivExact(10 * SampleRateHz(), 1000); |
282 } | 272 } |
283 | 273 |
284 } // namespace webrtc | 274 } // namespace webrtc |
OLD | NEW |