# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
import("//third_party/libaom/options.gni")
import("//third_party/protobuf/proto_library.gni")
proto_library("logging_proto") {
sources = [ "logging/proto/raw_events.proto" ]
}
# Common code shared by all cast components.
source_set("common") {
sources = [
"cast_callbacks.h",
"cast_config.cc",
"cast_config.h",
"cast_environment.cc",
"cast_environment.h",
"common/encoded_frame.cc",
"common/encoded_frame.h",
"common/frame_id.h",
"common/openscreen_conversion_helpers.cc",
"common/openscreen_conversion_helpers.h",
"common/packet.h",
"common/rtp_time.h",
"common/sender_encoded_frame.cc",
"common/sender_encoded_frame.h",
"common/video_frame_factory.h",
"constants.h",
# NOTE: Logging code is pulled in by CastEnvironment.
"logging/encoding_event_subscriber.cc",
"logging/encoding_event_subscriber.h",
"logging/log_event_dispatcher.cc",
"logging/log_event_dispatcher.h",
"logging/logging_defines.cc",
"logging/logging_defines.h",
"logging/proto/proto_utils.cc",
"logging/proto/proto_utils.h",
"logging/raw_event_subscriber.h",
"logging/raw_event_subscriber_bundle.cc",
"logging/raw_event_subscriber_bundle.h",
"logging/receiver_time_offset_estimator.h",
"logging/receiver_time_offset_estimator_impl.cc",
"logging/receiver_time_offset_estimator_impl.h",
"logging/simple_event_subscriber.cc",
"logging/simple_event_subscriber.h",
"logging/stats_event_subscriber.cc",
"logging/stats_event_subscriber.h",
]
deps = [
"//media",
"//third_party/openscreen/src/platform:base",
]
public_deps = [
":logging_proto",
"//base",
"//net",
"//third_party/openscreen/src/cast/streaming:common",
"//third_party/openscreen/src/cast/streaming:sender",
"//third_party/openscreen/src/platform:api",
"//ui/gfx/geometry",
]
}
source_set("encoding") {
sources = [
"encoding/audio_encoder.cc",
"encoding/audio_encoder.h",
"encoding/encoding_support.cc",
"encoding/encoding_support.h",
"encoding/encoding_util.cc",
"encoding/encoding_util.h",
"encoding/external_video_encoder.cc",
"encoding/external_video_encoder.h",
"encoding/fake_software_video_encoder.cc",
"encoding/fake_software_video_encoder.h",
"encoding/size_adaptable_video_encoder_base.cc",
"encoding/size_adaptable_video_encoder_base.h",
"encoding/software_video_encoder.h",
"encoding/video_encoder.cc",
"encoding/video_encoder.h",
"encoding/video_encoder_impl.cc",
"encoding/video_encoder_impl.h",
"encoding/vpx_encoder.cc",
"encoding/vpx_encoder.h",
"encoding/vpx_quantizer_parser.cc",
"encoding/vpx_quantizer_parser.h",
]
public_deps = [
"//base",
"//media",
"//third_party/libvpx",
"//ui/gfx/geometry",
]
deps = [
":common",
"//third_party/libaom:libaom_buildflags",
"//third_party/openscreen/src/cast/streaming:common",
"//third_party/opus",
]
# Necessary for AAC audio encoding.
if (is_apple) {
frameworks = [
"AudioToolbox.framework",
"CoreFoundation.framework",
"CoreMedia.framework",
]
}
if (enable_libaom) {
sources += [
"encoding/av1_encoder.cc",
"encoding/av1_encoder.h",
]
deps += [ "//third_party/libaom" ]
}
}
source_set("sender") {
sources = [
"sender/audio_sender.cc",
"sender/audio_sender.h",
"sender/congestion_control.cc",
"sender/congestion_control.h",
"sender/frame_sender.cc",
"sender/frame_sender.h",
"sender/openscreen_frame_sender.cc",
"sender/openscreen_frame_sender.h",
"sender/performance_metrics_overlay.cc",
"sender/performance_metrics_overlay.h",
"sender/video_bitrate_suggester.cc",
"sender/video_bitrate_suggester.h",
"sender/video_sender.cc",
"sender/video_sender.h",
]
deps = [
":common",
":encoding",
"//base",
"//components/openscreen_platform",
"//media",
"//media/capture:capture_base",
"//third_party/openscreen/src/cast/streaming:sender",
"//third_party/openscreen/src/platform:api",
"//ui/gfx/geometry",
]
}
static_library("test_support") {
testonly = true
sources = [
"test/fake_openscreen_clock.cc",
"test/fake_openscreen_clock.h",
"test/fake_receiver_time_offset_estimator.cc",
"test/fake_receiver_time_offset_estimator.h",
"test/fake_video_encode_accelerator_factory.cc",
"test/fake_video_encode_accelerator_factory.h",
"test/mock_openscreen_environment.cc",
"test/mock_openscreen_environment.h",
"test/receiver/video_decoder.cc",
"test/receiver/video_decoder.h",
"test/utility/audio_utility.cc",
"test/utility/audio_utility.h",
"test/utility/default_config.cc",
"test/utility/default_config.h",
"test/utility/video_utility.cc",
"test/utility/video_utility.h",
]
deps = [
":common",
":sender",
"//base/test:test_support",
"//media",
"//media:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/libvpx",
"//third_party/libyuv",
"//third_party/openscreen/src/platform:api",
"//ui/gfx:test_support",
]
}
test("cast_unittests") {
sources = [
"common/openscreen_conversion_helpers_unittest.cc",
"encoding/audio_encoder_unittest.cc",
"encoding/encoding_support_unittest.cc",
"encoding/external_video_encoder_unittest.cc",
"encoding/video_encoder_unittest.cc",
"encoding/vpx_quantizer_parser_unittest.cc",
"logging/encoding_event_subscriber_unittest.cc",
"logging/receiver_time_offset_estimator_impl_unittest.cc",
"logging/simple_event_subscriber_unittest.cc",
"logging/stats_event_subscriber_unittest.cc",
"sender/audio_sender_unittest.cc",
"sender/congestion_control_unittest.cc",
"sender/openscreen_frame_sender_unittest.cc",
"sender/video_bitrate_suggester_unittest.cc",
"sender/video_sender_unittest.cc",
"test/utility/audio_utility_unittest.cc",
]
deps = [
":common",
":encoding",
":sender",
":test_support",
"//base",
"//base/test:test_support",
"//components/openscreen_platform",
"//media:test_support",
"//media/cast/openscreen:unit_tests",
"//media/test:run_all_unittests",
"//testing/gmock",
"//testing/gtest",
"//third_party/openscreen/src/cast/streaming:common",
"//third_party/openscreen/src/cast/streaming:sender",
]
if (is_android) {
deps += [
# The test needs the java dependencies to add the java classes for their
# native counterparts to the test apk.
"//media/base/android:media_java",
"//testing/android/native_test:native_test_native_code",
]
}
}
fuzzer_test("media_vpx_quantizer_parser_fuzzer") {
sources = [ "encoding/vpx_quantizer_parser_fuzzer.cc" ]
deps = [
":encoding",
"//components/openscreen_platform:openscreen_platform_using_net_sockets",
]
}