blob: 0501b9af7f526e22af7267c79b11a2f717beba7f [file] [log] [blame]
Danil Chapovalov398a7c62017-10-24 17:07:05 +02001/*
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ångeeaa8f92018-05-17 12:35:56 +020016#include "api/rtp_headers.h"
Danil Chapovalovf351cff2020-03-05 15:43:24 +010017#include "api/task_queue/task_queue_base.h"
Erik Språngeeaa8f92018-05-17 12:35:56 +020018#include "api/video/video_bitrate_allocation.h"
Danil Chapovalova7e418c2017-11-21 11:08:53 +010019#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Paul Hallake9dad5f2021-04-08 13:58:23 +020020#include "system_wrappers/include/clock.h"
Erik Språngeeaa8f92018-05-17 12:35:56 +020021#include "system_wrappers/include/ntp_time.h"
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010022
Danil Chapovalov398a7c62017-10-24 17:07:05 +020023namespace webrtc {
24class ReceiveStatisticsProvider;
25class Transport;
26
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010027// Interface to watch incoming rtcp packets by media (rtp) receiver.
28class MediaReceiverRtcpObserver {
29 public:
30 virtual ~MediaReceiverRtcpObserver() = default;
31
Magnus Flodman55afe382020-06-12 14:55:40 +020032 // All message handlers have default empty implementation. This way users only
33 // need to implement the ones they are interested in.
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010034 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ång566124a2018-04-23 12:32:22 +020039 const VideoBitrateAllocation& allocation) {}
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010040};
41
Danil Chapovalov398a7c62017-10-24 17:07:05 +020042struct 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 Chapovalov78161ca2017-10-26 12:09:41 +020058 // Canonical End-Point Identifier of the local particiapnt.
59 // Defined in rfc3550 section 6 note 2 and section 6.5.1.
Danil Chapovalov398a7c62017-10-24 17:07:05 +020060 std::string cname;
61
62 // Maximum packet size outgoing transport accepts.
63 size_t max_packet_size = 1200;
64
Paul Hallake9dad5f2021-04-08 13:58:23 +020065 // The clock to use when querying for the NTP time. Should be set.
66 Clock* clock = nullptr;
67
Danil Chapovalov398a7c62017-10-24 17:07:05 +020068 // Transport to send rtcp packets to. Should be set.
69 Transport* outgoing_transport = nullptr;
70
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010071 // Queue for scheduling delayed tasks, e.g. sending periodic compound packets.
Danil Chapovalovf351cff2020-03-05 15:43:24 +010072 TaskQueueBase* task_queue = nullptr;
Danil Chapovalov398a7c62017-10-24 17:07:05 +020073
74 // Rtcp report block generator for outgoing receiver reports.
75 ReceiveStatisticsProvider* receive_statistics = nullptr;
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010076
Danil Chapovalov319a6752017-11-30 14:56:52 +010077 // 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 Chapovalova7e418c2017-11-21 11:08:53 +010081 // 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 Chapovalov8c8d49e2017-10-30 15:21:41 +010086 //
87 // Tuning parameters.
88 //
Danil Chapovalove3927c52018-03-06 14:33:20 +010089 // Initial state if |outgoing_transport| ready to accept packets.
90 bool initial_ready_to_send = true;
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010091 // 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 Chapovalov319a6752017-11-30 14:56:52 +0100101 // 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 Kjellanderc93595b2020-02-27 13:20:55 +0100104
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 Chapovalov398a7c62017-10-24 17:07:05 +0200108};
109
110} // namespace webrtc
111
112#endif // MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_