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