1# Copyright 2019 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build_overrides/build.gni") 6import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni") 7import("//third_party/protobuf/proto_library.gni") 8import("../../testing/libfuzzer/fuzzer_test.gni") 9 10fuzzable_proto_library("remoting_proto") { 11 sources = [ "remoting.proto" ] 12} 13 14source_set("streaming_configs") { 15 sources = [ 16 "capture_configs.h", 17 "constants.h", 18 "message_fields.cc", 19 "message_fields.h", 20 "resolution.cc", 21 "resolution.h", 22 ] 23 24 public_configs = [ "../../build:openscreen_include_dirs" ] 25 26 public_deps = [ 27 "../../third_party/abseil", 28 "../../third_party/jsoncpp", 29 ] 30 31 deps = [ 32 "../../platform:base", 33 "../../util:base", 34 ] 35} 36 37source_set("common") { 38 sources = [ 39 "answer_messages.cc", 40 "answer_messages.h", 41 "capture_recommendations.cc", 42 "capture_recommendations.h", 43 "clock_drift_smoother.cc", 44 "clock_drift_smoother.h", 45 "encoded_frame.cc", 46 "encoded_frame.h", 47 "environment.cc", 48 "environment.h", 49 "expanded_value_base.h", 50 "frame_crypto.cc", 51 "frame_crypto.h", 52 "frame_id.cc", 53 "frame_id.h", 54 "ntp_time.cc", 55 "ntp_time.h", 56 "offer_messages.cc", 57 "offer_messages.h", 58 "packet_util.cc", 59 "packet_util.h", 60 "receiver_message.cc", 61 "receiver_message.h", 62 "rpc_messenger.cc", 63 "rpc_messenger.h", 64 "rtcp_common.cc", 65 "rtcp_common.h", 66 "rtcp_session.cc", 67 "rtcp_session.h", 68 "rtp_defines.cc", 69 "rtp_defines.h", 70 "rtp_time.cc", 71 "rtp_time.h", 72 "sender_message.cc", 73 "sender_message.h", 74 "session_config.cc", 75 "session_config.h", 76 "session_messenger.cc", 77 "session_messenger.h", 78 "ssrc.cc", 79 "ssrc.h", 80 ] 81 82 public_configs = [ "../../build:openscreen_include_dirs" ] 83 84 public_deps = [ 85 ":remoting_proto", 86 ":streaming_configs", 87 "../../third_party/abseil", 88 "../../third_party/boringssl", 89 "../common:channel", 90 "../common:public", 91 "../common/certificate/proto:certificate_proto", 92 ] 93 94 deps = [ 95 "../../platform", 96 "../../util", 97 ] 98 99 if (!build_with_chromium) { 100 deps += [ "../protocol:castv2" ] 101 } 102} 103 104source_set("receiver") { 105 sources = [ 106 "compound_rtcp_builder.cc", 107 "compound_rtcp_builder.h", 108 "frame_collector.cc", 109 "frame_collector.h", 110 "packet_receive_stats_tracker.cc", 111 "packet_receive_stats_tracker.h", 112 "receiver.cc", 113 "receiver.h", 114 "receiver_base.cc", 115 "receiver_base.h", 116 "receiver_packet_router.cc", 117 "receiver_packet_router.h", 118 "receiver_session.cc", 119 "receiver_session.h", 120 "rtp_packet_parser.cc", 121 "rtp_packet_parser.h", 122 "sender_report_parser.cc", 123 "sender_report_parser.h", 124 ] 125 126 public_deps = [ ":common" ] 127 128 deps = [ "../../util" ] 129} 130 131source_set("sender") { 132 sources = [ 133 "bandwidth_estimator.cc", 134 "bandwidth_estimator.h", 135 "compound_rtcp_parser.cc", 136 "compound_rtcp_parser.h", 137 "remoting_capabilities.h", 138 "rtp_packetizer.cc", 139 "rtp_packetizer.h", 140 "sender.cc", 141 "sender.h", 142 "sender_packet_router.cc", 143 "sender_packet_router.h", 144 "sender_report_builder.cc", 145 "sender_report_builder.h", 146 "sender_session.cc", 147 "sender_session.h", 148 ] 149 150 public_deps = [ ":common" ] 151 152 deps = [ "../../util" ] 153} 154 155source_set("test_helpers") { 156 testonly = true 157 158 sources = [ 159 "testing/message_pipe.h", 160 "testing/simple_message_port.h", 161 "testing/simple_socket_subscriber.h", 162 ] 163 164 public_deps = [ ":common" ] 165 166 deps = [ 167 "../../third_party/googletest:gmock", 168 "../../third_party/googletest:gtest", 169 "../../util", 170 "../common:public", 171 ] 172} 173 174source_set("unittests") { 175 testonly = true 176 177 sources = [ 178 "answer_messages_unittest.cc", 179 "bandwidth_estimator_unittest.cc", 180 "capture_recommendations_unittest.cc", 181 "compound_rtcp_builder_unittest.cc", 182 "compound_rtcp_parser_unittest.cc", 183 "expanded_value_base_unittest.cc", 184 "frame_collector_unittest.cc", 185 "frame_crypto_unittest.cc", 186 "message_fields_unittest.cc", 187 "mock_compound_rtcp_parser_client.h", 188 "mock_environment.cc", 189 "mock_environment.h", 190 "ntp_time_unittest.cc", 191 "offer_messages_unittest.cc", 192 "packet_receive_stats_tracker_unittest.cc", 193 "packet_util_unittest.cc", 194 "receiver_session_unittest.cc", 195 "receiver_unittest.cc", 196 "rpc_messenger_unittest.cc", 197 "rtcp_common_unittest.cc", 198 "rtp_packet_parser_unittest.cc", 199 "rtp_packetizer_unittest.cc", 200 "rtp_time_unittest.cc", 201 "sender_packet_router_unittest.cc", 202 "sender_report_unittest.cc", 203 "sender_session_unittest.cc", 204 "sender_unittest.cc", 205 "session_messenger_unittest.cc", 206 "ssrc_unittest.cc", 207 ] 208 209 deps = [ 210 ":receiver", 211 ":sender", 212 ":test_helpers", 213 "../../platform:test", 214 "../../third_party/googletest:gmock", 215 "../../third_party/googletest:gtest", 216 "../../util", 217 ] 218} 219 220openscreen_fuzzer_test("compound_rtcp_parser_fuzzer") { 221 sources = [ "compound_rtcp_parser_fuzzer.cc" ] 222 223 deps = [ 224 ":sender", 225 "../../third_party/abseil", 226 ] 227 228 seed_corpus = "compound_rtcp_parser_fuzzer_seeds" 229 230 # Note: 1500 is approx. kMaxRtpPacketSize in rtp_defines.h. 231 libfuzzer_options = [ "max_len=1500" ] 232} 233 234openscreen_fuzzer_test("rtp_packet_parser_fuzzer") { 235 sources = [ "rtp_packet_parser_fuzzer.cc" ] 236 237 deps = [ 238 ":receiver", 239 "../../third_party/abseil", 240 ] 241 242 seed_corpus = "rtp_packet_parser_fuzzer_seeds" 243 244 # Note: 1500 is approx. kMaxRtpPacketSize in rtp_defines.h. 245 libfuzzer_options = [ "max_len=1500" ] 246} 247 248openscreen_fuzzer_test("sender_report_parser_fuzzer") { 249 sources = [ "sender_report_parser_fuzzer.cc" ] 250 251 deps = [ 252 ":receiver", 253 "../../third_party/abseil", 254 ] 255 256 seed_corpus = "sender_report_parser_fuzzer_seeds" 257 258 # Note: 1500 is approx. kMaxRtpPacketSize in rtp_defines.h. 259 libfuzzer_options = [ "max_len=1500" ] 260} 261