blob: c0af3400c6749ad5acfda479246ea787e72675c3 [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_SENDER_H_
12#define MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_
pbos@webrtc.org12dc1a32013-08-05 16:22:53 +000013
pwestin@webrtc.org00741872012-01-19 15:56:10 +000014#include <map>
kwiberg84be5112016-04-27 01:19:58 -070015#include <memory>
Steve Anton296a0ce2018-03-22 15:17:27 -070016#include <string>
danilchapb8b6fbb2015-12-10 05:05:27 -080017#include <utility>
18#include <vector>
pwestin@webrtc.org00741872012-01-19 15:56:10 +000019
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "api/array_view.h"
21#include "api/call/transport.h"
22#include "api/optional.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020023#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020024#include "modules/rtp_rtcp/include/flexfec_sender.h"
25#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
26#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Steve Anton296a0ce2018-03-22 15:17:27 -070027#include "modules/rtp_rtcp/source/mid_oracle.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020028#include "modules/rtp_rtcp/source/playout_delay_oracle.h"
29#include "modules/rtp_rtcp/source/rtp_packet_history.h"
30#include "modules/rtp_rtcp/source/rtp_rtcp_config.h"
31#include "modules/rtp_rtcp/source/rtp_utility.h"
32#include "rtc_base/constructormagic.h"
33#include "rtc_base/criticalsection.h"
34#include "rtc_base/deprecation.h"
35#include "rtc_base/random.h"
36#include "rtc_base/rate_statistics.h"
37#include "rtc_base/thread_annotations.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000038
niklase@google.com470e71d2011-07-07 08:21:25 +000039namespace webrtc {
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +000040
michaelt4da30442016-11-17 01:38:43 -080041class OverheadObserver;
sprangcd349d92016-07-13 09:11:28 -070042class RateLimiter;
Danil Chapovalov31e4e802016-08-03 18:27:40 +020043class RtcEventLog;
44class RtpPacketToSend;
niklase@google.com470e71d2011-07-07 08:21:25 +000045class RTPSenderAudio;
46class RTPSenderVideo;
47
danilchap5fb291a2016-08-09 07:43:25 -070048class RTPSender {
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +000049 public:
Peter Boströmac547a62015-09-17 23:03:57 +020050 RTPSender(bool audio,
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +000051 Clock* clock,
52 Transport* transport,
sprangebbf8a82015-09-21 15:11:14 -070053 RtpPacketSender* paced_sender,
brandtrdbdb3f12016-11-10 05:04:48 -080054 // TODO(brandtr): Remove |flexfec_sender| when that is hooked up
55 // to PacedSender instead.
56 FlexfecSender* flexfec_sender,
sprangebbf8a82015-09-21 15:11:14 -070057 TransportSequenceNumberAllocator* sequence_number_allocator,
sprang5e023eb2015-09-14 06:42:43 -070058 TransportFeedbackObserver* transport_feedback_callback,
andresp@webrtc.org8f151212014-07-10 09:39:23 +000059 BitrateStatisticsObserver* bitrate_callback,
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000060 FrameCountObserver* frame_count_observer,
terelius429c3452016-01-21 05:42:04 -080061 SendSideDelayObserver* send_side_delay_observer,
asapersson35151f32016-05-02 23:44:01 -070062 RtcEventLog* event_log,
sprangcd349d92016-07-13 09:11:28 -070063 SendPacketObserver* send_packet_observer,
michaelt4da30442016-11-17 01:38:43 -080064 RateLimiter* nack_rate_limiter,
Erik Språng7b52f102018-02-07 14:37:37 +010065 OverheadObserver* overhead_observer,
66 bool populate_network2_timestamp);
asapersson35151f32016-05-02 23:44:01 -070067
danilchap5fb291a2016-08-09 07:43:25 -070068 ~RTPSender();
niklase@google.com470e71d2011-07-07 08:21:25 +000069
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +000070 void ProcessBitrate();
niklase@google.com470e71d2011-07-07 08:21:25 +000071
danilchap5fb291a2016-08-09 07:43:25 -070072 uint16_t ActualSendBitrateKbit() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000073
pbos@webrtc.org2f446732013-04-08 11:08:41 +000074 uint32_t VideoBitrateSent() const;
75 uint32_t FecOverheadRate() const;
76 uint32_t NackOverheadRate() const;
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +000077
Peter Boström8b79b072016-02-26 16:31:37 +010078 int32_t RegisterPayload(const char* payload_name,
79 const int8_t payload_type,
80 const uint32_t frequency,
81 const size_t channels,
82 const uint32_t rate);
niklase@google.com470e71d2011-07-07 08:21:25 +000083
pbos@webrtc.org2f446732013-04-08 11:08:41 +000084 int32_t DeRegisterSendPayload(const int8_t payload_type);
niklase@google.com470e71d2011-07-07 08:21:25 +000085
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +000086 void SetSendingMediaStatus(bool enabled);
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +000087 bool SendingMedia() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000088
pbos@webrtc.org2f4b14e2014-07-15 15:25:39 +000089 void GetDataCounters(StreamDataCounters* rtp_stats,
90 StreamDataCounters* rtx_stats) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000091
danilchap71fead22016-08-18 02:01:49 -070092 uint32_t TimestampOffset() const;
93 void SetTimestampOffset(uint32_t timestamp);
niklase@google.com470e71d2011-07-07 08:21:25 +000094
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +000095 void SetSSRC(uint32_t ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000096
Steve Anton296a0ce2018-03-22 15:17:27 -070097 void SetMid(const std::string& mid);
98
danilchap5fb291a2016-08-09 07:43:25 -070099 uint16_t SequenceNumber() const;
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000100 void SetSequenceNumber(uint16_t seq);
niklase@google.com470e71d2011-07-07 08:21:25 +0000101
pbos@webrtc.org9334ac22014-11-24 08:25:50 +0000102 void SetCsrcs(const std::vector<uint32_t>& csrcs);
niklase@google.com470e71d2011-07-07 08:21:25 +0000103
nisse284542b2017-01-10 08:58:32 -0800104 void SetMaxRtpPacketSize(size_t max_packet_size);
niklase@google.com470e71d2011-07-07 08:21:25 +0000105
Sergey Ulanov525df3f2016-08-02 17:46:41 -0700106 bool SendOutgoingData(FrameType frame_type,
107 int8_t payload_type,
108 uint32_t timestamp,
109 int64_t capture_time_ms,
110 const uint8_t* payload_data,
111 size_t payload_size,
112 const RTPFragmentationHeader* fragmentation,
113 const RTPVideoHeader* rtp_header,
spranga8ae6f22017-09-04 07:23:56 -0700114 uint32_t* transport_frame_id_out,
115 int64_t expected_retransmission_time_ms);
niklase@google.com470e71d2011-07-07 08:21:25 +0000116
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000117 // RTP header extension
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000118 int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id);
stefan53b6cc32017-02-03 08:13:57 -0800119 bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) const;
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000120 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type);
asapersson@webrtc.org5249cc82011-12-16 14:31:37 +0000121
brandtr9dfff292016-11-14 05:14:50 -0800122 bool TimeToSendPacket(uint32_t ssrc,
123 uint16_t sequence_number,
philipela1ed0b32016-06-01 06:31:17 -0700124 int64_t capture_time_ms,
125 bool retransmission,
philipel8aadd502017-02-23 02:56:13 -0800126 const PacedPacketInfo& pacing_info);
127 size_t TimeToSendPadding(size_t bytes, const PacedPacketInfo& pacing_info);
asapersson@webrtc.org0b3c35a2012-01-16 11:06:31 +0000128
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000129 // NACK.
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000130 int SelectiveRetransmissions() const;
131 int SetSelectiveRetransmissions(uint8_t settings);
Danil Chapovalov2800d742016-08-26 18:48:46 +0200132 void OnReceivedNack(const std::vector<uint16_t>& nack_sequence_numbers,
pkasting@chromium.org16825b12015-01-12 21:51:21 +0000133 int64_t avg_rtt);
asapersson@webrtc.org0b3c35a2012-01-16 11:06:31 +0000134
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000135 void SetStorePacketsStatus(bool enable, uint16_t number_to_store);
niklase@google.com470e71d2011-07-07 08:21:25 +0000136
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000137 bool StorePackets() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000138
Erik Språnga12b1d62018-03-14 12:39:24 +0100139 int32_t ReSendPacket(uint16_t packet_id);
niklase@google.com470e71d2011-07-07 08:21:25 +0000140
Steve Anton296a0ce2018-03-22 15:17:27 -0700141 // Feedback to decide when to stop sending the playout delay and MID header
142 // extensions.
isheriff6b4b5f32016-06-08 00:24:21 -0700143 void OnReceivedRtcpReportBlocks(const ReportBlockList& report_blocks);
144
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000145 // RTX.
pbos@webrtc.org0b0c2412015-01-13 14:15:15 +0000146 void SetRtxStatus(int mode);
147 int RtxStatus() const;
mflodman@webrtc.org9f5ebb52013-04-12 14:55:46 +0000148
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000149 uint32_t RtxSsrc() const;
stefan@webrtc.orgef927552014-06-05 08:25:29 +0000150 void SetRtxSsrc(uint32_t ssrc);
151
Shao Changbine62202f2015-04-21 20:24:50 +0800152 void SetRtxPayloadType(int payload_type, int associated_payload_type);
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000153
erikvarga27883732017-05-17 05:08:38 -0700154 // Size info for header extensions used by FEC packets.
155 static rtc::ArrayView<const RtpExtensionSize> FecExtensionSizes();
156
Ilya Nikolaevskiy1d037ae2018-03-15 15:46:17 +0100157 // Size info for header extensions used by video packets.
158 static rtc::ArrayView<const RtpExtensionSize> VideoExtensionSizes();
159
Danil Chapovalov5e57b172016-09-02 19:15:59 +0200160 // Create empty packet, fills ssrc, csrcs and reserve place for header
161 // extensions RtpSender updates before sending.
162 std::unique_ptr<RtpPacketToSend> AllocatePacket() const;
163 // Allocate sequence number for provided packet.
164 // Save packet's fields to generate padding that doesn't break media stream.
165 // Return false if sending was turned off.
166 bool AssignSequenceNumber(RtpPacketToSend* packet);
167
erikvarga27883732017-05-17 05:08:38 -0700168 // Used for padding and FEC packets only.
danilchap5fb291a2016-08-09 07:43:25 -0700169 size_t RtpHeaderLength() const;
170 uint16_t AllocateSequenceNumber(uint16_t packets_to_send);
nisse284542b2017-01-10 08:58:32 -0800171 // Including RTP headers.
172 size_t MaxRtpPacketSize() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000173
danilchap5fb291a2016-08-09 07:43:25 -0700174 uint32_t SSRC() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000175
brandtr9dfff292016-11-14 05:14:50 -0800176 rtc::Optional<uint32_t> FlexfecSsrc() const;
177
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200178 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet,
179 StorageType storage,
180 RtpPacketSender::Priority priority);
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000181
182 // Audio.
183
184 // Send a DTMF tone using RFC 2833 (4733).
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000185 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level);
niklase@google.com470e71d2011-07-07 08:21:25 +0000186
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000187 // Store the audio level in d_bov for
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000188 // header-extension-for-audio-level-indication.
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000189 int32_t SetAudioLevel(uint8_t level_d_bov);
niklase@google.com470e71d2011-07-07 08:21:25 +0000190
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000191 RtpVideoCodecTypes VideoCodecType() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000192
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000193 uint32_t MaxConfiguredBitrateVideo() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000194
brandtrf1bb4762016-11-07 03:05:06 -0800195 // ULPFEC.
196 void SetUlpfecConfig(int red_payload_type, int ulpfec_payload_type);
niklase@google.com470e71d2011-07-07 08:21:25 +0000197
brandtr1743a192016-11-07 03:36:05 -0800198 bool SetFecParameters(const FecProtectionParams& delta_params,
199 const FecProtectionParams& key_params);
niklase@google.com470e71d2011-07-07 08:21:25 +0000200
sprang@webrtc.orgebad7652013-12-05 14:29:02 +0000201 // Called on update of RTP statistics.
202 void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback);
203 StreamDataCountersCallback* GetRtpStatisticsCallback() const;
204
sprang@webrtc.org6811b6e2013-12-13 09:46:59 +0000205 uint32_t BitrateSent() const;
206
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000207 void SetRtpState(const RtpState& rtp_state);
208 RtpState GetRtpState() const;
209 void SetRtxRtpState(const RtpState& rtp_state);
210 RtpState GetRtxRtpState() const;
211
sprang168794c2017-07-06 04:38:06 -0700212 int64_t LastTimestampTimeMs() const;
213 void SendKeepAlive(uint8_t payload_type);
214
Erik Språng8b101922018-01-18 11:58:05 -0800215 void SetRtt(int64_t rtt_ms);
216
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +0000217 protected:
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000218 int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type);
niklase@google.com470e71d2011-07-07 08:21:25 +0000219
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +0000220 private:
stefan@webrtc.org0a3c1472013-12-05 14:05:07 +0000221 // Maps capture time in milliseconds to send-side delay in milliseconds.
222 // Send-side delay is the difference between transmission time and capture
223 // time.
224 typedef std::map<int64_t, int> SendDelayMap;
225
philipel8aadd502017-02-23 02:56:13 -0800226 size_t SendPadData(size_t bytes, const PacedPacketInfo& pacing_info);
danilchap7bfe3a22016-09-19 05:37:56 -0700227
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200228 bool PrepareAndSendPacket(std::unique_ptr<RtpPacketToSend> packet,
stefan@webrtc.org7c6ff2d2014-03-19 18:14:52 +0000229 bool send_over_rtx,
philipela1ed0b32016-06-01 06:31:17 -0700230 bool is_retransmit,
philipel8aadd502017-02-23 02:56:13 -0800231 const PacedPacketInfo& pacing_info);
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000232
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +0000233 // Return the number of bytes sent. Note that both of these functions may
234 // return a larger value that their argument.
philipel8aadd502017-02-23 02:56:13 -0800235 size_t TrySendRedundantPayloads(size_t bytes,
236 const PacedPacketInfo& pacing_info);
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000237
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200238 std::unique_ptr<RtpPacketToSend> BuildRtxPacket(
239 const RtpPacketToSend& packet);
phoglund@webrtc.orgbaaf2432012-05-31 10:47:35 +0000240
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200241 bool SendPacketToNetwork(const RtpPacketToSend& packet,
philipel32d00102017-02-27 02:18:46 -0800242 const PacketOptions& options,
243 const PacedPacketInfo& pacing_info);
pwestin@webrtc.orgb0061f92013-04-27 00:41:08 +0000244
stefan@webrtc.org0a3c1472013-12-05 14:05:07 +0000245 void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms);
asapersson35151f32016-05-02 23:44:01 -0700246 void UpdateOnSendPacket(int packet_id,
247 int64_t capture_time_ms,
248 uint32_t ssrc);
stefan@webrtc.org0a3c1472013-12-05 14:05:07 +0000249
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200250 bool UpdateTransportSequenceNumber(RtpPacketToSend* packet,
251 int* packet_id) const;
asapersson35151f32016-05-02 23:44:01 -0700252
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200253 void UpdateRtpStats(const RtpPacketToSend& packet,
sprang@webrtc.orgebad7652013-12-05 14:29:02 +0000254 bool is_rtx,
255 bool is_retransmit);
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200256 bool IsFecPacket(const RtpPacketToSend& packet) const;
sprang@webrtc.orgebad7652013-12-05 14:29:02 +0000257
michaelt4da30442016-11-17 01:38:43 -0800258 void AddPacketToTransportFeedback(uint16_t packet_id,
259 const RtpPacketToSend& packet,
philipel8aadd502017-02-23 02:56:13 -0800260 const PacedPacketInfo& pacing_info);
michaelt4da30442016-11-17 01:38:43 -0800261
262 void UpdateRtpOverhead(const RtpPacketToSend& packet);
263
tommiae695e92016-02-02 08:31:45 -0800264 Clock* const clock_;
265 const int64_t clock_delta_ms_;
danilchap56359be2017-09-07 07:53:45 -0700266 Random random_ RTC_GUARDED_BY(send_critsect_);
stefan@webrtc.org0bae1fa2014-11-05 14:05:29 +0000267
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000268 const bool audio_configured_;
kwiberg84be5112016-04-27 01:19:58 -0700269 const std::unique_ptr<RTPSenderAudio> audio_;
270 const std::unique_ptr<RTPSenderVideo> video_;
phoglund@webrtc.orgbaaf2432012-05-31 10:47:35 +0000271
sprangebbf8a82015-09-21 15:11:14 -0700272 RtpPacketSender* const paced_sender_;
273 TransportSequenceNumberAllocator* const transport_sequence_number_allocator_;
sprang5e023eb2015-09-14 06:42:43 -0700274 TransportFeedbackObserver* const transport_feedback_observer_;
sprang@webrtc.orgdcebf2d2014-11-04 16:27:16 +0000275 int64_t last_capture_time_ms_sent_;
tommiae695e92016-02-02 08:31:45 -0800276 rtc::CriticalSection send_critsect_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000277
brandtrd8048952016-11-07 02:08:51 -0800278 Transport* transport_;
danilchap56359be2017-09-07 07:53:45 -0700279 bool sending_media_ RTC_GUARDED_BY(send_critsect_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000280
nisse284542b2017-01-10 08:58:32 -0800281 size_t max_packet_size_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000282
Danil Chapovalovb3179c72018-03-22 10:13:07 +0100283 int8_t last_payload_type_ RTC_GUARDED_BY(send_critsect_);
pbos@webrtc.org62bafae2014-07-08 12:10:51 +0000284 std::map<int8_t, RtpUtility::Payload*> payload_type_map_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000285
danilchap56359be2017-09-07 07:53:45 -0700286 RtpHeaderExtensionMap rtp_header_extension_map_
287 RTC_GUARDED_BY(send_critsect_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000288
isheriff6b4b5f32016-06-08 00:24:21 -0700289 // Tracks the current request for playout delay limits from application
290 // and decides whether the current RTP frame should include the playout
291 // delay extension on header.
292 PlayoutDelayOracle playout_delay_oracle_;
isheriff6b4b5f32016-06-08 00:24:21 -0700293
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200294 RtpPacketHistory packet_history_;
brandtr9dfff292016-11-14 05:14:50 -0800295 // TODO(brandtr): Remove |flexfec_packet_history_| when the FlexfecSender
296 // is hooked up to the PacedSender.
297 RtpPacketHistory flexfec_packet_history_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000298
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000299 // Statistics
danilchap7c9426c2016-04-14 03:05:31 -0700300 rtc::CriticalSection statistics_crit_;
danilchap56359be2017-09-07 07:53:45 -0700301 SendDelayMap send_delays_ RTC_GUARDED_BY(statistics_crit_);
302 FrameCounts frame_counts_ RTC_GUARDED_BY(statistics_crit_);
303 StreamDataCounters rtp_stats_ RTC_GUARDED_BY(statistics_crit_);
304 StreamDataCounters rtx_rtp_stats_ RTC_GUARDED_BY(statistics_crit_);
305 StreamDataCountersCallback* rtp_stats_callback_
306 RTC_GUARDED_BY(statistics_crit_);
307 RateStatistics total_bitrate_sent_ RTC_GUARDED_BY(statistics_crit_);
308 RateStatistics nack_bitrate_sent_ RTC_GUARDED_BY(statistics_crit_);
andresp@webrtc.org8f151212014-07-10 09:39:23 +0000309 FrameCountObserver* const frame_count_observer_;
stefan@webrtc.org168f23f2014-07-11 13:44:02 +0000310 SendSideDelayObserver* const send_side_delay_observer_;
terelius429c3452016-01-21 05:42:04 -0800311 RtcEventLog* const event_log_;
asapersson35151f32016-05-02 23:44:01 -0700312 SendPacketObserver* const send_packet_observer_;
sprangcd349d92016-07-13 09:11:28 -0700313 BitrateStatisticsObserver* const bitrate_callback_;
asapersson@webrtc.org0b3c35a2012-01-16 11:06:31 +0000314
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000315 // RTP variables
danilchap56359be2017-09-07 07:53:45 -0700316 uint32_t timestamp_offset_ RTC_GUARDED_BY(send_critsect_);
317 uint32_t remote_ssrc_ RTC_GUARDED_BY(send_critsect_);
318 bool sequence_number_forced_ RTC_GUARDED_BY(send_critsect_);
319 uint16_t sequence_number_ RTC_GUARDED_BY(send_critsect_);
320 uint16_t sequence_number_rtx_ RTC_GUARDED_BY(send_critsect_);
nisse7d59f6b2017-02-21 03:40:24 -0800321 // Must be explicitly set by the application, use of rtc::Optional
322 // only to keep track of correct use.
danilchap56359be2017-09-07 07:53:45 -0700323 rtc::Optional<uint32_t> ssrc_ RTC_GUARDED_BY(send_critsect_);
Steve Anton296a0ce2018-03-22 15:17:27 -0700324 std::unique_ptr<MidOracle> mid_oracle_ RTC_GUARDED_BY(send_critsect_);
danilchap56359be2017-09-07 07:53:45 -0700325 uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(send_critsect_);
326 int64_t capture_time_ms_ RTC_GUARDED_BY(send_critsect_);
327 int64_t last_timestamp_time_ms_ RTC_GUARDED_BY(send_critsect_);
328 bool media_has_been_sent_ RTC_GUARDED_BY(send_critsect_);
329 bool last_packet_marker_bit_ RTC_GUARDED_BY(send_critsect_);
330 std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(send_critsect_);
331 int rtx_ RTC_GUARDED_BY(send_critsect_);
332 rtc::Optional<uint32_t> ssrc_rtx_ RTC_GUARDED_BY(send_critsect_);
Steve Anton296a0ce2018-03-22 15:17:27 -0700333 std::unique_ptr<MidOracle> mid_oracle_rtx_ RTC_GUARDED_BY(send_critsect_);
Shao Changbine62202f2015-04-21 20:24:50 +0800334 // Mapping rtx_payload_type_map_[associated] = rtx.
danilchap56359be2017-09-07 07:53:45 -0700335 std::map<int8_t, int8_t> rtx_payload_type_map_ RTC_GUARDED_BY(send_critsect_);
336 size_t rtp_overhead_bytes_per_packet_ RTC_GUARDED_BY(send_critsect_);
andresp@webrtc.orgd09d0742014-03-26 14:27:34 +0000337
sprangcd349d92016-07-13 09:11:28 -0700338 RateLimiter* const retransmission_rate_limiter_;
michaelt4da30442016-11-17 01:38:43 -0800339 OverheadObserver* overhead_observer_;
Erik Språng7b52f102018-02-07 14:37:37 +0100340 const bool populate_network2_timestamp_;
terelius429c3452016-01-21 05:42:04 -0800341
elad.alonc3dfff32017-01-26 02:46:55 -0800342 const bool send_side_bwe_with_overhead_;
343
terelius429c3452016-01-21 05:42:04 -0800344 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000345};
niklase@google.com470e71d2011-07-07 08:21:25 +0000346
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000347} // namespace webrtc
348
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200349#endif // MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_