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