• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
14 namespace webrtc {
15 namespace test {
AddFrameInfo(const VideoFrameBuffer & frame,Timestamp at_time)16 void 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 
AddStats(const VideoFramesStats & other)25 void 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 
AddStats(const VideoQualityStats & other)32 void 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;
37   capture_to_decoded_delay.AddSamples(other.capture_to_decoded_delay);
38   end_to_end_delay.AddSamples(other.end_to_end_delay);
39   psnr.AddSamples(other.psnr);
40   psnr_with_freeze.AddSamples(other.psnr_with_freeze);
41   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
48