blob: e12be8a003fab0e9bb99a7737786caf3aebbe1a1 [file] [log] [blame]
Sebastian Jansson9a2ca0a2019-04-15 13:18:19 +02001/*
2 * Copyright 2019 The WebRTC project authors. All Rights Reserved.
3 *
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 */
10#include "test/scenario/performance_stats.h"
11
12#include <algorithm>
13
14namespace webrtc {
15namespace test {
Sebastian Jansson9a2ca0a2019-04-15 13:18:19 +020016void VideoFramesStats::AddFrameInfo(const VideoFrameBuffer& frame,
17 Timestamp at_time) {
18 ++count;
19 RTC_DCHECK(at_time.IsFinite());
20 pixels.AddSample(frame.width() * frame.height());
21 resolution.AddSample(std::max(frame.width(), frame.height()));
22 frames.AddEvent(at_time);
23}
24
25void VideoFramesStats::AddStats(const VideoFramesStats& other) {
26 count += other.count;
27 pixels.AddSamples(other.pixels);
28 resolution.AddSamples(other.resolution);
29 frames.AddEvents(other.frames);
30}
31
32void VideoQualityStats::AddStats(const VideoQualityStats& other) {
33 capture.AddStats(other.capture);
34 render.AddStats(other.render);
35 lost_count += other.lost_count;
36 freeze_count += other.freeze_count;
Sebastian Janssone9cac4f2019-06-24 17:10:55 +020037 capture_to_decoded_delay.AddSamples(other.capture_to_decoded_delay);
Sebastian Jansson9a2ca0a2019-04-15 13:18:19 +020038 end_to_end_delay.AddSamples(other.end_to_end_delay);
39 psnr.AddSamples(other.psnr);
Sebastian Janssone9cac4f2019-06-24 17:10:55 +020040 psnr_with_freeze.AddSamples(other.psnr_with_freeze);
Sebastian Jansson9a2ca0a2019-04-15 13:18:19 +020041 skipped_between_rendered.AddSamples(other.skipped_between_rendered);
42 freeze_duration.AddSamples(other.freeze_duration);
43 time_between_freezes.AddSamples(other.time_between_freezes);
44}
45
46} // namespace test
47} // namespace webrtc