blob: ec62aeb2ed18de61473001ed51be83352922146b [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.orgf6bb77a2012-01-24 17:16:59 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_
12#define MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <stddef.h>
15#include <stdint.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020016
nisse14adba72017-03-20 03:52:39 -070017#include <memory>
danilchapb8b6fbb2015-12-10 05:05:27 -080018#include <set>
Steve Anton296a0ce2018-03-22 15:17:27 -070019#include <string>
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000020#include <vector>
niklase@google.com470e71d2011-07-07 08:21:25 +000021
Danil Chapovalovd264df52018-06-14 12:59:38 +020022#include "absl/types/optional.h"
Yves Gerey988cc082018-10-23 12:03:01 +020023#include "api/rtp_headers.h"
Erik Språngeeaa8f92018-05-17 12:35:56 +020024#include "api/video/video_bitrate_allocation.h"
Yves Gerey988cc082018-10-23 12:03:01 +020025#include "modules/include/module_common_types.h"
26#include "modules/include/module_fec_types.h"
27#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020028#include "modules/rtp_rtcp/include/rtp_rtcp.h"
Yves Gerey988cc082018-10-23 12:03:01 +020029#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" // RTCPPacketType
Yves Gerey988cc082018-10-23 12:03:01 +020030#include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020031#include "modules/rtp_rtcp/source/rtcp_receiver.h"
32#include "modules/rtp_rtcp/source/rtcp_sender.h"
Erik Språng9c771c22019-06-17 16:31:53 +020033#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020034#include "modules/rtp_rtcp/source/rtp_sender.h"
Steve Anton10542f22019-01-11 09:11:00 -080035#include "rtc_base/critical_section.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020036#include "rtc_base/gtest_prod_util.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000037
niklase@google.com470e71d2011-07-07 08:21:25 +000038namespace webrtc {
39
Yves Gerey988cc082018-10-23 12:03:01 +020040class Clock;
41struct PacedPacketInfo;
42struct RTPVideoHeader;
43
danilchap59cb2bd2016-08-29 11:08:47 -070044class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +000045 public:
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000046 explicit ModuleRtpRtcpImpl(const RtpRtcp::Configuration& configuration);
Danil Chapovalov2a5ce2b2018-02-07 09:38:31 +010047 ~ModuleRtpRtcpImpl() override;
niklase@google.com470e71d2011-07-07 08:21:25 +000048
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000049 // Returns the number of milliseconds until the module want a worker thread to
50 // call Process.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000051 int64_t TimeUntilNextProcess() override;
niklase@google.com470e71d2011-07-07 08:21:25 +000052
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000053 // Process any pending tasks such as timeouts.
pbosa26ac922016-02-25 04:50:01 -080054 void Process() override;
niklase@google.com470e71d2011-07-07 08:21:25 +000055
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000056 // Receiver part.
niklase@google.com470e71d2011-07-07 08:21:25 +000057
stefan@webrtc.orga5cb98c2013-05-29 12:12:51 +000058 // Called when we receive an RTCP packet.
nisse479d3d72017-09-13 07:53:37 -070059 void IncomingRtcpPacket(const uint8_t* incoming_packet,
60 size_t incoming_packet_length) override;
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +000061
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000062 void SetRemoteSSRC(uint32_t ssrc) override;
wu@webrtc.org822fbd82013-08-15 23:38:54 +000063
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000064 // Sender part.
Niels Möller5fe95102019-03-04 16:49:25 +010065 void RegisterSendPayloadFrequency(int payload_type,
66 int payload_frequency) override;
Peter Boström8b79b072016-02-26 16:31:37 +010067
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000068 int32_t DeRegisterSendPayload(int8_t payload_type) override;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +000069
Johannes Kron9190b822018-10-29 11:22:05 +010070 void SetExtmapAllowMixed(bool extmap_allow_mixed) override;
71
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000072 // Register RTP header extension.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000073 int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type,
74 uint8_t id) override;
Danil Chapovalov585d1aa2018-09-14 18:29:32 +020075 bool RegisterRtpHeaderExtension(const std::string& uri, int id) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000076
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000077 int32_t DeregisterSendRtpHeaderExtension(RTPExtensionType type) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000078
Mirko Bonadei66147e82019-07-12 08:37:30 +000079 bool HasBweExtensions() const override;
stefan53b6cc32017-02-03 08:13:57 -080080
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000081 // Get start timestamp.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000082 uint32_t StartTimestamp() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +000083
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000084 // Configure start timestamp, default is a random number.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000085 void SetStartTimestamp(uint32_t timestamp) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000086
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000087 uint16_t SequenceNumber() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +000088
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000089 // Set SequenceNumber, default is a random number.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000090 void SetSequenceNumber(uint16_t seq) override;
niklase@google.com470e71d2011-07-07 08:21:25 +000091
Per83d09102016-04-15 14:59:13 +020092 void SetRtpState(const RtpState& rtp_state) override;
93 void SetRtxState(const RtpState& rtp_state) override;
94 RtpState GetRtpState() const override;
95 RtpState GetRtxState() const override;
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000096
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000097 uint32_t SSRC() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +000098
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +000099 // Configure SSRC, default is a random number.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000100 void SetSSRC(uint32_t ssrc) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000101
Amit Hilbuch77938e62018-12-21 09:23:38 -0800102 void SetRid(const std::string& rid) override;
103
Steve Anton296a0ce2018-03-22 15:17:27 -0700104 void SetMid(const std::string& mid) override;
105
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000106 void SetCsrcs(const std::vector<uint32_t>& csrcs) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000107
henrik.lundin@webrtc.org1972ff82014-09-11 06:20:28 +0000108 RTCPSender::FeedbackState GetFeedbackState();
niklase@google.com470e71d2011-07-07 08:21:25 +0000109
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000110 void SetRtxSendStatus(int mode) override;
111 int RtxSendStatus() const override;
mflodman@webrtc.org9f5ebb52013-04-12 14:55:46 +0000112
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000113 void SetRtxSsrc(uint32_t ssrc) override;
mflodman@webrtc.org9f5ebb52013-04-12 14:55:46 +0000114
Shao Changbine62202f2015-04-21 20:24:50 +0800115 void SetRtxSendPayloadType(int payload_type,
116 int associated_payload_type) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000117
Danil Chapovalovd264df52018-06-14 12:59:38 +0200118 absl::optional<uint32_t> FlexfecSsrc() const override;
brandtr9dfff292016-11-14 05:14:50 -0800119
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000120 // Sends kRtcpByeCode when going from true to false.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000121 int32_t SetSendingStatus(bool sending) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000122
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000123 bool Sending() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000124
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000125 // Drops or relays media packets.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000126 void SetSendingMediaStatus(bool sending) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000127
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000128 bool SendingMedia() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000129
Sebastian Jansson1bca65b2018-10-10 09:58:08 +0200130 void SetAsPartOfAllocation(bool part_of_allocation) override;
131
Niels Möller5fe95102019-03-04 16:49:25 +0100132 bool OnSendingRtpFrame(uint32_t timestamp,
133 int64_t capture_time_ms,
134 int payload_type,
135 bool force_sender_report) override;
136
Erik Språngd2879622019-05-10 08:29:01 -0700137 RtpPacketSendResult TimeToSendPacket(
138 uint32_t ssrc,
139 uint16_t sequence_number,
140 int64_t capture_time_ms,
141 bool retransmission,
142 const PacedPacketInfo& pacing_info) override;
asapersson@webrtc.org9ffd8fe2015-01-21 08:22:50 +0000143
Erik Språng9c771c22019-06-17 16:31:53 +0200144 bool TrySendPacket(RtpPacketToSend* packet,
145 const PacedPacketInfo& pacing_info) override;
146
stefan@webrtc.org508a84b2013-06-17 12:53:37 +0000147 // Returns the number of padding bytes actually sent, which can be more or
148 // less than |bytes|.
philipelc7bf32a2017-02-17 03:59:43 -0800149 size_t TimeToSendPadding(size_t bytes,
150 const PacedPacketInfo& pacing_info) override;
stefan@webrtc.org0a3c1472013-12-05 14:05:07 +0000151
Erik Språngf6468d22019-07-05 16:53:43 +0200152 std::vector<std::unique_ptr<RtpPacketToSend>> GeneratePadding(
153 size_t target_size_bytes) override;
Erik Språng478cb462019-06-26 15:49:27 +0200154
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000155 // RTCP part.
niklase@google.com470e71d2011-07-07 08:21:25 +0000156
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000157 // Get RTCP status.
pbosda903ea2015-10-02 02:36:56 -0700158 RtcpMode RTCP() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000159
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000160 // Configure RTCP status i.e on/off.
pbosda903ea2015-10-02 02:36:56 -0700161 void SetRTCPStatus(RtcpMode method) override;
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000162
163 // Set RTCP CName.
Peter Boström9ba52f82015-06-01 14:12:28 +0200164 int32_t SetCNAME(const char* c_name) override;
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000165
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000166 // Get remote CName.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000167 int32_t RemoteCNAME(uint32_t remote_ssrc,
168 char c_name[RTCP_CNAME_SIZE]) const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000169
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000170 // Get remote NTP.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000171 int32_t RemoteNTP(uint32_t* received_ntp_secs,
172 uint32_t* received_ntp_frac,
173 uint32_t* rtcp_arrival_time_secs,
174 uint32_t* rtcp_arrival_time_frac,
175 uint32_t* rtcp_timestamp) const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000176
Erik Språng0ea42d32015-06-25 14:46:16 +0200177 int32_t AddMixedCNAME(uint32_t ssrc, const char* c_name) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000178
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000179 int32_t RemoveMixedCNAME(uint32_t ssrc) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000180
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000181 // Get RoundTripTime.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000182 int32_t RTT(uint32_t remote_ssrc,
183 int64_t* rtt,
184 int64_t* avg_rtt,
185 int64_t* min_rtt,
186 int64_t* max_rtt) const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000187
Niels Möller5fe95102019-03-04 16:49:25 +0100188 int64_t ExpectedRetransmissionTimeMs() const override;
189
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000190 // Force a send of an RTCP packet.
191 // Normal SR and RR are triggered via the process function.
Erik Språng242e22b2015-05-11 10:17:43 +0200192 int32_t SendRTCP(RTCPPacketType rtcpPacketType) override;
193
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000194 // Statistics of the amount of data sent and received.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000195 int32_t DataCountersRTP(size_t* bytes_sent,
196 uint32_t* packets_sent) const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000197
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000198 void GetSendStreamDataCounters(
asapersson@webrtc.org97d04892014-12-09 09:47:53 +0000199 StreamDataCounters* rtp_counters,
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000200 StreamDataCounters* rtx_counters) const override;
asapersson@webrtc.org97d04892014-12-09 09:47:53 +0000201
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000202 // Get received RTCP report, report block.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000203 int32_t RemoteRTCPStat(
204 std::vector<RTCPReportBlock>* receive_blocks) const override;
Henrik Boström6e436d12019-05-27 12:19:33 +0200205 // A snapshot of the most recent Report Block with additional data of
206 // interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
207 // Within this list, the ReportBlockData::RTCPReportBlock::source_ssrc(),
208 // which is the SSRC of the corresponding outbound RTP stream, is unique.
209 std::vector<ReportBlockData> GetLatestReportBlockData() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000210
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000211 // (REMB) Receiver Estimated Max Bitrate.
Danil Chapovalov1de4b622017-12-13 13:35:10 +0100212 void SetRemb(int64_t bitrate_bps, std::vector<uint32_t> ssrcs) override;
Danil Chapovalov51e21aa2017-10-10 17:46:26 +0200213 void UnsetRemb() override;
pwestin@webrtc.org741da942011-09-20 13:52:04 +0000214
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000215 // (TMMBR) Temporary Max Media Bit Rate.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000216 bool TMMBR() const override;
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000217
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000218 void SetTMMBRStatus(bool enable) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000219
danilchap59cb2bd2016-08-29 11:08:47 -0700220 void SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000221
nisse284542b2017-01-10 08:58:32 -0800222 size_t MaxRtpPacketSize() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000223
nisse284542b2017-01-10 08:58:32 -0800224 void SetMaxRtpPacketSize(size_t max_packet_size) override;
michaelt79e05882016-11-08 02:50:09 -0800225
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000226 // (NACK) Negative acknowledgment part.
niklase@google.com470e71d2011-07-07 08:21:25 +0000227
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000228 // Send a Negative acknowledgment packet.
philipel83f831a2016-03-12 03:30:23 -0800229 // TODO(philipel): Deprecate SendNACK and use SendNack instead.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000230 int32_t SendNACK(const uint16_t* nack_list, uint16_t size) override;
stefan@webrtc.org6a4bef42011-12-22 12:52:41 +0000231
philipel83f831a2016-03-12 03:30:23 -0800232 void SendNack(const std::vector<uint16_t>& sequence_numbers) override;
233
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000234 // Store the sent packets, needed to answer to a negative acknowledgment
235 // requests.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000236 void SetStorePacketsStatus(bool enable, uint16_t number_to_store) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000237
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000238 bool StorePackets() const override;
wu@webrtc.org822fbd82013-08-15 23:38:54 +0000239
sprang@webrtc.orga6ad6e52013-12-05 09:48:44 +0000240 // Called on receipt of RTCP report block from remote side.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000241 void RegisterRtcpStatisticsCallback(
242 RtcpStatisticsCallback* callback) override;
243 RtcpStatisticsCallback* GetRtcpStatisticsCallback() override;
Henrik Boström87e3f9d2019-05-27 10:44:24 +0200244 void SetReportBlockDataObserver(ReportBlockDataObserver* observer) override;
sprang@webrtc.orga6ad6e52013-12-05 09:48:44 +0000245
sprang233bd872015-09-08 13:25:16 -0700246 bool SendFeedbackPacket(const rtcp::TransportFeedback& packet) override;
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000247 // (APP) Application specific data.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000248 int32_t SetRTCPApplicationSpecificData(uint8_t sub_type,
249 uint32_t name,
250 const uint8_t* data,
251 uint16_t length) override;
niklase@google.com470e71d2011-07-07 08:21:25 +0000252
asapersson@webrtc.org7d6bd222013-10-31 12:14:34 +0000253 // (XR) Receiver reference time report.
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000254 void SetRtcpXrRrtrStatus(bool enable) override;
asapersson@webrtc.org7d6bd222013-10-31 12:14:34 +0000255
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000256 bool RtcpXrRrtrStatus() const override;
asapersson@webrtc.org8d02f5d2013-11-21 08:57:04 +0000257
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000258 // Video part.
Elad Alon7d6a4c02019-02-25 13:00:51 +0100259 int32_t SendLossNotification(uint16_t last_decoded_seq_num,
260 uint16_t last_received_seq_num,
Elad Alone86af2c2019-06-03 14:37:50 +0200261 bool decodability_flag,
262 bool buffering_allowed) override;
Elad Alon7d6a4c02019-02-25 13:00:51 +0100263
henrik.lundin@webrtc.org1972ff82014-09-11 06:20:28 +0000264 bool LastReceivedNTP(uint32_t* NTPsecs,
265 uint32_t* NTPfrac,
266 uint32_t* remote_sr) const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000267
danilchap2b616392016-08-18 06:17:42 -0700268 std::vector<rtcp::TmmbItem> BoundingSet(bool* tmmbr_owner);
niklase@google.com470e71d2011-07-07 08:21:25 +0000269
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000270 void BitrateSent(uint32_t* total_rate,
271 uint32_t* video_rate,
272 uint32_t* fec_rate,
273 uint32_t* nackRate) const override;
stefan@webrtc.org07b45a52012-02-02 08:37:48 +0000274
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000275 void RegisterSendChannelRtpStatisticsCallback(
276 StreamDataCountersCallback* callback) override;
277 StreamDataCountersCallback* GetSendChannelRtpStatisticsCallback()
278 const override;
sprang@webrtc.orgebad7652013-12-05 14:29:02 +0000279
danilchap59cb2bd2016-08-29 11:08:47 -0700280 void OnReceivedNack(
281 const std::vector<uint16_t>& nack_sequence_numbers) override;
282 void OnReceivedRtcpReportBlocks(
283 const ReportBlockList& report_blocks) override;
284 void OnRequestSendReport() override;
henrike@webrtc.orgf5da4da2012-02-15 23:54:59 +0000285
Erik Språng566124a2018-04-23 12:32:22 +0200286 void SetVideoBitrateAllocation(
287 const VideoBitrateAllocation& bitrate) override;
sprang5e38c962016-12-01 05:18:09 -0800288
Niels Möller5fe95102019-03-04 16:49:25 +0100289 RTPSender* RtpSender() override;
290 const RTPSender* RtpSender() const override;
291
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000292 protected:
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000293 bool UpdateRTCPReceiveInformationTimers();
niklase@google.com470e71d2011-07-07 08:21:25 +0000294
nisse14adba72017-03-20 03:52:39 -0700295 RTPSender* rtp_sender() { return rtp_sender_.get(); }
296 const RTPSender* rtp_sender() const { return rtp_sender_.get(); }
nissea33c62e2017-03-14 00:49:45 -0700297
298 RTCPSender* rtcp_sender() { return &rtcp_sender_; }
299 const RTCPSender* rtcp_sender() const { return &rtcp_sender_; }
300
301 RTCPReceiver* rtcp_receiver() { return &rtcp_receiver_; }
302 const RTCPReceiver* rtcp_receiver() const { return &rtcp_receiver_; }
303
Sebastian Janssonaa01f272019-01-30 11:28:59 +0100304 Clock* clock() const { return clock_; }
nissea33c62e2017-03-14 00:49:45 -0700305
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000306 private:
asapersson@webrtc.orge7b1e112013-12-16 14:40:36 +0000307 FRIEND_TEST_ALL_PREFIXES(RtpRtcpImplTest, Rtt);
asapersson@webrtc.org1ae1d0c2013-11-20 12:46:11 +0000308 FRIEND_TEST_ALL_PREFIXES(RtpRtcpImplTest, RttForReceiverOnly);
stefan@webrtc.org28a331e2013-09-17 07:49:56 +0000309 void SetRtcpReceiverSsrcs(uint32_t main_ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +0000310
pkasting@chromium.org16825b12015-01-12 21:51:21 +0000311 void set_rtt_ms(int64_t rtt_ms);
312 int64_t rtt_ms() const;
asapersson@webrtc.org1ae1d0c2013-11-20 12:46:11 +0000313
asapersson@webrtc.orgba8138b2014-12-08 13:29:02 +0000314 bool TimeToSendFullNackList(int64_t now) const;
315
nisse14adba72017-03-20 03:52:39 -0700316 std::unique_ptr<RTPSender> rtp_sender_;
nisse150708e2017-03-16 05:02:53 -0700317 RTCPSender rtcp_sender_;
318 RTCPReceiver rtcp_receiver_;
319
Sebastian Janssonaa01f272019-01-30 11:28:59 +0100320 Clock* const clock_;
nisse150708e2017-03-16 05:02:53 -0700321
asapersson@webrtc.org9ffd8fe2015-01-21 08:22:50 +0000322 int64_t last_bitrate_process_time_;
323 int64_t last_rtt_process_time_;
sprang168794c2017-07-06 04:38:06 -0700324 int64_t next_process_time_;
asapersson@webrtc.org9ffd8fe2015-01-21 08:22:50 +0000325 uint16_t packet_overhead_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000326
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000327 // Send side
Danil Chapovalov9eb6ce12017-12-15 12:25:01 +0100328 int64_t nack_last_time_sent_full_ms_;
asapersson@webrtc.orgba8138b2014-12-08 13:29:02 +0000329 uint16_t nack_last_seq_number_sent_;
stefan@webrtc.org9354cc92012-06-07 08:10:14 +0000330
Niels Möller5fe95102019-03-04 16:49:25 +0100331 RemoteBitrateEstimator* const remote_bitrate_;
332
333 RtcpAckObserver* const ack_observer_;
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000334
Tommi5f223652018-03-26 13:28:26 +0200335 RtcpRttStats* const rtt_stats_;
asapersson@webrtc.org1ae1d0c2013-11-20 12:46:11 +0000336
337 // The processed RTT from RtcpRttStats.
danilchap7c9426c2016-04-14 03:05:31 -0700338 rtc::CriticalSection critical_section_rtt_;
pkasting@chromium.org16825b12015-01-12 21:51:21 +0000339 int64_t rtt_ms_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000340};
phoglund@webrtc.orgacfdd962013-01-16 10:27:33 +0000341
342} // namespace webrtc
343
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200344#endif // MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_