chromium/components/speech/BUILD.gn

# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/features.gni")

source_set("speech") {
  sources = [
    "audio_buffer.cc",
    "audio_buffer.h",
    "audio_encoder.cc",
    "audio_encoder.h",
    "chunked_byte_buffer.cc",
    "chunked_byte_buffer.h",
    "downstream_loader.cc",
    "downstream_loader.h",
    "downstream_loader_client.h",
    "upstream_loader.cc",
    "upstream_loader.h",
    "upstream_loader_client.h",
  ]

  public_deps = [ "//base" ]
  deps = [
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/platform",
    "//mojo/public/cpp/system",
    "//services/network/public/cpp",
    "//services/network/public/mojom",
    "//third_party/flac",
  ]

  if (!is_android) {
    sources += [
      "endpointer/endpointer.cc",
      "endpointer/endpointer.h",
      "endpointer/energy_endpointer.cc",
      "endpointer/energy_endpointer.h",
      "endpointer/energy_endpointer_params.cc",
      "endpointer/energy_endpointer_params.h",
    ]
  }

  if (use_blink && !is_android) {
    sources += [
      "speech_recognizer_fsm.cc",
      "speech_recognizer_fsm.h",
    ]

    deps += [
      "//media/mojo/mojom:audio_data",
      "//media/mojo/mojom:web_speech_recognition",
    ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = [ "chunked_byte_buffer_unittest.cc" ]

  if (!is_android) {
    sources += [ "endpointer/endpointer_unittest.cc" ]
  }

  deps = [
    ":speech",
    "//testing/gtest",
  ]
}