# 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.

import("../../../webrtc.gni")  # This contains def of 'rtc_enable_protobuf'

rtc_source_set("aec_dump") {
  visibility = [ "*" ]
  sources = [ "aec_dump_factory.h" ]

  deps = [
    "..:aec_dump_interface",
    "../../../rtc_base/system:file_wrapper",
    "../../../rtc_base/system:rtc_export",
  ]
}

if (rtc_include_tests) {
  rtc_library("mock_aec_dump") {
    testonly = true
    sources = [
      "mock_aec_dump.cc",
      "mock_aec_dump.h",
    ]

    deps = [
      "..:aec_dump_interface",
      "..:audioproc_test_utils",
      "../",
      "../../../test:test_support",
    ]
  }

  rtc_library("mock_aec_dump_unittests") {
    testonly = true
    configs += [ "..:apm_debug_dump" ]
    sources = [ "aec_dump_integration_test.cc" ]

    deps = [
      ":mock_aec_dump",
      "..:api",
      "..:audioproc_test_utils",
      "../",
      "//testing/gtest",
    ]
  }
}

if (rtc_enable_protobuf) {
  rtc_library("aec_dump_impl") {
    sources = [
      "aec_dump_impl.cc",
      "aec_dump_impl.h",
      "capture_stream_info.cc",
      "capture_stream_info.h",
      "write_to_file_task.cc",
      "write_to_file_task.h",
    ]

    deps = [
      ":aec_dump",
      "..:aec_dump_interface",
      "../../../api/audio:audio_frame_api",
      "../../../api/task_queue",
      "../../../rtc_base:checks",
      "../../../rtc_base:ignore_wundef",
      "../../../rtc_base:logging",
      "../../../rtc_base:macromagic",
      "../../../rtc_base:protobuf_utils",
      "../../../rtc_base:race_checker",
      "../../../rtc_base:rtc_event",
      "../../../rtc_base:rtc_task_queue",
      "../../../rtc_base/system:file_wrapper",
      "../../../system_wrappers",
    ]

    deps += [ "../:audioproc_debug_proto" ]
  }

  if (rtc_include_tests) {
    rtc_library("aec_dump_unittests") {
      testonly = true
      defines = []
      deps = [
        ":aec_dump",
        ":aec_dump_impl",
        "..:audioproc_debug_proto",
        "../",
        "../../../rtc_base:task_queue_for_test",
        "../../../test:fileutils",
        "../../../test:test_support",
        "//testing/gtest",
      ]
      sources = [ "aec_dump_unittest.cc" ]
    }
  }
}

rtc_library("null_aec_dump_factory") {
  assert_no_deps = [ ":aec_dump_impl" ]
  sources = [ "null_aec_dump_factory.cc" ]

  deps = [
    ":aec_dump",
    "..:aec_dump_interface",
  ]
}
