| 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 | 
|  | 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), | 
|  | 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       payload_type(-1) {} | 
|  | 49 AudioEncoderOpusConfig::AudioEncoderOpusConfig(const AudioEncoderOpusConfig&) = | 
|  | 50     default; | 
|  | 51 AudioEncoderOpusConfig::~AudioEncoderOpusConfig() = default; | 
|  | 52 AudioEncoderOpusConfig& AudioEncoderOpusConfig::operator=( | 
|  | 53     const AudioEncoderOpusConfig&) = default; | 
|  | 54 | 
|  | 55 bool AudioEncoderOpusConfig::IsOk() const { | 
|  | 56   if (frame_size_ms <= 0 || frame_size_ms % 10 != 0) | 
|  | 57     return false; | 
|  | 58   if (num_channels != 1 && num_channels != 2) | 
|  | 59     return false; | 
|  | 60   if (!bitrate_bps) | 
|  | 61     return false; | 
|  | 62   if (*bitrate_bps < kMinBitrateBps || *bitrate_bps > kMaxBitrateBps) | 
|  | 63     return false; | 
|  | 64   if (complexity < 0 || complexity > 10) | 
|  | 65     return false; | 
|  | 66   if (low_rate_complexity < 0 || low_rate_complexity > 10) | 
|  | 67     return false; | 
|  | 68   return true; | 
|  | 69 } | 
|  | 70 }  // namespace webrtc | 
| OLD | NEW | 
|---|