Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include "webrtc/api/audio_codecs/opus/audio_encoder_opus_config.h" | |
| 12 | |
| 13 namespace webrtc { | |
| 14 | |
| 15 namespace { | |
| 16 | |
| 17 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM) | |
| 18 // If we are on Android, iOS and/or ARM, use a lower complexity setting by | |
|
ossu
2017/06/16 09:53:53
Is this comment copied from somewhere? Otherwise,
kwiberg-webrtc
2017/06/16 12:44:14
Yes, it's a copy. :-) And yes, it's a tautology---
| |
| 19 // default, to save encoder complexity. | |
| 20 constexpr int kDefaultComplexity = 5; | |
| 21 #else | |
| 22 constexpr int kDefaultComplexity = 9; | |
| 23 #endif | |
| 24 | |
| 25 constexpr int kDefaultLowRateComplexity = | |
| 26 WEBRTC_OPUS_VARIABLE_COMPLEXITY ? 9 : kDefaultComplexity; | |
| 27 | |
| 28 } // namespace | |
| 29 | |
| 30 constexpr int AudioEncoderOpusConfig::kDefaultFrameSizeMs; | |
| 31 constexpr int AudioEncoderOpusConfig::kMinBitrateBps; | |
| 32 constexpr int AudioEncoderOpusConfig::kMaxBitrateBps; | |
| 33 | |
| 34 AudioEncoderOpusConfig::AudioEncoderOpusConfig() | |
| 35 : frame_size_ms(kDefaultFrameSizeMs), | |
|
ossu
2017/06/16 09:53:53
Would it be preferable to have these directly in t
the sun
2017/06/16 12:44:10
+1
kwiberg-webrtc
2017/06/16 12:44:14
The defaults used to be in the header, but I moved
ossu
2017/06/16 13:18:27
Alright. I guess if you're going to modify the par
| |
| 36 num_channels(1), | |
| 37 application(ApplicationMode::kVoip), | |
| 38 bitrate_bps(32000), | |
| 39 fec_enabled(false), | |
| 40 cbr_enabled(false), | |
| 41 max_playback_rate_hz(48000), | |
| 42 complexity(kDefaultComplexity), | |
| 43 low_rate_complexity(kDefaultLowRateComplexity), | |
| 44 complexity_threshold_bps(12500), | |
| 45 complexity_threshold_window_bps(1500), | |
| 46 dtx_enabled(false), | |
| 47 uplink_bandwidth_update_interval_ms(200) {} | |
| 48 AudioEncoderOpusConfig::AudioEncoderOpusConfig(const AudioEncoderOpusConfig&) = | |
| 49 default; | |
| 50 AudioEncoderOpusConfig::~AudioEncoderOpusConfig() = default; | |
| 51 AudioEncoderOpusConfig& AudioEncoderOpusConfig::operator=( | |
| 52 const AudioEncoderOpusConfig&) = default; | |
| 53 | |
| 54 bool AudioEncoderOpusConfig::IsOk() const { | |
| 55 if (frame_size_ms <= 0 || frame_size_ms % 10 != 0) | |
|
ossu
2017/06/16 09:53:53
Is this strictly true, though? Eh, nvm: is this ho
kwiberg-webrtc
2017/06/16 12:44:14
Supporting < 10 ms frames would be difficult, yes.
ossu
2017/06/16 13:18:27
Agreed.
| |
| 56 return false; | |
| 57 if (num_channels != 1 && num_channels != 2) | |
| 58 return false; | |
| 59 if (bitrate_bps < kMinBitrateBps || bitrate_bps > kMaxBitrateBps) | |
| 60 return false; | |
| 61 if (complexity < 0 || complexity > 10) | |
| 62 return false; | |
| 63 if (low_rate_complexity < 0 || low_rate_complexity > 10) | |
| 64 return false; | |
| 65 return true; | |
| 66 } | |
| 67 } // namespace webrtc | |
| OLD | NEW |