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 <mirtad@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27020}
This commit is contained in:
Rasmus Brandt
2019-03-07 14:27:57 +01:00
committed by Commit Bot
parent d5af40225b
commit 6f0aafa531
3 changed files with 35 additions and 1 deletions

View File

@ -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;

View File

@ -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",

View File

@ -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(