blob: 8a8fd6aed8f8c817898e92b38c1f22b4ca67671a [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"
Erik Språngeeaa8f92018-05-17 12:35:56 +020020#include "system_wrappers/include/ntp_time.h"
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010021
Danil Chapovalov398a7c62017-10-24 17:07:05 +020022namespace webrtc {
23class ReceiveStatisticsProvider;
24class Transport;
25
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010026// Interface to watch incoming rtcp packets by media (rtp) receiver.
27class MediaReceiverRtcpObserver {
28 public:
29 virtual ~MediaReceiverRtcpObserver() = default;
30
Magnus Flodman55afe382020-06-12 14:55:40 +020031 // All message handlers have default empty implementation. This way users only
32 // need to implement the ones they are interested in.
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010033 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ång566124a2018-04-23 12:32:22 +020038 const VideoBitrateAllocation& allocation) {}
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010039};
40
Danil Chapovalov398a7c62017-10-24 17:07:05 +020041struct 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 Chapovalov78161ca2017-10-26 12:09:41 +020057 // Canonical End-Point Identifier of the local particiapnt.
58 // Defined in rfc3550 section 6 note 2 and section 6.5.1.
Danil Chapovalov398a7c62017-10-24 17:07:05 +020059 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 Chapovalov8c8d49e2017-10-30 15:21:41 +010067 // Queue for scheduling delayed tasks, e.g. sending periodic compound packets.
Danil Chapovalovf351cff2020-03-05 15:43:24 +010068 TaskQueueBase* task_queue = nullptr;
Danil Chapovalov398a7c62017-10-24 17:07:05 +020069
70 // Rtcp report block generator for outgoing receiver reports.
71 ReceiveStatisticsProvider* receive_statistics = nullptr;
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010072
Danil Chapovalov319a6752017-11-30 14:56:52 +010073 // 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 Chapovalova7e418c2017-11-21 11:08:53 +010077 // 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 Chapovalov8c8d49e2017-10-30 15:21:41 +010082 //
83 // Tuning parameters.
84 //
Danil Chapovalove3927c52018-03-06 14:33:20 +010085 // Initial state if |outgoing_transport| ready to accept packets.
86 bool initial_ready_to_send = true;
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010087 // 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 Chapovalov319a6752017-11-30 14:56:52 +010097 // 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 Kjellanderc93595b2020-02-27 13:20:55 +0100100
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 Chapovalov398a7c62017-10-24 17:07:05 +0200104};
105
106} // namespace webrtc
107
108#endif // MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_