media_config.h 3.5 KB

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