blob: eca1ee79b8c69c2a3f5b2d3ad2d68be2c6e4318d [file] [log] [blame]
Sebastian Jansson9a4f38e2018-12-19 12:14:411/*
Sebastian Jansson7150d8c2019-04-09 12:18:092 * Copyright 2019 The WebRTC project authors. All Rights Reserved.
Sebastian Jansson9a4f38e2018-12-19 12:14:413 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
Sebastian Jansson7150d8c2019-04-09 12:18:0910#ifndef TEST_SCENARIO_PERFORMANCE_STATS_H_
11#define TEST_SCENARIO_PERFORMANCE_STATS_H_
Sebastian Jansson9a4f38e2018-12-19 12:14:4112
Sebastian Jansson7150d8c2019-04-09 12:18:0913#include "api/units/data_rate.h"
14#include "api/units/time_delta.h"
Sebastian Jansson9a4f38e2018-12-19 12:14:4115#include "api/units/timestamp.h"
Sebastian Janssoncf2df2f2019-04-02 09:51:2816#include "api/video/video_frame_buffer.h"
Sebastian Janssonefa3f762019-12-02 06:19:5517#include "rtc_base/numerics/event_rate_counter.h"
18#include "rtc_base/numerics/sample_stats.h"
Sebastian Jansson9a4f38e2018-12-19 12:14:4119
20namespace webrtc {
21namespace test {
Sebastian Jansson7150d8c2019-04-09 12:18:0922
Sebastian Janssoncf2df2f2019-04-02 09:51:2823struct VideoFramePair {
Sebastian Jansson7150d8c2019-04-09 12:18:0924 rtc::scoped_refptr<VideoFrameBuffer> captured;
25 rtc::scoped_refptr<VideoFrameBuffer> decoded;
Sebastian Janssoncf2df2f2019-04-02 09:51:2826 Timestamp capture_time = Timestamp::MinusInfinity();
Sebastian Janssone9cac4f2019-06-24 15:10:5527 Timestamp decoded_time = Timestamp::PlusInfinity();
Sebastian Janssoncf2df2f2019-04-02 09:51:2828 Timestamp render_time = Timestamp::PlusInfinity();
29 // A unique identifier for the spatial/temporal layer the decoded frame
30 // belongs to. Note that this does not reflect the id as defined by the
31 // underlying layer setup.
32 int layer_id = 0;
33 int capture_id = 0;
34 int decode_id = 0;
35 // Indicates the repeat count for the decoded frame. Meaning that the same
36 // decoded frame has matched differend captured frames.
37 int repeated = 0;
Sebastian Jansson9a4f38e2018-12-19 12:14:4138};
Sebastian Jansson7150d8c2019-04-09 12:18:0939
Sebastian Jansson9a2ca0a2019-04-15 11:18:1940struct VideoFramesStats {
41 int count = 0;
42 SampleStats<double> pixels;
43 SampleStats<double> resolution;
44 EventRateCounter frames;
45 void AddFrameInfo(const VideoFrameBuffer& frame, Timestamp at_time);
46 void AddStats(const VideoFramesStats& other);
47};
48
Sebastian Jansson7150d8c2019-04-09 12:18:0949struct VideoQualityStats {
Sebastian Jansson7150d8c2019-04-09 12:18:0950 int lost_count = 0;
Sebastian Jansson9a2ca0a2019-04-15 11:18:1951 int freeze_count = 0;
52 VideoFramesStats capture;
53 VideoFramesStats render;
Sebastian Janssone9cac4f2019-06-24 15:10:5554 // Time from frame was captured on device to time frame was delivered from
55 // decoder.
56 SampleStats<TimeDelta> capture_to_decoded_delay;
Sebastian Jansson9a2ca0a2019-04-15 11:18:1957 // Time from frame was captured on device to time frame was displayed on
58 // device.
59 SampleStats<TimeDelta> end_to_end_delay;
Sebastian Janssone9cac4f2019-06-24 15:10:5560 // PSNR for delivered frames. Note that this might go up for a worse
61 // connection due to frame dropping.
Sebastian Jansson9a2ca0a2019-04-15 11:18:1962 SampleStats<double> psnr;
Sebastian Janssone9cac4f2019-06-24 15:10:5563 // PSNR for all frames, dropped or lost frames are compared to the last
64 // successfully delivered frame
65 SampleStats<double> psnr_with_freeze;
Sebastian Jansson9a2ca0a2019-04-15 11:18:1966 // Frames skipped between two nearest.
67 SampleStats<double> skipped_between_rendered;
68 // In the next 2 metrics freeze is a pause that is longer, than maximum:
69 // 1. 150ms
70 // 2. 3 * average time between two sequential frames.
71 // Item 1 will cover high fps video and is a duration, that is noticeable by
72 // human eye. Item 2 will cover low fps video like screen sharing.
73 SampleStats<TimeDelta> freeze_duration;
74 // Mean time between one freeze end and next freeze start.
75 SampleStats<TimeDelta> time_between_freezes;
76 void AddStats(const VideoQualityStats& other);
77};
78
79struct CollectedCallStats {
80 SampleStats<DataRate> target_rate;
Sebastian Jansson72b75242019-04-15 13:10:1881 SampleStats<TimeDelta> pacer_delay;
82 SampleStats<TimeDelta> round_trip_time;
Sebastian Jansson9a2ca0a2019-04-15 11:18:1983 SampleStats<double> memory_usage;
84};
85
86struct CollectedAudioReceiveStats {
87 SampleStats<double> expand_rate;
88 SampleStats<double> accelerate_rate;
89 SampleStats<TimeDelta> jitter_buffer;
90};
91struct CollectedVideoSendStats {
92 SampleStats<double> encode_frame_rate;
93 SampleStats<TimeDelta> encode_time;
94 SampleStats<double> encode_usage;
95 SampleStats<DataRate> media_bitrate;
96 SampleStats<DataRate> fec_bitrate;
97};
98struct CollectedVideoReceiveStats {
99 SampleStats<TimeDelta> decode_time;
100 SampleStats<TimeDelta> decode_time_max;
101 SampleStats<double> decode_pixels;
102 SampleStats<double> resolution;
Sebastian Jansson7150d8c2019-04-09 12:18:09103};
104
Sebastian Jansson9a4f38e2018-12-19 12:14:41105} // namespace test
106} // namespace webrtc
Sebastian Jansson7150d8c2019-04-09 12:18:09107#endif // TEST_SCENARIO_PERFORMANCE_STATS_H_