blob: 8a4a4c4cea626947d351e4e0df29580a9998475c [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
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010016#include "common_types.h" // NOLINT(build/include)
Danil Chapovalova7e418c2017-11-21 11:08:53 +010017#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010018#include "rtc_base/task_queue.h"
19
Danil Chapovalov398a7c62017-10-24 17:07:05 +020020namespace webrtc {
21class ReceiveStatisticsProvider;
22class Transport;
23
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010024// Interface to watch incoming rtcp packets by media (rtp) receiver.
25class 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ång566124a2018-04-23 12:32:22 +020036 const VideoBitrateAllocation& allocation) {}
Danil Chapovalov7ca9ae22017-12-13 12:26:17 +010037};
38
Danil Chapovalov398a7c62017-10-24 17:07:05 +020039struct 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 Chapovalov78161ca2017-10-26 12:09:41 +020055 // Canonical End-Point Identifier of the local particiapnt.
56 // Defined in rfc3550 section 6 note 2 and section 6.5.1.
Danil Chapovalov398a7c62017-10-24 17:07:05 +020057 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 Chapovalov8c8d49e2017-10-30 15:21:41 +010065 // Queue for scheduling delayed tasks, e.g. sending periodic compound packets.
66 rtc::TaskQueue* task_queue = nullptr;
Danil Chapovalov398a7c62017-10-24 17:07:05 +020067
68 // Rtcp report block generator for outgoing receiver reports.
69 ReceiveStatisticsProvider* receive_statistics = nullptr;
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010070
Danil Chapovalov319a6752017-11-30 14:56:52 +010071 // 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 Chapovalova7e418c2017-11-21 11:08:53 +010075 // 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 Chapovalov8c8d49e2017-10-30 15:21:41 +010080 //
81 // Tuning parameters.
82 //
Danil Chapovalove3927c52018-03-06 14:33:20 +010083 // Initial state if |outgoing_transport| ready to accept packets.
84 bool initial_ready_to_send = true;
Danil Chapovalov8c8d49e2017-10-30 15:21:41 +010085 // 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 Chapovalov319a6752017-11-30 14:56:52 +010095 // 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 Chapovalov49456a52018-01-30 09:56:23 +010098 // 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 Chapovalov398a7c62017-10-24 17:07:05 +0200103};
104
105} // namespace webrtc
106
107#endif // MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_CONFIG_H_