Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
bitrate_constraints.h
1/*
2 * Copyright (c) 2018 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#pragma once
11
12#include <algorithm>
13
14 namespace agora {
15 namespace rtc {
16
17// TODO(srte): BitrateConstraints and BitrateSettings should be merged.
18// Both represent the same kind data, but are using different default
19// initializer and representation of unset values.
20 struct BitrateConstraints {
21 int min_bitrate_bps = 0;
22 int start_bitrate_bps = kDefaultStartBitrateBps;
23 int max_bitrate_bps = -1;
24
25 private:
26 static constexpr int kDefaultStartBitrateBps = 300000;
27};
28
29// Like std::min, but considers non-positive values to be unset.
30 template <typename T>
31 static T MinPositive(T a, T b) {
32 if (a <= 0) {
33 return b;
34 }
35 if (b <= 0) {
36 return a;
37 }
38 return std::min(a, b);
39}
40
41} // namespace rtc
42} // namespace agora
agora::rtc
Definition AgoraExtensions.h:5
agora::rtc::MinPositive
static T MinPositive(T a, T b)
Definition bitrate_constraints.h:31
agora
Definition AgoraAtomicOps.h:21
agora::rtc::BitrateConstraints
Definition bitrate_constraints.h:20
agora::rtc::BitrateConstraints::max_bitrate_bps
int max_bitrate_bps
Definition bitrate_constraints.h:23
agora::rtc::BitrateConstraints::start_bitrate_bps
int start_bitrate_bps
Definition bitrate_constraints.h:22
agora::rtc::BitrateConstraints::min_bitrate_bps
int min_bitrate_bps
Definition bitrate_constraints.h:21