<commit_before>/*
 *  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 "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h"

#include <cmath>
#include <utility>

#include "webrtc/base/ignore_wundef.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/bitrate_controller.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/dtx_controller.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller.h"
#include "webrtc/system_wrappers/include/clock.h"

#ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP
RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#else
#include "webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#endif
RTC_POP_IGNORING_WUNDEF()
#endif

namespace webrtc {

namespace {

#ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP

std::unique_ptr<FecController> CreateFecController(
    const audio_network_adaptor::config::FecController& config,
    bool initial_fec_enabled,
    const Clock* clock) {
  RTC_CHECK(config.has_fec_enabling_threshold());
  RTC_CHECK(config.has_fec_disabling_threshold());
  RTC_CHECK(config.has_time_constant_ms());

  auto& fec_enabling_threshold = config.fec_enabling_threshold();
  RTC_CHECK(fec_enabling_threshold.has_low_bandwidth_bps());
  RTC_CHECK(fec_enabling_threshold.has_low_bandwidth_packet_loss());
  RTC_CHECK(fec_enabling_threshold.has_high_bandwidth_bps());
  RTC_CHECK(fec_enabling_threshold.has_high_bandwidth_packet_loss());

  auto& fec_disabling_threshold = config.fec_disabling_threshold();
  RTC_CHECK(fec_disabling_threshold.has_low_bandwidth_bps());
  RTC_CHECK(fec_disabling_threshold.has_low_bandwidth_packet_loss());
  RTC_CHECK(fec_disabling_threshold.has_high_bandwidth_bps());
  RTC_CHECK(fec_disabling_threshold.has_high_bandwidth_packet_loss());

  return std::unique_ptr<FecController>(new FecController(FecController::Config(
      initial_fec_enabled,
      FecController::Config::Threshold(
          fec_enabling_threshold.low_bandwidth_bps(),
          fec_enabling_threshold.low_bandwidth_packet_loss(),
          fec_enabling_threshold.high_bandwidth_bps(),
          fec_enabling_threshold.high_bandwidth_packet_loss()),
      FecController::Config::Threshold(
          fec_disabling_threshold.low_bandwidth_bps(),
          fec_disabling_threshold.low_bandwidth_packet_loss(),
          fec_disabling_threshold.high_bandwidth_bps(),
          fec_disabling_threshold.high_bandwidth_packet_loss()),
      config.has_time_constant_ms(), clock)));
}
<commit_msg>Fix an error in Audio Network Adaptor: time constant passed wrong.<commit_after>/*
 *  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 "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h"

#include <cmath>
#include <utility>

#include "webrtc/base/ignore_wundef.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/bitrate_controller.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/channel_controller.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/dtx_controller.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/fec_controller.h"
#include "webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller.h"
#include "webrtc/system_wrappers/include/clock.h"

#ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP
RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#else
#include "webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#endif
RTC_POP_IGNORING_WUNDEF()
#endif

namespace webrtc {

namespace {

#ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP

std::unique_ptr<FecController> CreateFecController(
    const audio_network_adaptor::config::FecController& config,
    bool initial_fec_enabled,
    const Clock* clock) {
  RTC_CHECK(config.has_fec_enabling_threshold());
  RTC_CHECK(config.has_fec_disabling_threshold());
  RTC_CHECK(config.has_time_constant_ms());

  auto& fec_enabling_threshold = config.fec_enabling_threshold();
  RTC_CHECK(fec_enabling_threshold.has_low_bandwidth_bps());
  RTC_CHECK(fec_enabling_threshold.has_low_bandwidth_packet_loss());
  RTC_CHECK(fec_enabling_threshold.has_high_bandwidth_bps());
  RTC_CHECK(fec_enabling_threshold.has_high_bandwidth_packet_loss());

  auto& fec_disabling_threshold = config.fec_disabling_threshold();
  RTC_CHECK(fec_disabling_threshold.has_low_bandwidth_bps());
  RTC_CHECK(fec_disabling_threshold.has_low_bandwidth_packet_loss());
  RTC_CHECK(fec_disabling_threshold.has_high_bandwidth_bps());
  RTC_CHECK(fec_disabling_threshold.has_high_bandwidth_packet_loss());

  return std::unique_ptr<FecController>(new FecController(FecController::Config(
      initial_fec_enabled,
      FecController::Config::Threshold(
          fec_enabling_threshold.low_bandwidth_bps(),
          fec_enabling_threshold.low_bandwidth_packet_loss(),
          fec_enabling_threshold.high_bandwidth_bps(),
          fec_enabling_threshold.high_bandwidth_packet_loss()),
      FecController::Config::Threshold(
          fec_disabling_threshold.low_bandwidth_bps(),
          fec_disabling_threshold.low_bandwidth_packet_loss(),
          fec_disabling_threshold.high_bandwidth_bps(),
          fec_disabling_threshold.high_bandwidth_packet_loss()),
      config.time_constant_ms(), clock)));
}

{'fraction_non_alphanumeric': 0.0875177081693688, 'fraction_numerical': 0.0012592475995592634, 'mean_word_length': 6.564285714285714, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5327030', 'n_tokens_mistral': 2228, 'n_tokens_neox': 2120, 'n_words': 308}