blob: 2dea902f2f171e983ded60c4f00414ffd8e47c58 [file] [log] [blame]
Evan Shrubsolec70b1022020-04-06 11:23:06 +02001/*
2 * Copyright 2020 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
11#ifndef API_VIDEO_VIDEO_ADAPTATION_COUNTERS_H_
12#define API_VIDEO_VIDEO_ADAPTATION_COUNTERS_H_
13
Henrik Boströmf0eef122020-05-28 16:22:42 +020014#include <string>
15
Evan Shrubsolec70b1022020-04-06 11:23:06 +020016#include "rtc_base/checks.h"
17
18namespace webrtc {
19
20// Counts the number of adaptations have resulted due to resource overuse.
21// Today we can adapt resolution and fps.
22struct VideoAdaptationCounters {
23 VideoAdaptationCounters() : resolution_adaptations(0), fps_adaptations(0) {}
24 VideoAdaptationCounters(int resolution_adaptations, int fps_adaptations)
25 : resolution_adaptations(resolution_adaptations),
26 fps_adaptations(fps_adaptations) {
27 RTC_DCHECK_GE(resolution_adaptations, 0);
28 RTC_DCHECK_GE(fps_adaptations, 0);
29 }
30
31 int Total() const { return fps_adaptations + resolution_adaptations; }
32
33 bool operator==(const VideoAdaptationCounters& rhs) const;
34 bool operator!=(const VideoAdaptationCounters& rhs) const;
35
36 VideoAdaptationCounters operator+(const VideoAdaptationCounters& other) const;
37
Henrik Boströmf0eef122020-05-28 16:22:42 +020038 std::string ToString() const;
39
Evan Shrubsolec70b1022020-04-06 11:23:06 +020040 int resolution_adaptations;
41 int fps_adaptations;
42};
43
44} // namespace webrtc
45
46#endif // API_VIDEO_VIDEO_ADAPTATION_COUNTERS_H_