Evan Shrubsole | c70b102 | 2020-04-06 11:23:06 +0200 | [diff] [blame] | 1 | /* |
| 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öm | f0eef12 | 2020-05-28 16:22:42 +0200 | [diff] [blame] | 14 | #include <string> |
| 15 | |
Evan Shrubsole | c70b102 | 2020-04-06 11:23:06 +0200 | [diff] [blame] | 16 | #include "rtc_base/checks.h" |
| 17 | |
| 18 | namespace webrtc { |
| 19 | |
| 20 | // Counts the number of adaptations have resulted due to resource overuse. |
| 21 | // Today we can adapt resolution and fps. |
| 22 | struct 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öm | f0eef12 | 2020-05-28 16:22:42 +0200 | [diff] [blame] | 38 | std::string ToString() const; |
| 39 | |
Evan Shrubsole | c70b102 | 2020-04-06 11:23:06 +0200 | [diff] [blame] | 40 | int resolution_adaptations; |
| 41 | int fps_adaptations; |
| 42 | }; |
| 43 | |
| 44 | } // namespace webrtc |
| 45 | |
| 46 | #endif // API_VIDEO_VIDEO_ADAPTATION_COUNTERS_H_ |