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