webrtc_m130/modules/audio_mixer/default_output_rate_calculator.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.5 KiB
C++
Raw Normal View History

/*
* Copyright (c) 2016 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 "modules/audio_mixer/default_output_rate_calculator.h"
#include <algorithm>
#include <iterator>
#include "modules/audio_processing/include/audio_processing.h"
#include "rtc_base/checks.h"
namespace webrtc {
int DefaultOutputRateCalculator::CalculateOutputRateFromRange(
rtc::ArrayView<const int> preferred_sample_rates) {
if (preferred_sample_rates.empty()) {
return DefaultOutputRateCalculator::kDefaultFrequency;
}
using NativeRate = AudioProcessing::NativeRate;
const int maximal_frequency = *std::max_element(
preferred_sample_rates.cbegin(), preferred_sample_rates.cend());
RTC_DCHECK_LE(NativeRate::kSampleRate8kHz, maximal_frequency);
RTC_DCHECK_GE(NativeRate::kSampleRate48kHz, maximal_frequency);
static constexpr NativeRate native_rates[] = {
NativeRate::kSampleRate8kHz, NativeRate::kSampleRate16kHz,
NativeRate::kSampleRate32kHz, NativeRate::kSampleRate48kHz};
Roll chromium_revision 33a7a547b9..0e44c5e141 (452838:453130) Some code changes were needed due to webrtc:7236. Disabling flaky test for iOS and ORTC (on memcheck). Change log: https://chromium.googlesource.com/chromium/src/+log/33a7a547b9..0e44c5e141 Full diff: https://chromium.googlesource.com/chromium/src/+/33a7a547b9..0e44c5e141 Changed dependencies: * src/base: https://chromium.googlesource.com/chromium/src/base/+log/facaa65f73..07e8029830 * src/build: https://chromium.googlesource.com/chromium/src/build/+log/eefc9cc748..c7c2db69cd * src/ios: https://chromium.googlesource.com/chromium/src/ios/+log/f893f94115..75bb86f02a * src/testing: https://chromium.googlesource.com/chromium/src/testing/+log/b40837ba97..e31bd01824 * src/third_party: https://chromium.googlesource.com/chromium/src/third_party/+log/55242080a2..285c08d0e2 * src/third_party/catapult: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git/+log/794fff6c81..47b98570f6 * src/third_party/libyuv: https://chromium.googlesource.com/libyuv/libyuv.git/+log/b18fd21d3c..45b176d153 * src/tools: https://chromium.googlesource.com/chromium/src/tools/+log/e4e78e0678..6b40c03f7b DEPS diff: https://chromium.googlesource.com/chromium/src/+/33a7a547b9..0e44c5e141/DEPS Clang version changed 289944:295793 Details: https://chromium.googlesource.com/chromium/src/+/33a7a547b9..0e44c5e141/tools/clang/scripts/update.py TBR=henrik.lundin@webrtc.org BUG=webrtc:7236, webrtc:7247, webrtc:7248 NOTRY=True Review-Url: https://codereview.webrtc.org/2718953002 Cr-Commit-Position: refs/heads/master@{#16849}
2017-02-26 19:53:40 -08:00
const auto* rounded_up_index = std::lower_bound(
std::begin(native_rates), std::end(native_rates), maximal_frequency);
RTC_DCHECK(rounded_up_index != std::end(native_rates));
return *rounded_up_index;
}
} // namespace webrtc