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