# 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")
if (is_android) {
  import("//build/config/android/config.gni")
  import("//build/config/android/rules.gni")
}

rtc_static_library("ortc") {
  defines = []
  sources = [
    "ortcfactory.cc",
    "ortcfactory.h",
    "ortcrtpreceiveradapter.cc",
    "ortcrtpreceiveradapter.h",
    "ortcrtpsenderadapter.cc",
    "ortcrtpsenderadapter.h",
    "rtpparametersconversion.cc",
    "rtpparametersconversion.h",
    "rtptransportadapter.cc",
    "rtptransportadapter.h",
    "rtptransportcontrolleradapter.cc",
    "rtptransportcontrolleradapter.h",
  ]

  # TODO(deadbeef): Create a separate target for the common things ORTC and
  # PeerConnection code shares, so that ortc can depend on that instead of
  # libjingle_peerconnection.
  deps = [
    "../api/audio_codecs:builtin_audio_decoder_factory",
    "../api/audio_codecs:builtin_audio_encoder_factory",
    "../base:rtc_base",
    "../base:rtc_base_approved",
    "../call:call_interfaces",
    "../logging:rtc_event_log_api",
    "../media:rtc_media",
    "../media:rtc_media_base",
    "../modules/audio_processing:audio_processing",
    "../p2p:rtc_p2p",
    "../pc:libjingle_peerconnection",
    "../pc:rtc_pc",
  ]

  public_deps = [
    "../api:ortc_api",
  ]

  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" ]
  }
}

if (rtc_include_tests) {
  rtc_test("ortc_unittests") {
    testonly = true

    sources = [
      "ortcfactory_integrationtest.cc",
      "ortcfactory_unittest.cc",
      "ortcrtpreceiver_unittest.cc",
      "ortcrtpsender_unittest.cc",
      "rtpparametersconversion_unittest.cc",
      "rtptransport_unittest.cc",
      "rtptransportcontroller_unittest.cc",
      "srtptransport_unittest.cc",
      "testrtpparameters.cc",
      "testrtpparameters.h",
    ]

    deps = [
      ":ortc",
      "../base:rtc_base",
      "../base:rtc_base_approved",
      "../base:rtc_base_tests_main",
      "../base:rtc_base_tests_utils",
      "../media:rtc_media_tests_utils",
      "../p2p:p2p_test_utils",
      "../p2p:rtc_p2p",
      "../pc:pc_test_utils",
      "../system_wrappers:metrics_default",
    ]

    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" ]
    }

    if (is_android) {
      deps += [ "//testing/android/native_test:native_test_support" ]
    }
  }
}
