rtcp_transceiver_config.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Copyright (c) 2017 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 MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_
  11. #define MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_
  12. #include <string>
  13. #include "api/rtp_headers.h"
  14. #include "api/task_queue/task_queue_base.h"
  15. #include "api/video/video_bitrate_allocation.h"
  16. #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
  17. #include "system_wrappers/include/ntp_time.h"
  18. namespace webrtc {
  19. class ReceiveStatisticsProvider;
  20. class Transport;
  21. // Interface to watch incoming rtcp packets by media (rtp) receiver.
  22. class MediaReceiverRtcpObserver {
  23. public:
  24. virtual ~MediaReceiverRtcpObserver() = default;
  25. // All message handlers have default empty implementation. This way users only
  26. // need to implement the ones they are interested in.
  27. virtual void OnSenderReport(uint32_t sender_ssrc,
  28. NtpTime ntp_time,
  29. uint32_t rtp_time) {}
  30. virtual void OnBye(uint32_t sender_ssrc) {}
  31. virtual void OnBitrateAllocation(uint32_t sender_ssrc,
  32. const VideoBitrateAllocation& allocation) {}
  33. };
  34. struct RtcpTransceiverConfig {
  35. RtcpTransceiverConfig();
  36. RtcpTransceiverConfig(const RtcpTransceiverConfig&);
  37. RtcpTransceiverConfig& operator=(const RtcpTransceiverConfig&);
  38. ~RtcpTransceiverConfig();
  39. // Logs the error and returns false if configuration miss key objects or
  40. // is inconsistant. May log warnings.
  41. bool Validate() const;
  42. // Used to prepend all log messages. Can be empty.
  43. std::string debug_id;
  44. // Ssrc to use as default sender ssrc, e.g. for transport-wide feedbacks.
  45. uint32_t feedback_ssrc = 1;
  46. // Canonical End-Point Identifier of the local particiapnt.
  47. // Defined in rfc3550 section 6 note 2 and section 6.5.1.
  48. std::string cname;
  49. // Maximum packet size outgoing transport accepts.
  50. size_t max_packet_size = 1200;
  51. // Transport to send rtcp packets to. Should be set.
  52. Transport* outgoing_transport = nullptr;
  53. // Queue for scheduling delayed tasks, e.g. sending periodic compound packets.
  54. TaskQueueBase* task_queue = nullptr;
  55. // Rtcp report block generator for outgoing receiver reports.
  56. ReceiveStatisticsProvider* receive_statistics = nullptr;
  57. // Callback to pass result of rtt calculation. Should outlive RtcpTransceiver.
  58. // Callbacks will be invoked on the task_queue.
  59. RtcpRttStats* rtt_observer = nullptr;
  60. // Configures if sending should
  61. // enforce compound packets: https://tools.ietf.org/html/rfc4585#section-3.1
  62. // or allow reduced size packets: https://tools.ietf.org/html/rfc5506
  63. // Receiving accepts both compound and reduced-size packets.
  64. RtcpMode rtcp_mode = RtcpMode::kCompound;
  65. //
  66. // Tuning parameters.
  67. //
  68. // Initial state if |outgoing_transport| ready to accept packets.
  69. bool initial_ready_to_send = true;
  70. // Delay before 1st periodic compound packet.
  71. int initial_report_delay_ms = 500;
  72. // Period between periodic compound packets.
  73. int report_period_ms = 1000;
  74. //
  75. // Flags for features and experiments.
  76. //
  77. bool schedule_periodic_compound_packets = true;
  78. // Estimate RTT as non-sender as described in
  79. // https://tools.ietf.org/html/rfc3611#section-4.4 and #section-4.5
  80. bool non_sender_rtt_measurement = false;
  81. // Allows a REMB message to be sent immediately when SetRemb is called without
  82. // having to wait for the next compount message to be sent.
  83. bool send_remb_on_change = false;
  84. };
  85. } // namespace webrtc
  86. #endif // MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_