ilnik ee42d19b70 Reland of Add Jpeg frame writer for test support.
Also, use it to save worst psnr frame in video quality tests. It is indented that these saved frames from perfbots will be uploaded to the cloud and will be available in chrome perf dashboard. Because of that size of the saved frame is somewhat an issue. Also, y4m is not convenient to view.

BUG=webrtc:8030

Review-Url: https://codereview.webrtc.org/2998143002
Cr-Commit-Position: refs/heads/master@{#19450}
2017-08-22 14:16:20 +00:00

639 lines
15 KiB
Plaintext

# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../webrtc.gni")
import("//build/config/ui.gni")
if (is_android) {
import("//build/config/android/rules.gni")
}
if (rtc_use_memcheck) {
import("//tools_webrtc/valgrind/valgrind-webrtc.gni")
}
group("test") {
testonly = true
deps = [
":field_trial",
":rtp_test_utils",
":test_common",
":test_renderer",
":test_support",
":video_test_common",
]
if (!build_with_chromium) {
deps += [
":test_main",
":test_support_unittests",
]
}
}
rtc_source_set("video_test_common") {
testonly = true
sources = [
"fake_texture_frame.cc",
"fake_texture_frame.h",
"frame_generator.cc",
"frame_generator.h",
"frame_generator_capturer.cc",
"frame_generator_capturer.h",
"frame_utils.cc",
"frame_utils.h",
"vcm_capturer.cc",
"vcm_capturer.h",
"video_capturer.cc",
"video_capturer.h",
"video_codec_settings.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"..:webrtc_common",
"../api/video_codecs:video_codecs_api",
"../call:video_stream_api",
"../common_video",
"../media:rtc_media_base",
"../modules/video_capture:video_capture_module",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_task_queue",
"../system_wrappers",
]
}
rtc_source_set("rtp_test_utils") {
testonly = true
sources = [
"rtcp_packet_parser.cc",
"rtcp_packet_parser.h",
"rtp_file_reader.cc",
"rtp_file_reader.h",
"rtp_file_writer.cc",
"rtp_file_writer.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"..:webrtc_common",
"../modules/rtp_rtcp",
"../rtc_base:rtc_base_approved",
"//testing/gtest",
]
}
rtc_source_set("field_trial") {
testonly = true
sources = [
"field_trial.cc",
"field_trial.h",
]
deps = [
"..:webrtc_common",
"../system_wrappers",
"../system_wrappers:field_trial_default",
]
}
rtc_source_set("test_support") {
testonly = true
sources = [
"gmock.h",
"gtest.h",
"testsupport/packet_reader.cc",
"testsupport/packet_reader.h",
"testsupport/perf_test.cc",
"testsupport/perf_test.h",
"testsupport/trace_to_stderr.cc",
"testsupport/trace_to_stderr.h",
"testsupport/unittest_utils.h",
]
if (is_ios) {
sources += [
"ios/test_support.h",
"ios/test_support.mm",
]
}
deps = [
"..:webrtc_common",
"../common_video",
"../rtc_base:gtest_prod",
"../rtc_base:rtc_base_approved",
"../system_wrappers",
"//testing/gmock",
"//testing/gtest",
]
public_deps = [
":fileutils",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
if (is_android) {
deps += [ "//base:base" ]
}
if (is_ios && !build_with_chromium) {
deps += [ "../sdk:objc_common" ]
}
if (rtc_use_memcheck) {
data = valgrind_webrtc_dependencies
}
}
if (!build_with_chromium) {
# This target depends on //third_party/gflags and since chromium does not
# have gflags it causes an error when Gn parses this BUILD.gn file.
# It seems that Gn eagerly tries to understand if all the targets are
# buildable (even deps). Obviously gflags is not buildable in chromium
# so if a target depends on this BUILD.gn file we hit this error.
rtc_source_set("test_main") {
testonly = true
sources = [
"test_main.cc",
]
public_deps = [
":test_support",
]
deps = [
":field_trial",
"../rtc_base:rtc_base_approved",
"../system_wrappers:metrics_default",
"//testing/gmock",
"//testing/gtest",
"//third_party/gflags",
]
}
rtc_source_set("video_test_support") {
testonly = true
sources = [
"testsupport/frame_reader.h",
"testsupport/frame_writer.h",
"testsupport/metrics/video_metrics.cc",
"testsupport/metrics/video_metrics.h",
"testsupport/mock/mock_frame_reader.h",
"testsupport/mock/mock_frame_writer.h",
"testsupport/y4m_frame_writer.cc",
"testsupport/yuv_frame_reader.cc",
"testsupport/yuv_frame_writer.cc",
]
deps = [
":test_support",
":video_test_common",
"..:webrtc_common",
"../api:video_frame_api",
"../common_video",
"../rtc_base:rtc_base_approved",
"../system_wrappers",
"//testing/gmock",
"//testing/gtest",
"//third_party/gflags",
]
if (!is_ios) {
deps += [ "//third_party:jpeg" ]
sources += [ "testsupport/jpeg_frame_writer.cc" ]
}
public_deps = [
":fileutils",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
if (is_android) {
deps += [ "//base:base" ]
}
if (is_ios) {
deps += [ "../sdk:objc_common" ]
}
if (rtc_use_memcheck) {
data = valgrind_webrtc_dependencies
}
}
rtc_source_set("test_support_test_output") {
testonly = true
sources = [
"testsupport/test_output.cc",
"testsupport/test_output.h",
]
deps = [
":fileutils",
"../rtc_base:rtc_base_approved",
"//third_party/gflags",
]
}
test_support_unittests_resources = [
"../../resources/foreman_cif_short.yuv",
"../../resources/video_coding/frame-ethernet-ii.pcap",
"../../resources/video_coding/frame-loopback.pcap",
"../../resources/video_coding/pltype103.rtp",
"../../resources/video_coding/pltype103_header_only.rtp",
"../../resources/video_coding/ssrcs-2.pcap",
"../../resources/video_coding/ssrcs-3.pcap",
]
if (is_ios) {
bundle_data("test_support_unittests_bundle_data") {
testonly = true
sources = test_support_unittests_resources
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
}
}
rtc_test("test_support_unittests") {
deps = [
":fake_audio_device",
":rtp_test_utils",
"../api:video_frame_api",
"../call:call_interfaces",
"../common_audio",
"../modules/rtp_rtcp",
"../rtc_base:rtc_base_approved",
"../system_wrappers",
]
sources = [
"fake_audio_device_unittest.cc",
"fake_network_pipe_unittest.cc",
"frame_generator_unittest.cc",
"rtp_file_reader_unittest.cc",
"rtp_file_writer_unittest.cc",
"single_threaded_task_queue_unittest.cc",
"testsupport/always_passing_unittest.cc",
"testsupport/metrics/video_metrics_unittest.cc",
"testsupport/packet_reader_unittest.cc",
"testsupport/perf_test_unittest.cc",
"testsupport/test_output_unittest.cc",
"testsupport/y4m_frame_writer_unittest.cc",
"testsupport/yuv_frame_reader_unittest.cc",
"testsupport/yuv_frame_writer_unittest.cc",
]
# TODO(jschuh): Bug 1348: fix this warning.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
if (is_win) {
# virtual override w/different const/volatile signature.
cflags = [ "/wd4373" ]
}
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
data = test_support_unittests_resources
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
shard_timeout = 900
}
if (is_ios) {
deps += [ ":test_support_unittests_bundle_data" ]
}
deps += [
":direct_transport",
":fileutils_unittests",
":test_common",
":test_main",
":test_support_test_output",
":video_test_common",
":video_test_support",
"../modules/video_capture",
"//testing/gmock",
"//testing/gtest",
"//third_party/gflags",
]
}
}
rtc_source_set("fileutils") {
testonly = true
sources = [
"testsupport/fileutils.cc",
"testsupport/fileutils.h",
]
deps = [
"..:webrtc_common",
"../rtc_base:rtc_base_approved",
]
if (is_ios) {
sources += [ "testsupport/iosfileutils.mm" ]
deps += [ "../sdk:objc_common" ]
}
if (is_win) {
deps += [ "../rtc_base:rtc_base" ]
}
visibility = [ ":*" ]
}
rtc_source_set("run_test") {
testonly = true
sources = [
"run_test.h",
]
if (is_mac) {
sources += [ "mac/run_test.mm" ]
} else {
sources += [ "run_test.cc" ]
}
}
rtc_source_set("fileutils_unittests") {
testonly = true
visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [
"testsupport/fileutils_unittest.cc",
]
deps = [
":fileutils",
":test_support",
"../rtc_base:rtc_base_approved",
"//testing/gmock",
"//testing/gtest",
]
}
rtc_source_set("direct_transport") {
testonly = true
sources = [
"direct_transport.cc",
"direct_transport.h",
"fake_network_pipe.cc",
"fake_network_pipe.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"..:webrtc_common",
"../api:transport_api",
"../call",
"../modules/rtp_rtcp",
"../rtc_base:rtc_base_approved",
"../rtc_base:sequenced_task_checker",
"../system_wrappers",
]
public_deps = [
":single_threaded_task_queue",
]
}
rtc_source_set("single_threaded_task_queue") {
testonly = true
sources = [
"single_threaded_task_queue.cc",
"single_threaded_task_queue.h",
]
deps = [
"../rtc_base:rtc_base_approved",
]
}
rtc_source_set("fake_audio_device") {
testonly = true
sources = [
"fake_audio_device.cc",
"fake_audio_device.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"..:webrtc_common",
"../common_audio:common_audio",
"../modules/audio_device:audio_device",
"../rtc_base:rtc_base_approved",
"../system_wrappers:system_wrappers",
]
}
rtc_source_set("test_common") {
testonly = true
sources = [
"call_test.cc",
"call_test.h",
"configurable_frame_size_encoder.cc",
"configurable_frame_size_encoder.h",
"constants.cc",
"constants.h",
"drifting_clock.cc",
"drifting_clock.h",
"encoder_settings.cc",
"encoder_settings.h",
"fake_decoder.cc",
"fake_decoder.h",
"fake_encoder.cc",
"fake_encoder.h",
"fake_videorenderer.h",
"layer_filtering_transport.cc",
"layer_filtering_transport.h",
"mock_transport.h",
"mock_voe_channel_proxy.h",
"mock_voice_engine.h",
"null_transport.cc",
"null_transport.h",
"rtp_rtcp_observer.h",
"statistics.cc",
"statistics.h",
"win/run_loop_win.cc",
]
if (!is_win) {
sources += [
"run_loop.cc",
"run_loop.h",
]
}
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
":direct_transport",
":fake_audio_device",
":rtp_test_utils",
":test_support",
":video_test_common",
"..:webrtc_common",
"../api:transport_api",
"../api:video_frame_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../api/audio_codecs:builtin_audio_encoder_factory",
"../api/video_codecs:video_codecs_api",
"../audio",
"../call",
"../call:rtp_sender",
"../call:video_stream_api",
"../common_video",
"../logging:rtc_event_log_api",
"../modules/audio_device:mock_audio_device",
"../modules/audio_mixer:audio_mixer_impl",
"../modules/audio_processing",
"../modules/rtp_rtcp",
"../modules/rtp_rtcp:mock_rtp_rtcp",
"../modules/video_coding:webrtc_h264",
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp9",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_task_queue",
"../rtc_base:sequenced_task_checker",
"../system_wrappers",
"../video",
"../voice_engine",
"//testing/gmock",
"//testing/gtest",
]
if (!is_android && !build_with_chromium) {
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}
}
config("test_renderer_exported_config") {
if (is_win && is_clang) {
# GN orders flags on a target before flags from configs. The default config
# adds -Wall, and this flag have to be after -Wall -- so they need to
# come from a config and cannot be on the target directly.
cflags = [
"-Wno-bool-conversion",
"-Wno-comment",
"-Wno-delete-non-virtual-dtor",
]
}
}
rtc_source_set("test_renderer") {
testonly = true
libs = []
sources = [
"linux/glx_renderer.cc",
"linux/glx_renderer.h",
"linux/video_renderer_linux.cc",
"mac/video_renderer_mac.h",
"mac/video_renderer_mac.mm",
"video_renderer.cc",
"video_renderer.h",
"win/d3d_renderer.cc",
"win/d3d_renderer.h",
]
if (!is_linux && !is_mac && !is_win) {
sources += [ "null_platform_renderer.cc" ]
}
if (is_linux || is_mac) {
sources += [
"gl/gl_renderer.cc",
"gl/gl_renderer.h",
]
}
if (is_linux) {
libs += [
"Xext",
"X11",
"GL",
]
}
if (is_android) {
libs += [
"GLESv2",
"log",
]
}
if (is_mac) {
libs = [
"Cocoa.framework",
"OpenGL.framework",
"CoreVideo.framework",
]
}
public_configs = [ ":test_renderer_exported_config" ]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
":test_support",
"..:webrtc_common",
"../common_video",
"../modules/media_file",
"../rtc_base:rtc_base_approved",
"//testing/gtest",
]
}
rtc_source_set("audio_codec_mocks") {
testonly = true
sources = [
"mock_audio_decoder.cc",
"mock_audio_decoder.h",
"mock_audio_decoder_factory.h",
"mock_audio_encoder.cc",
"mock_audio_encoder.h",
"mock_audio_encoder_factory.h",
]
deps = [
":test_support",
"../api/audio_codecs:audio_codecs_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../rtc_base:rtc_base_approved",
"//testing/gmock",
]
}
if (!build_with_chromium && is_android) {
android_library("native_test_java") {
testonly = true
java_files = [
"android/org/webrtc/native_test/RTCNativeUnitTest.java",
"android/org/webrtc/native_test/RTCNativeUnitTestActivity.java",
]
deps = [
"../rtc_base:base_java",
"//testing/android/native_test:native_test_java",
]
}
}