Åsa Persson | f3d828e | 2019-05-06 12:22:49 +0200 | [diff] [blame^] | 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 | |
| 11 | #ifndef RTC_BASE_EXPERIMENTS_BALANCED_DEGRADATION_SETTINGS_H_ |
| 12 | #define RTC_BASE_EXPERIMENTS_BALANCED_DEGRADATION_SETTINGS_H_ |
| 13 | |
| 14 | #include <vector> |
| 15 | |
| 16 | namespace webrtc { |
| 17 | |
| 18 | class BalancedDegradationSettings { |
| 19 | public: |
| 20 | BalancedDegradationSettings(); |
| 21 | ~BalancedDegradationSettings(); |
| 22 | |
| 23 | struct Config { |
| 24 | Config(); |
| 25 | Config(int pixels, int fps); |
| 26 | |
| 27 | bool operator==(const Config& o) const { |
| 28 | return pixels == o.pixels && fps == o.fps; |
| 29 | } |
| 30 | |
| 31 | int pixels = 0; // The video frame size. |
| 32 | int fps = 0; // The framerate to be used if the frame size is less than |
| 33 | // or equal to |pixels|. |
| 34 | }; |
| 35 | |
| 36 | // Returns configurations from field trial on success (default on failure). |
| 37 | std::vector<Config> GetConfigs() const; |
| 38 | |
| 39 | // Gets the min/max framerate from |configs_| based on |pixels|. |
| 40 | int MinFps(int pixels) const; |
| 41 | int MaxFps(int pixels) const; |
| 42 | |
| 43 | private: |
| 44 | std::vector<Config> configs_; |
| 45 | }; |
| 46 | |
| 47 | } // namespace webrtc |
| 48 | |
| 49 | #endif // RTC_BASE_EXPERIMENTS_BALANCED_DEGRADATION_SETTINGS_H_ |