blob: f8b9fcd1978912ab57f09407e6adafe69fab504c [file] [log] [blame]
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build_overrides/build.gni")
declare_args() {
# These are only relevant for building the demo apps, which require external
# headers/libraries be installed. Set them to true if your local system has
# SDL2/FFMPEG installed. On Debian-like systems, the following should install
# all the required headers and libraries:
#
# sudo apt-get install libsdl2-2.0 libsdl2-dev libavcodec libavcodec-dev \
# libavformat libavformat-dev libavutil libavutil-dev
have_sdl_for_demo_apps = false
have_ffmpeg_for_demo_apps = false
}
source_set("common") {
sources = [
"clock_drift_smoother.cc",
"clock_drift_smoother.h",
"constants.h",
"encoded_frame.cc",
"encoded_frame.h",
"environment.cc",
"environment.h",
"expanded_value_base.h",
"frame_crypto.cc",
"frame_crypto.h",
"frame_id.cc",
"frame_id.h",
"ntp_time.cc",
"ntp_time.h",
"packet_util.cc",
"packet_util.h",
"rtcp_common.cc",
"rtcp_common.h",
"rtcp_session.cc",
"rtcp_session.h",
"rtp_defines.cc",
"rtp_defines.h",
"rtp_time.cc",
"rtp_time.h",
"ssrc.cc",
"ssrc.h",
]
public_deps = [
"../../third_party/abseil",
"../../third_party/boringssl",
]
deps = [
"../../platform",
"../../util",
]
}
source_set("receiver") {
sources = [
"compound_rtcp_builder.cc",
"compound_rtcp_builder.h",
"frame_collector.cc",
"frame_collector.h",
"packet_receive_stats_tracker.cc",
"packet_receive_stats_tracker.h",
"receiver.cc",
"receiver.h",
"receiver_packet_router.cc",
"receiver_packet_router.h",
"rtp_packet_parser.cc",
"rtp_packet_parser.h",
"sender_report_parser.cc",
"sender_report_parser.h",
]
public_deps = [
":common",
]
}
source_set("sender") {
sources = [
"compound_rtcp_parser.cc",
"compound_rtcp_parser.h",
"rtp_packetizer.cc",
"rtp_packetizer.h",
"sender_report_builder.cc",
"sender_report_builder.h",
]
public_deps = [
":common",
]
}
source_set("unittests") {
testonly = true
sources = [
"compound_rtcp_builder_unittest.cc",
"compound_rtcp_parser_unittest.cc",
"expanded_value_base_unittest.cc",
"frame_collector_unittest.cc",
"frame_crypto_unittest.cc",
"mock_compound_rtcp_parser_client.h",
"ntp_time_unittest.cc",
"packet_receive_stats_tracker_unittest.cc",
"packet_util_unittest.cc",
"receiver_unittest.cc",
"rtcp_common_unittest.cc",
"rtp_packet_parser_unittest.cc",
"rtp_packetizer_unittest.cc",
"rtp_time_unittest.cc",
"sender_report_unittest.cc",
"ssrc_unittest.cc",
]
deps = [
":receiver",
":sender",
"../../third_party/googletest:gmock",
"../../third_party/googletest:gtest",
]
}
if (build_with_chromium) {
import("//testing/libfuzzer/fuzzer_test.gni")
fuzzer_test("compound_rtcp_parser_fuzzer") {
sources = [
"compound_rtcp_parser_fuzzer.cc",
]
deps = [
":sender",
"../../third_party/abseil",
]
seed_corpus = "compound_rtcp_parser_fuzzer_seeds"
# Note: 1500 is approx. kMaxRtpPacketSize in rtp_defines.h.
libfuzzer_options = [ "max_len=1500" ]
}
fuzzer_test("rtp_packet_parser_fuzzer") {
sources = [
"rtp_packet_parser_fuzzer.cc",
]
deps = [
":receiver",
"../../third_party/abseil",
]
seed_corpus = "rtp_packet_parser_fuzzer_seeds"
# Note: 1500 is approx. kMaxRtpPacketSize in rtp_defines.h.
libfuzzer_options = [ "max_len=1500" ]
}
fuzzer_test("sender_report_parser_fuzzer") {
sources = [
"sender_report_parser_fuzzer.cc",
]
deps = [
":receiver",
"../../third_party/abseil",
]
seed_corpus = "sender_report_parser_fuzzer_seeds"
# Note: 1500 is approx. kMaxRtpPacketSize in rtp_defines.h.
libfuzzer_options = [ "max_len=1500" ]
}
} else {
# Note: The following is commented out because, as of this writing, the LLVM
# toolchain we pull does not include libclang_rt.fuzzer-x86_64.a, the
# libFuzzer library *with* a main() to drive everything. Thus, the only way to
# get things working is to specify an exact path to the fuzzer_no_main variant
# of the library that *is* avalable, and then provide our own main(). In
# summary, what you see below demonstrates how to get it working specifically
# for Clang 9.0.0 on Linux x86_64. One need only modify the "libs = [...]" for
# a different Clang, OS, or architecture.
# if (is_clang) {
# executable("rtp_packet_parser_fuzzer") {
# testonly = true
# defines = [ "NEEDS_MAIN_TO_CALL_FUZZER_DRIVER" ]
# sources = [
# "rtp_packet_parser_fuzzer.cc",
# ]
# cflags_cc = [ "-fsanitize=address,fuzzer-no-link,undefined" ]
# ldflags = [ "-fsanitize=address,undefined" ]
# libs = [ "$clang_base_path/lib/clang/9.0.0/lib/linux/libclang_rt.fuzzer_no_main-x86_64.a" ]
# deps = [
# ":receiver",
# "../../third_party/abseil",
# ]
# }
# }
}
# Define the demo app targets only when the build is configured to use the
# standalone, non-embedder //platform implementation; since they *are* the whole
# application.
if (!build_with_chromium) {
executable("streaming_receiver_demo") {
sources = [
"receiver_demo/main.cc",
]
deps = [
":receiver",
"../../platform",
]
defines = []
include_dirs = []
libs = []
if (have_sdl_for_demo_apps && have_ffmpeg_for_demo_apps) {
defines += [ "CAST_STREAMING_HAVE_EXTERNAL_LIBS_FOR_DEMO_APPS" ]
include_dirs += [ "/usr/include/SDL2" ]
libs += [
"-lSDL2",
"-lavcodec",
"-lavformat",
"-lavutil",
]
}
}
}