Danil Chapovalov | 398a7c6 | 2017-10-24 17:07:05 +0200 | [diff] [blame] | 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 | |
| 11 | #ifndef MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_ |
| 12 | #define MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_ |
| 13 | |
| 14 | #include <string> |
| 15 | |
Erik Språng | eeaa8f9 | 2018-05-17 12:35:56 +0200 | [diff] [blame] | 16 | #include "api/rtp_headers.h" |
Danil Chapovalov | f351cff | 2020-03-05 15:43:24 +0100 | [diff] [blame] | 17 | #include "api/task_queue/task_queue_base.h" |
Erik Språng | eeaa8f9 | 2018-05-17 12:35:56 +0200 | [diff] [blame] | 18 | #include "api/video/video_bitrate_allocation.h" |
Danil Chapovalov | a7e418c | 2017-11-21 11:08:53 +0100 | [diff] [blame] | 19 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
Paul Hallak | e9dad5f | 2021-04-08 13:58:23 +0200 | [diff] [blame] | 20 | #include "system_wrappers/include/clock.h" |
Erik Språng | eeaa8f9 | 2018-05-17 12:35:56 +0200 | [diff] [blame] | 21 | #include "system_wrappers/include/ntp_time.h" |
Danil Chapovalov | 8c8d49e | 2017-10-30 15:21:41 +0100 | [diff] [blame] | 22 | |
Danil Chapovalov | 398a7c6 | 2017-10-24 17:07:05 +0200 | [diff] [blame] | 23 | namespace webrtc { |
| 24 | class ReceiveStatisticsProvider; |
| 25 | class Transport; |
| 26 | |
Danil Chapovalov | 7ca9ae2 | 2017-12-13 12:26:17 +0100 | [diff] [blame] | 27 | // Interface to watch incoming rtcp packets by media (rtp) receiver. |
| 28 | class MediaReceiverRtcpObserver { |
| 29 | public: |
| 30 | virtual ~MediaReceiverRtcpObserver() = default; |
| 31 | |
Magnus Flodman | 55afe38 | 2020-06-12 14:55:40 +0200 | [diff] [blame] | 32 | // All message handlers have default empty implementation. This way users only |
| 33 | // need to implement the ones they are interested in. |
Danil Chapovalov | 7ca9ae2 | 2017-12-13 12:26:17 +0100 | [diff] [blame] | 34 | virtual void OnSenderReport(uint32_t sender_ssrc, |
| 35 | NtpTime ntp_time, |
| 36 | uint32_t rtp_time) {} |
| 37 | virtual void OnBye(uint32_t sender_ssrc) {} |
| 38 | virtual void OnBitrateAllocation(uint32_t sender_ssrc, |
Erik Språng | 566124a | 2018-04-23 12:32:22 +0200 | [diff] [blame] | 39 | const VideoBitrateAllocation& allocation) {} |
Danil Chapovalov | 7ca9ae2 | 2017-12-13 12:26:17 +0100 | [diff] [blame] | 40 | }; |
| 41 | |
Danil Chapovalov | 398a7c6 | 2017-10-24 17:07:05 +0200 | [diff] [blame] | 42 | struct RtcpTransceiverConfig { |
| 43 | RtcpTransceiverConfig(); |
| 44 | RtcpTransceiverConfig(const RtcpTransceiverConfig&); |
| 45 | RtcpTransceiverConfig& operator=(const RtcpTransceiverConfig&); |
| 46 | ~RtcpTransceiverConfig(); |
| 47 | |
| 48 | // Logs the error and returns false if configuration miss key objects or |
| 49 | // is inconsistant. May log warnings. |
| 50 | bool Validate() const; |
| 51 | |
| 52 | // Used to prepend all log messages. Can be empty. |
| 53 | std::string debug_id; |
| 54 | |
| 55 | // Ssrc to use as default sender ssrc, e.g. for transport-wide feedbacks. |
| 56 | uint32_t feedback_ssrc = 1; |
| 57 | |
Danil Chapovalov | 78161ca | 2017-10-26 12:09:41 +0200 | [diff] [blame] | 58 | // Canonical End-Point Identifier of the local particiapnt. |
| 59 | // Defined in rfc3550 section 6 note 2 and section 6.5.1. |
Danil Chapovalov | 398a7c6 | 2017-10-24 17:07:05 +0200 | [diff] [blame] | 60 | std::string cname; |
| 61 | |
| 62 | // Maximum packet size outgoing transport accepts. |
| 63 | size_t max_packet_size = 1200; |
| 64 | |
Paul Hallak | e9dad5f | 2021-04-08 13:58:23 +0200 | [diff] [blame] | 65 | // The clock to use when querying for the NTP time. Should be set. |
| 66 | Clock* clock = nullptr; |
| 67 | |
Danil Chapovalov | 398a7c6 | 2017-10-24 17:07:05 +0200 | [diff] [blame] | 68 | // Transport to send rtcp packets to. Should be set. |
| 69 | Transport* outgoing_transport = nullptr; |
| 70 | |
Danil Chapovalov | 8c8d49e | 2017-10-30 15:21:41 +0100 | [diff] [blame] | 71 | // Queue for scheduling delayed tasks, e.g. sending periodic compound packets. |
Danil Chapovalov | f351cff | 2020-03-05 15:43:24 +0100 | [diff] [blame] | 72 | TaskQueueBase* task_queue = nullptr; |
Danil Chapovalov | 398a7c6 | 2017-10-24 17:07:05 +0200 | [diff] [blame] | 73 | |
| 74 | // Rtcp report block generator for outgoing receiver reports. |
| 75 | ReceiveStatisticsProvider* receive_statistics = nullptr; |
Danil Chapovalov | 8c8d49e | 2017-10-30 15:21:41 +0100 | [diff] [blame] | 76 | |
Danil Chapovalov | 319a675 | 2017-11-30 14:56:52 +0100 | [diff] [blame] | 77 | // Callback to pass result of rtt calculation. Should outlive RtcpTransceiver. |
| 78 | // Callbacks will be invoked on the task_queue. |
| 79 | RtcpRttStats* rtt_observer = nullptr; |
| 80 | |
Danil Chapovalov | a7e418c | 2017-11-21 11:08:53 +0100 | [diff] [blame] | 81 | // Configures if sending should |
| 82 | // enforce compound packets: https://tools.ietf.org/html/rfc4585#section-3.1 |
| 83 | // or allow reduced size packets: https://tools.ietf.org/html/rfc5506 |
| 84 | // Receiving accepts both compound and reduced-size packets. |
| 85 | RtcpMode rtcp_mode = RtcpMode::kCompound; |
Danil Chapovalov | 8c8d49e | 2017-10-30 15:21:41 +0100 | [diff] [blame] | 86 | // |
| 87 | // Tuning parameters. |
| 88 | // |
Danil Chapovalov | e3927c5 | 2018-03-06 14:33:20 +0100 | [diff] [blame] | 89 | // Initial state if |outgoing_transport| ready to accept packets. |
| 90 | bool initial_ready_to_send = true; |
Danil Chapovalov | 8c8d49e | 2017-10-30 15:21:41 +0100 | [diff] [blame] | 91 | // Delay before 1st periodic compound packet. |
| 92 | int initial_report_delay_ms = 500; |
| 93 | |
| 94 | // Period between periodic compound packets. |
| 95 | int report_period_ms = 1000; |
| 96 | |
| 97 | // |
| 98 | // Flags for features and experiments. |
| 99 | // |
| 100 | bool schedule_periodic_compound_packets = true; |
Danil Chapovalov | 319a675 | 2017-11-30 14:56:52 +0100 | [diff] [blame] | 101 | // Estimate RTT as non-sender as described in |
| 102 | // https://tools.ietf.org/html/rfc3611#section-4.4 and #section-4.5 |
| 103 | bool non_sender_rtt_measurement = false; |
Per Kjellander | c93595b | 2020-02-27 13:20:55 +0100 | [diff] [blame] | 104 | |
| 105 | // Allows a REMB message to be sent immediately when SetRemb is called without |
| 106 | // having to wait for the next compount message to be sent. |
| 107 | bool send_remb_on_change = false; |
Danil Chapovalov | 398a7c6 | 2017-10-24 17:07:05 +0200 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | } // namespace webrtc |
| 111 | |
| 112 | #endif // MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_ |