# Copyright (c) 2014 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.

import("../../webrtc.gni")

rtc_static_library("pacing") {
  sources = [
    "alr_detector.cc",
    "alr_detector.h",
    "bitrate_prober.cc",
    "bitrate_prober.h",
    "interval_budget.cc",
    "interval_budget.h",
    "paced_sender.cc",
    "paced_sender.h",
    "pacer.h",
    "packet_queue.cc",
    "packet_queue.h",
    "packet_queue_interface.cc",
    "packet_queue_interface.h",
    "packet_router.cc",
    "packet_router.h",
    "round_robin_packet_queue.cc",
    "round_robin_packet_queue.h",
  ]

  if (!build_with_chromium && is_clang) {
    # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
    suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
  }

  deps = [
    "..:module_api",
    "../../:typedefs",
    "../../:webrtc_common",
    "../../logging:rtc_event_bwe",
    "../../logging:rtc_event_log_api",
    "../../logging:rtc_event_pacing",
    "../../rtc_base:checks",
    "../../rtc_base:rtc_base_approved",
    "../../rtc_base/experiments:alr_experiment",
    "../../system_wrappers",
    "../../system_wrappers:field_trial_api",
    "../../system_wrappers:runtime_enabled_features_api",
    "../remote_bitrate_estimator",
    "../rtp_rtcp",
    "../rtp_rtcp:rtp_rtcp_format",
    "../utility",
    "//third_party/abseil-cpp/absl/types:optional",
  ]
}

if (rtc_include_tests) {
  rtc_source_set("pacing_unittests") {
    testonly = true

    sources = [
      "alr_detector_unittest.cc",
      "bitrate_prober_unittest.cc",
      "interval_budget_unittest.cc",
      "paced_sender_unittest.cc",
      "packet_router_unittest.cc",
    ]
    deps = [
      ":pacing",
      "../../rtc_base:checks",
      "../../rtc_base:rtc_base_approved",
      "../../rtc_base:rtc_base_tests_utils",
      "../../rtc_base/experiments:alr_experiment",
      "../../system_wrappers",
      "../../system_wrappers:field_trial_api",
      "../../system_wrappers:runtime_enabled_features_api",
      "../../test:field_trial",
      "../../test:test_support",
      "../rtp_rtcp",
      "../rtp_rtcp:mock_rtp_rtcp",
      "../rtp_rtcp:rtp_rtcp_format",
    ]

    # TODO(jschuh): bugs.webrtc.org/1348: fix this warning.
    configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
    if (!build_with_chromium && is_clang) {
      # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
      suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
    }
  }

  rtc_source_set("mock_paced_sender") {
    testonly = true
    sources = [
      "mock/mock_paced_sender.h",
    ]
    deps = [
      ":pacing",
      "../../system_wrappers",
      "../../test:test_support",
    ]
  }
}
