LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_mixer - default_output_rate_calculator.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2016 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/modules/audio_mixer/default_output_rate_calculator.h"
      12             : 
      13             : #include <algorithm>
      14             : 
      15             : #include "webrtc/modules/audio_processing/include/audio_processing.h"
      16             : 
      17             : namespace webrtc {
      18             : 
      19           0 : int DefaultOutputRateCalculator::CalculateOutputRate(
      20             :     const std::vector<int>& preferred_sample_rates) {
      21           0 :   if (preferred_sample_rates.empty()) {
      22           0 :     return DefaultOutputRateCalculator::kDefaultFrequency;
      23             :   }
      24             :   using NativeRate = AudioProcessing::NativeRate;
      25           0 :   const int maximal_frequency = *std::max_element(
      26           0 :       preferred_sample_rates.begin(), preferred_sample_rates.end());
      27             : 
      28           0 :   RTC_DCHECK_LE(NativeRate::kSampleRate8kHz, maximal_frequency);
      29           0 :   RTC_DCHECK_GE(NativeRate::kSampleRate48kHz, maximal_frequency);
      30             : 
      31             :   static constexpr NativeRate native_rates[] = {
      32             :       NativeRate::kSampleRate8kHz, NativeRate::kSampleRate16kHz,
      33             :       NativeRate::kSampleRate32kHz, NativeRate::kSampleRate48kHz};
      34           0 :   const auto rounded_up_index = std::lower_bound(
      35           0 :       std::begin(native_rates), std::end(native_rates), maximal_frequency);
      36           0 :   RTC_DCHECK(rounded_up_index != std::end(native_rates));
      37           0 :   return *rounded_up_index;
      38             : }
      39             : }  // namespace webrtc

Generated by: LCOV version 1.13