Niels Möller | 6daa278 | 2018-01-23 10:37:42 +0100 | [diff] [blame] | 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_MEDIACONFIG_H_ |
| 12 | #define MEDIA_BASE_MEDIACONFIG_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 | // Set to true if the renderer has an algorithm of frame selection. |
| 37 | // If the value is true, then WebRTC will hand over a frame as soon as |
| 38 | // possible without delay, and rendering smoothness is completely the duty |
| 39 | // of the renderer; |
| 40 | // If the value is false, then WebRTC is responsible to delay frame release |
| 41 | // in order to increase rendering smoothness. |
| 42 | // |
| 43 | // This flag comes from PeerConnection's RtcConfiguration, but is |
| 44 | // currently only set by the command line flag |
| 45 | // 'disable-rtc-smoothness-algorithm'. |
| 46 | // WebRtcVideoChannel::AddRecvStream copies it to the created |
| 47 | // WebRtcVideoReceiveStream, where it is returned by the |
| 48 | // SmoothsRenderedFrames method. This method is used by the |
| 49 | // VideoReceiveStream, where the value is passed on to the |
| 50 | // IncomingVideoStream constructor. |
| 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 | } video; |
| 63 | |
| 64 | bool operator==(const MediaConfig& o) const { |
| 65 | return enable_dscp == o.enable_dscp && |
| 66 | video.enable_cpu_adaptation == |
| 67 | o.video.enable_cpu_adaptation && |
| 68 | video.suspend_below_min_bitrate == |
| 69 | o.video.suspend_below_min_bitrate && |
| 70 | video.enable_prerenderer_smoothing == |
| 71 | o.video.enable_prerenderer_smoothing && |
| 72 | video.periodic_alr_bandwidth_probing == |
| 73 | o.video.periodic_alr_bandwidth_probing && |
| 74 | video.experiment_cpu_load_estimator == |
| 75 | o.video.experiment_cpu_load_estimator; |
| 76 | } |
| 77 | |
| 78 | bool operator!=(const MediaConfig& o) const { return !(*this == o); } |
| 79 | }; |
| 80 | |
| 81 | } // namespace cricket |
| 82 | |
| 83 | #endif // MEDIA_BASE_MEDIACONFIG_H_ |