media_config.h (4788B)
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 webrtc { 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 // If true, RTCStats timestamps are sourced from the monotonically increasing 26 // environment Clock, where the epoch is unspecified (i.e. up to the Clock 27 // implementation). If false, RTCStats timestamps are either sourced from 28 // system clock via TimeUTCMicros() which is relative to 1970 but not 29 // necessarily monotonically increasing, or from a monotonic clock that is 30 // set to TimeUTCMicros() at first call, and then procceeds to 31 // increase monotonically. 32 // TODO: bugs.webrtc.org/370535296 - Change default value to true and delete 33 // this flag once downstream projects have migrated. 34 bool stats_timestamp_with_environment_clock = false; 35 36 // Video-specific config. 37 struct Video { 38 // Enable WebRTC CPU Overuse Detection. This flag comes from the 39 // PeerConnection constraint 'googCpuOveruseDetection'. 40 // TODO(https://crbug.com/1315569): Remove the ability to set it in Chromium 41 // and delete this flag. 42 bool enable_cpu_adaptation = true; 43 44 // Enable WebRTC suspension of video. No video frames will be sent 45 // when the bitrate is below the configured minimum bitrate. This 46 // flag comes from the PeerConnection constraint 47 // 'googSuspendBelowMinBitrate', and WebRtcVideoChannel copies it 48 // to VideoSendStream::Config::suspend_below_min_bitrate. 49 // TODO(https://crbug.com/1315564): Remove the ability to set it in Chromium 50 // and delete this flag. 51 bool suspend_below_min_bitrate = false; 52 53 // Enable buffering and playout timing smoothing of decoded frames. 54 // If set to true, then WebRTC will buffer and potentially drop decoded 55 // frames in order to keep a smooth rendering. 56 // If set to false, then WebRTC will hand over the frame from the decoder 57 // to the renderer as soon as possible, meaning that the renderer is 58 // responsible for smooth rendering. 59 // Note that even if this flag is set to false, dropping of frames can 60 // still happen pre-decode, e.g., dropping of higher temporal layers. 61 // This flag comes from the PeerConnection RtcConfiguration. 62 bool enable_prerenderer_smoothing = true; 63 64 // Enables periodic bandwidth probing in application-limited region. 65 bool periodic_alr_bandwidth_probing = false; 66 67 // Enables the new method to estimate the cpu load from encoding, used for 68 // cpu adaptation. This flag is intended to be controlled primarily by a 69 // Chrome origin-trial. 70 // TODO(bugs.webrtc.org/8504): If all goes well, the flag will be removed 71 // together with the old method of estimation. 72 bool experiment_cpu_load_estimator = false; 73 74 // Time interval between RTCP report for video 75 int rtcp_report_interval_ms = 1000; 76 77 // Enables send packet batching from the egress RTP sender. 78 bool enable_send_packet_batching = false; 79 } video; 80 81 // Audio-specific config. 82 struct Audio { 83 // Time interval between RTCP report for audio 84 int rtcp_report_interval_ms = 5000; 85 } audio; 86 87 bool operator==(const MediaConfig& o) const { 88 return enable_dscp == o.enable_dscp && 89 video.enable_cpu_adaptation == o.video.enable_cpu_adaptation && 90 video.suspend_below_min_bitrate == 91 o.video.suspend_below_min_bitrate && 92 video.enable_prerenderer_smoothing == 93 o.video.enable_prerenderer_smoothing && 94 video.periodic_alr_bandwidth_probing == 95 o.video.periodic_alr_bandwidth_probing && 96 video.experiment_cpu_load_estimator == 97 o.video.experiment_cpu_load_estimator && 98 video.rtcp_report_interval_ms == o.video.rtcp_report_interval_ms && 99 video.enable_send_packet_batching == 100 o.video.enable_send_packet_batching && 101 audio.rtcp_report_interval_ms == o.audio.rtcp_report_interval_ms; 102 } 103 104 bool operator!=(const MediaConfig& o) const { return !(*this == o); } 105 }; 106 107 } // namespace webrtc 108 109 110 #endif // MEDIA_BASE_MEDIA_CONFIG_H_