From 6f0aafa5313d8736b1faf09a96605301a5bb910a Mon Sep 17 00:00:00 2001 From: Rasmus Brandt Date: Thu, 7 Mar 2019 14:27:57 +0100 Subject: [PATCH] Add PrintResults to VideoCodecTest. These are used by the test runner to pick up perf values to be shown in the perf dashboard. Bug: webrtc:10349 Change-Id: Ib3b2479f7a20b66192751bee8237d757f5870bd2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126220 Reviewed-by: Mirta Dvornicic Reviewed-by: Karl Wiberg Commit-Queue: Rasmus Brandt Cr-Commit-Position: refs/heads/master@{#27020} --- api/test/videocodec_test_fixture.h | 3 ++ modules/video_coding/BUILD.gn | 1 + .../test/videocodec_test_fixture_impl.cc | 32 ++++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/api/test/videocodec_test_fixture.h b/api/test/videocodec_test_fixture.h index c9359a6eb2..0a2c758164 100644 --- a/api/test/videocodec_test_fixture.h +++ b/api/test/videocodec_test_fixture.h @@ -82,6 +82,9 @@ class VideoCodecTestFixture { std::string ToString() const; std::string CodecName() const; + // Name of this config, to be used for accounting by the test runner. + std::string test_name; + // Plain name of YUV file to process without file extension. std::string filename; diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index fb67178dc8..60dfdb6b1b 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -664,6 +664,7 @@ if (rtc_include_tests) { "../../rtc_base:rtc_task_queue_for_test", "../../system_wrappers", "../../test:fileutils", + "../../test:perf_test", "../../test:test_common", "../../test:test_support", "../../test:video_test_common", diff --git a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc index c81ce760a7..e38fcaf418 100644 --- a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc +++ b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc @@ -46,6 +46,7 @@ #include "test/gtest.h" #include "test/testsupport/file_utils.h" #include "test/testsupport/frame_writer.h" +#include "test/testsupport/perf_test.h" #include "test/video_codec_settings.h" namespace webrtc { @@ -251,7 +252,8 @@ size_t VideoCodecTestFixtureImpl::Config::NumberOfSimulcastStreams() const { std::string VideoCodecTestFixtureImpl::Config::ToString() const { std::string codec_type = CodecTypeToPayloadString(codec_settings.codecType); rtc::StringBuilder ss; - ss << "filename: " << filename; + ss << "test_name: " << test_name; + ss << "\nfilename: " << filename; ss << "\nnum_frames: " << num_frames; ss << "\nmax_payload_size_bytes: " << max_payload_size_bytes; ss << "\ndecode: " << decode; @@ -478,6 +480,34 @@ void VideoCodecTestFixtureImpl::AnalyzeAllFrames( printf("==> Receive stats\n"); for (const auto& layer_stat : layer_stats) { printf("%s\n\n", layer_stat.ToString("recv_").c_str()); + + // For perf dashboard. + char modifier_buf[256]; + rtc::SimpleStringBuilder modifier(modifier_buf); + modifier << "_sl" << layer_stat.spatial_idx << "tl" + << layer_stat.temporal_idx; + PrintResult("enc_speed", modifier.str(), config_.test_name, + layer_stat.enc_speed_fps, "fps", /*important=*/false); + PrintResult("dec_speed", modifier.str(), config_.test_name, + layer_stat.dec_speed_fps, "fps", /*important=*/false); + PrintResult("avg_key_frame_size", modifier.str(), config_.test_name, + layer_stat.avg_key_frame_size_bytes, "bytes", + /*important=*/false); + PrintResult("avg_delta_frame_size", modifier.str(), config_.test_name, + layer_stat.avg_delta_frame_size_bytes, "bytes", + /*important=*/false); + PrintResult("avg_qp", modifier.str(), config_.test_name, + layer_stat.avg_qp, "", /*important=*/false); + PrintResult("avg_psnr_y", modifier.str(), config_.test_name, + layer_stat.avg_psnr_y, "dB", /*important=*/false); + PrintResult("min_psnr", modifier.str(), config_.test_name, + layer_stat.min_psnr, "dB", /*important=*/false); + PrintResult("num_dropped_frames", modifier.str(), config_.test_name, + layer_stat.num_input_frames - layer_stat.num_encoded_frames, + "frames", /*important=*/false); + PrintResult("num_key_frames", modifier.str(), config_.test_name, + layer_stat.num_key_frames, "frames", /*important=*/false); + printf("\n"); } VideoStatistics send_stat = stats_.SliceAndCalcAggregatedVideoStatistic(