xref: /aosp_15_r20/external/webrtc/media/base/media_config.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 
11 #ifndef MEDIA_BASE_MEDIA_CONFIG_H_
12 #define MEDIA_BASE_MEDIA_CONFIG_H_
13 
14 namespace cricket {
15 
16 // Construction-time settings, passed on when creating
17 // MediaChannels.
18 struct MediaConfig {
19   // Set DSCP value on packets. This flag comes from the
20   // PeerConnection constraint 'googDscp'.
21   // TODO(https://crbug.com/1315574): Remove the ability to set it in Chromium
22   // and delete this flag.
23   bool enable_dscp = true;
24 
25   // Video-specific config.
26   struct Video {
27     // Enable WebRTC CPU Overuse Detection. This flag comes from the
28     // PeerConnection constraint 'googCpuOveruseDetection'.
29     // TODO(https://crbug.com/1315569): Remove the ability to set it in Chromium
30     // and delete this flag.
31     bool enable_cpu_adaptation = true;
32 
33     // Enable WebRTC suspension of video. No video frames will be sent
34     // when the bitrate is below the configured minimum bitrate. This
35     // flag comes from the PeerConnection constraint
36     // 'googSuspendBelowMinBitrate', and WebRtcVideoChannel copies it
37     // to VideoSendStream::Config::suspend_below_min_bitrate.
38     // TODO(https://crbug.com/1315564): Remove the ability to set it in Chromium
39     // and delete this flag.
40     bool suspend_below_min_bitrate = false;
41 
42     // Enable buffering and playout timing smoothing of decoded frames.
43     // If set to true, then WebRTC will buffer and potentially drop decoded
44     // frames in order to keep a smooth rendering.
45     // If set to false, then WebRTC will hand over the frame from the decoder
46     // to the renderer as soon as possible, meaning that the renderer is
47     // responsible for smooth rendering.
48     // Note that even if this flag is set to false, dropping of frames can
49     // still happen pre-decode, e.g., dropping of higher temporal layers.
50     // This flag comes from the PeerConnection RtcConfiguration.
51     bool enable_prerenderer_smoothing = true;
52 
53     // Enables periodic bandwidth probing in application-limited region.
54     bool periodic_alr_bandwidth_probing = false;
55 
56     // Enables the new method to estimate the cpu load from encoding, used for
57     // cpu adaptation. This flag is intended to be controlled primarily by a
58     // Chrome origin-trial.
59     // TODO(bugs.webrtc.org/8504): If all goes well, the flag will be removed
60     // together with the old method of estimation.
61     bool experiment_cpu_load_estimator = false;
62 
63     // Time interval between RTCP report for video
64     int rtcp_report_interval_ms = 1000;
65   } video;
66 
67   // Audio-specific config.
68   struct Audio {
69     // Time interval between RTCP report for audio
70     int rtcp_report_interval_ms = 5000;
71   } audio;
72 
73   bool operator==(const MediaConfig& o) const {
74     return enable_dscp == o.enable_dscp &&
75            video.enable_cpu_adaptation == o.video.enable_cpu_adaptation &&
76            video.suspend_below_min_bitrate ==
77                o.video.suspend_below_min_bitrate &&
78            video.enable_prerenderer_smoothing ==
79                o.video.enable_prerenderer_smoothing &&
80            video.periodic_alr_bandwidth_probing ==
81                o.video.periodic_alr_bandwidth_probing &&
82            video.experiment_cpu_load_estimator ==
83                o.video.experiment_cpu_load_estimator &&
84            video.rtcp_report_interval_ms == o.video.rtcp_report_interval_ms &&
85            audio.rtcp_report_interval_ms == o.audio.rtcp_report_interval_ms;
86   }
87 
88   bool operator!=(const MediaConfig& o) const { return !(*this == o); }
89 };
90 
91 }  // namespace cricket
92 
93 #endif  // MEDIA_BASE_MEDIA_CONFIG_H_
94