1# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2# 3# Use of this source code is governed by a BSD-style license 4# that can be found in the LICENSE file in the root of the source 5# tree. An additional intellectual property rights grant can be found 6# in the file PATENTS. All contributing project authors may 7# be found in the AUTHORS file in the root of the source tree. 8import("../webrtc.gni") 9if (rtc_enable_protobuf) { 10 import("//third_party/protobuf/proto_library.gni") 11} 12 13group("rtc_tools") { 14 # This target shall build all targets in tools/. 15 testonly = true 16 17 deps = [ ":video_file_reader" ] 18 if (!build_with_chromium) { 19 deps += [ 20 ":frame_analyzer", 21 ":psnr_ssim_analyzer", 22 ":video_quality_analysis", 23 ] 24 } 25 if (!build_with_chromium && rtc_enable_protobuf) { 26 deps += [ ":chart_proto" ] 27 } 28 if (!build_with_chromium && rtc_include_tests) { 29 deps += [ ":tools_unittests" ] 30 } 31 if (rtc_include_tests && rtc_enable_protobuf) { 32 deps += [ 33 ":rtp_analyzer", 34 "network_tester", 35 ] 36 } 37 if (rtc_include_tests && rtc_enable_protobuf && !build_with_chromium) { 38 deps += [ 39 ":audioproc_f", 40 ":event_log_visualizer", 41 ":rtc_event_log_to_text", 42 ":unpack_aecdump", 43 ] 44 } 45 if (!build_with_chromium && rtc_enable_grpc) { 46 deps += [ "data_channel_benchmark" ] 47 } 48} 49 50rtc_library("video_file_reader") { 51 sources = [ 52 "video_file_reader.cc", 53 "video_file_reader.h", 54 ] 55 deps = [ 56 "../api:make_ref_counted", 57 "../api:scoped_refptr", 58 "../api/video:video_frame", 59 "../api/video:video_rtp_headers", 60 "../rtc_base:checks", 61 "../rtc_base:logging", 62 "../rtc_base:refcount", 63 "../rtc_base:stringutils", 64 ] 65 absl_deps = [ 66 "//third_party/abseil-cpp/absl/strings", 67 "//third_party/abseil-cpp/absl/types:optional", 68 ] 69} 70 71rtc_library("video_file_writer") { 72 sources = [ 73 "video_file_writer.cc", 74 "video_file_writer.h", 75 ] 76 deps = [ 77 ":video_file_reader", 78 "../api:scoped_refptr", 79 "../api/video:video_frame", 80 "../api/video:video_rtp_headers", 81 "../rtc_base:logging", 82 ] 83 absl_deps = [ 84 "//third_party/abseil-cpp/absl/strings", 85 "//third_party/abseil-cpp/absl/types:optional", 86 ] 87} 88 89rtc_library("video_quality_analysis") { 90 testonly = true 91 sources = [ 92 "frame_analyzer/linear_least_squares.cc", 93 "frame_analyzer/linear_least_squares.h", 94 "frame_analyzer/video_color_aligner.cc", 95 "frame_analyzer/video_color_aligner.h", 96 "frame_analyzer/video_geometry_aligner.cc", 97 "frame_analyzer/video_geometry_aligner.h", 98 "frame_analyzer/video_quality_analysis.cc", 99 "frame_analyzer/video_quality_analysis.h", 100 "frame_analyzer/video_temporal_aligner.cc", 101 "frame_analyzer/video_temporal_aligner.h", 102 ] 103 deps = [ 104 ":video_file_reader", 105 "../api:array_view", 106 "../api:make_ref_counted", 107 "../api:scoped_refptr", 108 "../api/numerics", 109 "../api/test/metrics:metric", 110 "../api/test/metrics:metrics_logger", 111 "../api/video:video_frame", 112 "../api/video:video_rtp_headers", 113 "../common_video", 114 "../rtc_base:checks", 115 "../rtc_base:logging", 116 "//third_party/libyuv", 117 ] 118 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 119} 120 121# TODO(bugs.webrtc.org/11474): Enable this on win if needed. For now it 122# is only required for Linux and Android. 123if (!build_with_chromium && !build_with_mozilla && !is_win && !is_ios) { 124 action("frame_analyzer_host") { 125 script = "//tools_webrtc/executable_host_build.py" 126 outputs = [ "${root_out_dir}/frame_analyzer_host" ] 127 args = [ 128 "--executable_name", 129 "frame_analyzer", 130 ] 131 } 132} 133 134if (!is_component_build) { 135 # This target can be built from Chromium but it doesn't support 136 # is_component_build=true because it depends on WebRTC testonly code 137 # which is not part of //third_party/webrtc_overrides:webrtc_component. 138 139 # Abseil dependencies are not moved to the absl_deps field deliberately. 140 # If build_with_chromium is true, the absl_deps replaces the dependencies with 141 # the "//third_party/abseil-cpp:absl" target. Which doesn't include absl/flags 142 # (and some others) because they cannot be used in Chromiums. Special exception 143 # for the "frame_analyzer" target in "third_party/abseil-cpp/absl.gni" allows 144 # it to be build in chromium. 145 rtc_executable("frame_analyzer") { 146 visibility = [ "*" ] 147 testonly = true 148 sources = [ "frame_analyzer/frame_analyzer.cc" ] 149 150 deps = [ 151 ":video_file_reader", 152 ":video_file_writer", 153 ":video_quality_analysis", 154 "../api:make_ref_counted", 155 "../api:scoped_refptr", 156 "../api/test/metrics:chrome_perf_dashboard_metrics_exporter", 157 "../api/test/metrics:global_metrics_logger_and_exporter", 158 "../api/test/metrics:metrics_exporter", 159 "../api/test/metrics:stdout_metrics_exporter", 160 "../rtc_base:stringutils", 161 "//third_party/abseil-cpp/absl/flags:flag", 162 "//third_party/abseil-cpp/absl/flags:parse", 163 "//third_party/abseil-cpp/absl/strings", 164 ] 165 166 if (build_with_chromium) { 167 # When building from Chromium, WebRTC's metrics and field trial 168 # implementations need to be replaced by the Chromium ones. 169 deps += [ "//third_party/webrtc_overrides:webrtc_component" ] 170 } 171 } 172 173 # This target can be built from Chromium but it doesn't support 174 # is_component_build=true because it depends on WebRTC testonly code 175 # which is not part of //third_party/webrtc_overrides:webrtc_component. 176 177 # Abseil dependencies are not moved to the absl_deps field deliberately. 178 # If build_with_chromium is true, the absl_deps replaces the dependencies with 179 # the "//third_party/abseil-cpp:absl" target. Which doesn't include absl/flags 180 # (and some others) because they cannot be used in Chromiums. Special exception 181 # for the "rtp_generator" target in "third_party/abseil-cpp/absl.gni" allows 182 # it to be build in chromium. 183 rtc_executable("rtp_generator") { 184 visibility = [ "*" ] 185 testonly = true 186 sources = [ 187 "rtp_generator/main.cc", 188 "rtp_generator/rtp_generator.cc", 189 "rtp_generator/rtp_generator.h", 190 ] 191 192 deps = [ 193 "../api:create_frame_generator", 194 "../api:rtp_parameters", 195 "../api:transport_api", 196 "../api/rtc_event_log", 197 "../api/task_queue:default_task_queue_factory", 198 "../api/task_queue:task_queue", 199 "../api/video:builtin_video_bitrate_allocator_factory", 200 "../api/video_codecs:builtin_video_decoder_factory", 201 "../api/video_codecs:builtin_video_encoder_factory", 202 "../api/video_codecs:video_codecs_api", 203 "../call", 204 "../call:call_interfaces", 205 "../call:fake_network", 206 "../call:rtp_interfaces", 207 "../call:rtp_sender", 208 "../call:simulated_network", 209 "../call:simulated_packet_receiver", 210 "../call:video_stream_api", 211 "../media:rtc_audio_video", 212 "../media:rtc_media_base", 213 "../rtc_base", 214 "../rtc_base:rtc_json", 215 "../rtc_base:threading", 216 "../rtc_base/system:file_wrapper", 217 "../test:fileutils", 218 "../test:rtp_test_utils", 219 "../test:video_test_common", 220 "../video/config:encoder_config", 221 "../video/config:streams_config", 222 "//third_party/abseil-cpp/absl/flags:flag", 223 "//third_party/abseil-cpp/absl/flags:parse", 224 "//third_party/abseil-cpp/absl/flags:usage", 225 "//third_party/abseil-cpp/absl/strings", 226 ] 227 if (build_with_chromium) { 228 # When building from Chromium, WebRTC's metrics and field trial 229 # implementations need to be replaced by the Chromium ones. 230 deps += [ "//third_party/webrtc_overrides:webrtc_component" ] 231 } 232 } 233 234 # This target can be built from Chromium but it doesn't support 235 # is_component_build=true because it depends on WebRTC testonly code 236 # which is not part of //third_party/webrtc_overrides:webrtc_component. 237 238 # Abseil dependencies are not moved to the absl_deps field deliberately. 239 # If build_with_chromium is true, the absl_deps replaces the dependencies with 240 # the "//third_party/abseil-cpp:absl" target. Which doesn't include absl/flags 241 # (and some others) because they cannot be used in Chromiums. Special exception 242 # for the "video_replay" target in "third_party/abseil-cpp/absl.gni" allows 243 # it to be build in chromium. 244 rtc_executable("video_replay") { 245 visibility = [ "*" ] 246 testonly = true 247 sources = [ "video_replay.cc" ] 248 deps = [ 249 "../api:field_trials", 250 "../api/rtc_event_log", 251 "../api/task_queue:default_task_queue_factory", 252 "../api/test/video:function_video_factory", 253 "../api/transport:field_trial_based_config", 254 "../api/video:video_frame", 255 "../api/video_codecs:video_codecs_api", 256 "../call", 257 "../call:call_interfaces", 258 "../common_video", 259 "../media:rtc_internal_video_codecs", 260 "../modules/rtp_rtcp:rtp_rtcp_format", 261 "../modules/video_coding:video_coding_utility", 262 "../rtc_base:checks", 263 "../rtc_base:rtc_json", 264 "../rtc_base:stringutils", 265 "../rtc_base:timeutils", 266 "../system_wrappers", 267 "../test:call_config_utils", 268 "../test:encoder_settings", 269 "../test:fake_video_codecs", 270 "../test:null_transport", 271 "../test:rtp_test_utils", 272 "../test:run_loop", 273 "../test:run_test", 274 "../test:run_test_interface", 275 "../test:test_common", 276 "../test:test_renderer", 277 "../test:test_support", 278 "../test:video_test_common", 279 "../test:video_test_support", 280 "../test/time_controller:time_controller", 281 "//third_party/abseil-cpp/absl/flags:flag", 282 "//third_party/abseil-cpp/absl/flags:parse", 283 ] 284 if (build_with_chromium) { 285 # When building from Chromium, WebRTC's metrics and field trial 286 # implementations need to be replaced by the Chromium ones. 287 deps += [ "//third_party/webrtc_overrides:webrtc_component" ] 288 } 289 } 290} 291 292# Only expose the targets needed by Chromium (e.g. frame_analyzer) to avoid 293# building a lot of redundant code as part of Chromium builds. 294if (!build_with_chromium) { 295 rtc_executable("psnr_ssim_analyzer") { 296 testonly = true 297 sources = [ "psnr_ssim_analyzer/psnr_ssim_analyzer.cc" ] 298 299 deps = [ 300 ":video_file_reader", 301 ":video_quality_analysis", 302 "../api:scoped_refptr", 303 "../api/video:video_frame", 304 "../api/video:video_rtp_headers", 305 "//third_party/abseil-cpp/absl/flags:flag", 306 "//third_party/abseil-cpp/absl/flags:parse", 307 "//third_party/abseil-cpp/absl/flags:usage", 308 ] 309 } 310 311 rtc_library("reference_less_video_analysis_lib") { 312 testonly = true 313 sources = [ 314 "frame_analyzer/reference_less_video_analysis_lib.cc", 315 "frame_analyzer/reference_less_video_analysis_lib.h", 316 ] 317 318 deps = [ 319 ":video_file_reader", 320 ":video_quality_analysis", 321 "../api:scoped_refptr", 322 "../api/video:video_frame", 323 "../api/video:video_rtp_headers", 324 ] 325 } 326 327 rtc_executable("reference_less_video_analysis") { 328 testonly = true 329 sources = [ "frame_analyzer/reference_less_video_analysis.cc" ] 330 331 deps = [ 332 ":reference_less_video_analysis_lib", 333 "//third_party/abseil-cpp/absl/flags:flag", 334 "//third_party/abseil-cpp/absl/flags:parse", 335 "//third_party/abseil-cpp/absl/flags:usage", 336 ] 337 } 338 339 if (rtc_enable_protobuf) { 340 proto_library("chart_proto") { 341 visibility = [ "*" ] 342 sources = [ 343 "rtc_event_log_visualizer/proto/chart.proto", 344 "rtc_event_log_visualizer/proto/chart_enums.proto", 345 ] 346 proto_out_dir = "rtc_tools/rtc_event_log_visualizer/proto" 347 } 348 349 rtc_library("event_log_visualizer_utils") { 350 visibility = [ "*" ] 351 sources = [ 352 "rtc_event_log_visualizer/alerts.cc", 353 "rtc_event_log_visualizer/alerts.h", 354 "rtc_event_log_visualizer/analyze_audio.cc", 355 "rtc_event_log_visualizer/analyze_audio.h", 356 "rtc_event_log_visualizer/analyzer.cc", 357 "rtc_event_log_visualizer/analyzer.h", 358 "rtc_event_log_visualizer/analyzer_common.cc", 359 "rtc_event_log_visualizer/analyzer_common.h", 360 "rtc_event_log_visualizer/log_simulation.cc", 361 "rtc_event_log_visualizer/log_simulation.h", 362 "rtc_event_log_visualizer/plot_base.cc", 363 "rtc_event_log_visualizer/plot_base.h", 364 "rtc_event_log_visualizer/plot_protobuf.cc", 365 "rtc_event_log_visualizer/plot_protobuf.h", 366 "rtc_event_log_visualizer/plot_python.cc", 367 "rtc_event_log_visualizer/plot_python.h", 368 ] 369 deps = [ 370 ":chart_proto", 371 "../api:function_view", 372 "../api:network_state_predictor_api", 373 "../modules/audio_coding:neteq_input_audio_tools", 374 "../modules/audio_coding:neteq_tools_minimal", 375 "../rtc_base:ignore_wundef", 376 "../rtc_base:logging", 377 "../rtc_base:macromagic", 378 "../rtc_base:rate_statistics", 379 "../rtc_base:refcount", 380 381 # TODO(kwiberg): Remove this dependency. 382 "../api/audio_codecs:audio_codecs_api", 383 "../api/transport:field_trial_based_config", 384 "../api/transport:goog_cc", 385 "../api/transport:network_control", 386 "../call:call_interfaces", 387 "../call:video_stream_api", 388 "../logging:rtc_event_log_parser", 389 "../logging:rtc_stream_config", 390 "../modules/audio_coding:ana_debug_dump_proto", 391 "../modules/audio_coding:audio_network_adaptor", 392 "../modules/audio_coding:neteq_tools", 393 "../modules/congestion_controller", 394 "../modules/congestion_controller/goog_cc:delay_based_bwe", 395 "../modules/congestion_controller/goog_cc:estimators", 396 "../modules/congestion_controller/rtp:transport_feedback", 397 "../modules/pacing", 398 "../modules/remote_bitrate_estimator", 399 "../modules/rtp_rtcp", 400 "../modules/rtp_rtcp:rtp_rtcp_format", 401 "../rtc_base:checks", 402 "../rtc_base:rtc_numerics", 403 "../rtc_base:stringutils", 404 "../system_wrappers", 405 "../test:explicit_key_value_config", 406 ] 407 absl_deps = [ 408 "//third_party/abseil-cpp/absl/algorithm:container", 409 "//third_party/abseil-cpp/absl/base:core_headers", 410 "//third_party/abseil-cpp/absl/functional:bind_front", 411 "//third_party/abseil-cpp/absl/strings", 412 "//third_party/abseil-cpp/absl/types:optional", 413 ] 414 } 415 } 416} 417 418if (rtc_include_tests) { 419 if (!build_with_chromium) { 420 if (rtc_enable_protobuf) { 421 rtc_executable("event_log_visualizer") { 422 # TODO(bugs.webrtc.org/14248): Remove once usage of std::tmpnam 423 # is removed (in favor of in memory InputAudioFile. 424 cflags_cc = [ "-Wno-deprecated-declarations" ] 425 sources = [ 426 "rtc_event_log_visualizer/conversational_speech_en.h", 427 "rtc_event_log_visualizer/main.cc", 428 ] 429 deps = [ 430 ":event_log_visualizer_utils", 431 "../api/neteq:neteq_api", 432 "../api/rtc_event_log", 433 "../logging:rtc_event_log_parser", 434 "../modules/audio_coding:neteq", 435 "../modules/rtp_rtcp:rtp_rtcp_format", 436 "../rtc_base:checks", 437 "../rtc_base:logging", 438 "../rtc_base:protobuf_utils", 439 "../system_wrappers:field_trial", 440 "//third_party/abseil-cpp/absl/algorithm:container", 441 "//third_party/abseil-cpp/absl/flags:config", 442 "//third_party/abseil-cpp/absl/flags:flag", 443 "//third_party/abseil-cpp/absl/flags:parse", 444 "//third_party/abseil-cpp/absl/flags:usage", 445 "//third_party/abseil-cpp/absl/strings", 446 ] 447 } 448 449 rtc_executable("rtc_event_log_to_text") { 450 testonly = true 451 sources = [ 452 "rtc_event_log_to_text/converter.cc", 453 "rtc_event_log_to_text/converter.h", 454 "rtc_event_log_to_text/main.cc", 455 ] 456 deps = [ 457 "../api/rtc_event_log", 458 "../logging:ice_log", 459 "../logging:rtc_event_audio", 460 "../logging:rtc_event_begin_end", 461 "../logging:rtc_event_bwe", 462 "../logging:rtc_event_frame_events", 463 "../logging:rtc_event_generic_packet_events", 464 "../logging:rtc_event_log2_proto", 465 "../logging:rtc_event_log_impl_encoder", 466 "../logging:rtc_event_log_parser", 467 "../logging:rtc_event_log_proto", 468 "../logging:rtc_event_pacing", 469 "../logging:rtc_event_rtp_rtcp", 470 "../logging:rtc_event_video", 471 "../logging:rtc_stream_config", 472 "../rtc_base:checks", 473 "../rtc_base:logging", 474 "//third_party/abseil-cpp/absl/base:core_headers", 475 "//third_party/abseil-cpp/absl/flags:flag", 476 "//third_party/abseil-cpp/absl/flags:parse", 477 "//third_party/abseil-cpp/absl/flags:usage", 478 "//third_party/abseil-cpp/absl/strings", 479 ] 480 } 481 } 482 483 tools_unittests_resources = [ 484 "../resources/foreman_128x96.yuv", 485 "../resources/foreman_cif.yuv", 486 "../resources/reference_less_video_test_file.y4m", 487 ] 488 489 if (is_ios) { 490 bundle_data("tools_unittests_bundle_data") { 491 testonly = true 492 sources = tools_unittests_resources 493 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] 494 } 495 } 496 497 rtc_test("tools_unittests") { 498 testonly = true 499 500 sources = [ 501 "frame_analyzer/linear_least_squares_unittest.cc", 502 "frame_analyzer/reference_less_video_analysis_unittest.cc", 503 "frame_analyzer/video_color_aligner_unittest.cc", 504 "frame_analyzer/video_geometry_aligner_unittest.cc", 505 "frame_analyzer/video_quality_analysis_unittest.cc", 506 "frame_analyzer/video_temporal_aligner_unittest.cc", 507 "sanitizers_unittest.cc", 508 "video_file_reader_unittest.cc", 509 "video_file_writer_unittest.cc", 510 ] 511 512 deps = [ 513 ":video_file_reader", 514 ":video_file_writer", 515 ":video_quality_analysis", 516 "../api:scoped_refptr", 517 "../api/test/metrics:metric", 518 "../api/test/metrics:metrics_logger", 519 "../api/video:video_frame", 520 "../api/video:video_rtp_headers", 521 "../common_video", 522 "../rtc_base", 523 "../rtc_base:checks", 524 "../rtc_base:null_socket_server", 525 "../rtc_base:threading", 526 "../system_wrappers", 527 "../test:fileutils", 528 "../test:test_main", 529 "../test:test_support", 530 "//testing/gtest", 531 "//third_party/libyuv", 532 ] 533 534 if (!build_with_chromium) { 535 deps += [ ":reference_less_video_analysis_lib" ] 536 } 537 538 if (rtc_enable_protobuf) { 539 deps += [ "network_tester:network_tester_unittests" ] 540 } 541 542 data = tools_unittests_resources 543 if (is_android) { 544 deps += [ "//testing/android/native_test:native_test_support" ] 545 shard_timeout = 900 546 } 547 if (is_ios) { 548 deps += [ ":tools_unittests_bundle_data" ] 549 } 550 } 551 552 if (rtc_enable_protobuf) { 553 rtc_executable("audioproc_f") { 554 testonly = true 555 sources = [ "audioproc_f/audioproc_float_main.cc" ] 556 deps = [ 557 "../api:audioproc_f_api", 558 "../modules/audio_processing", 559 "../modules/audio_processing:api", 560 ] 561 } 562 563 rtc_executable("unpack_aecdump") { 564 visibility = [ "*" ] 565 sources = [ "unpack_aecdump/unpack.cc" ] 566 567 deps = [ 568 "../api:function_view", 569 "../common_audio", 570 "../modules/audio_processing", 571 "../modules/audio_processing:audioproc_debug_proto", 572 "../modules/audio_processing:audioproc_debug_proto", 573 "../modules/audio_processing:audioproc_protobuf_utils", 574 "../rtc_base:checks", 575 "../rtc_base:ignore_wundef", 576 "../rtc_base:macromagic", 577 "../rtc_base:protobuf_utils", 578 "../rtc_base:stringutils", 579 "../rtc_base/system:arch", 580 "//third_party/abseil-cpp/absl/flags:flag", 581 "//third_party/abseil-cpp/absl/flags:parse", 582 ] 583 } # unpack_aecdump 584 } 585 } 586 587 if (rtc_enable_protobuf) { 588 copy("rtp_analyzer") { 589 sources = [ 590 "py_event_log_analyzer/misc.py", 591 "py_event_log_analyzer/pb_parse.py", 592 "py_event_log_analyzer/rtp_analyzer.py", 593 "py_event_log_analyzer/rtp_analyzer.sh", 594 ] 595 outputs = [ "$root_build_dir/{{source_file_part}}" ] 596 deps = [ "../logging:rtc_event_log_proto" ] 597 } # rtp_analyzer 598 } 599} 600