
This reverts commit 5341aaccdb64e3336abf5875e8828222446adffa. Reason for revert: Order of initialization of global static strings. Original change's description: > Reland of https://webrtc-review.googlesource.com/c/src/+/114883 > > The difference to the original is new bitexactness strings AND > global static file string constants. The reason for reland is breaking > downstream projects. > > Original CL description: > > Tests for multi-stream Opus. > > This CL (mainly) adds bit-exactness tests for multi-stream Opus. The > tests are in audio_coding_unittest.cc. Some refactoring of > AcmSendTestOldApi, AcmSenderBitExactnessOldApi is done to make it > possible. A few checks for "channels \in {1, 2}" are replaced with > "channels \in {1, 2, 4, 6, 8}" in the WebRTC Opus codec wrapper. A few > other changes are made to be able to write and read multi-channel WAV > files. > > The SDP changes are NOT included; as of this CL there is no way to set > up a multi-stream opus en/de-coder from SDP strings. > > Bug: webrtc:8649 > Change-Id: I9fd47c790c241c1876c4a731b0840bec30b4f1b2 > Reviewed-on: https://webrtc-review.googlesource.com/c/123387 > Reviewed-by: Oskar Sundbom <ossu@webrtc.org> > Commit-Queue: Alex Loiko <aleloi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#26774} TBR=aleloi@webrtc.org,ossu@webrtc.org Change-Id: I88060f2050ccee83d6091b042a10f79b3c4edc47 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8649 Reviewed-on: https://webrtc-review.googlesource.com/c/123580 Reviewed-by: Alex Loiko <aleloi@webrtc.org> Commit-Queue: Alex Loiko <aleloi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26777}
71 lines
2.3 KiB
C++
71 lines
2.3 KiB
C++
/*
|
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "api/audio_codecs/opus/audio_encoder_opus_config.h"
|
|
|
|
namespace webrtc {
|
|
|
|
namespace {
|
|
|
|
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM)
|
|
// If we are on Android, iOS and/or ARM, use a lower complexity setting by
|
|
// default, to save encoder complexity.
|
|
constexpr int kDefaultComplexity = 5;
|
|
#else
|
|
constexpr int kDefaultComplexity = 9;
|
|
#endif
|
|
|
|
constexpr int kDefaultLowRateComplexity =
|
|
WEBRTC_OPUS_VARIABLE_COMPLEXITY ? 9 : kDefaultComplexity;
|
|
|
|
} // namespace
|
|
|
|
constexpr int AudioEncoderOpusConfig::kDefaultFrameSizeMs;
|
|
constexpr int AudioEncoderOpusConfig::kMinBitrateBps;
|
|
constexpr int AudioEncoderOpusConfig::kMaxBitrateBps;
|
|
|
|
AudioEncoderOpusConfig::AudioEncoderOpusConfig()
|
|
: frame_size_ms(kDefaultFrameSizeMs),
|
|
num_channels(1),
|
|
application(ApplicationMode::kVoip),
|
|
bitrate_bps(32000),
|
|
fec_enabled(false),
|
|
cbr_enabled(false),
|
|
max_playback_rate_hz(48000),
|
|
complexity(kDefaultComplexity),
|
|
low_rate_complexity(kDefaultLowRateComplexity),
|
|
complexity_threshold_bps(12500),
|
|
complexity_threshold_window_bps(1500),
|
|
dtx_enabled(false),
|
|
uplink_bandwidth_update_interval_ms(200),
|
|
payload_type(-1) {}
|
|
AudioEncoderOpusConfig::AudioEncoderOpusConfig(const AudioEncoderOpusConfig&) =
|
|
default;
|
|
AudioEncoderOpusConfig::~AudioEncoderOpusConfig() = default;
|
|
AudioEncoderOpusConfig& AudioEncoderOpusConfig::operator=(
|
|
const AudioEncoderOpusConfig&) = default;
|
|
|
|
bool AudioEncoderOpusConfig::IsOk() const {
|
|
if (frame_size_ms <= 0 || frame_size_ms % 10 != 0)
|
|
return false;
|
|
if (num_channels != 1 && num_channels != 2)
|
|
return false;
|
|
if (!bitrate_bps)
|
|
return false;
|
|
if (*bitrate_bps < kMinBitrateBps || *bitrate_bps > kMaxBitrateBps)
|
|
return false;
|
|
if (complexity < 0 || complexity > 10)
|
|
return false;
|
|
if (low_rate_complexity < 0 || low_rate_complexity > 10)
|
|
return false;
|
|
return true;
|
|
}
|
|
} // namespace webrtc
|