blob: 8f71b48899c2f49070f4567def6c33cddb47f127 [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
11#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_
12#define WEBRTC_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>
danilchapb8b6fbb2015-12-10 05:05:27 -080016#include <utility>
17#include <vector>
pwestin@webrtc.org00741872012-01-19 15:56:10 +000018
aleloia8eb7562016-11-28 07:02:13 -080019#include "webrtc/api/call/transport.h"
kwiberg4485ffb2016-04-26 08:14:39 -070020#include "webrtc/base/constructormagic.h"
tommiae695e92016-02-02 08:31:45 -080021#include "webrtc/base/criticalsection.h"
danilchap7bfe3a22016-09-19 05:37:56 -070022#include "webrtc/base/deprecation.h"
brandtr9dfff292016-11-14 05:14:50 -080023#include "webrtc/base/optional.h"
danilchap47a740b2015-12-15 00:30:07 -080024#include "webrtc/base/random.h"
sprangcd349d92016-07-13 09:11:28 -070025#include "webrtc/base/rate_statistics.h"
pbos@webrtc.org38344ed2014-09-24 06:05:00 +000026#include "webrtc/base/thread_annotations.h"
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000027#include "webrtc/common_types.h"
brandtrdbdb3f12016-11-10 05:04:48 -080028#include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010029#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
isheriff6b4b5f32016-06-08 00:24:21 -070030#include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h"
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000031#include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +000032#include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h"
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +000033#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
mflodmanfcf54bd2015-04-14 21:28:08 +020034#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000035
niklase@google.com470e71d2011-07-07 08:21:25 +000036namespace webrtc {
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +000037
michaelt4da30442016-11-17 01:38:43 -080038class OverheadObserver;
sprangcd349d92016-07-13 09:11:28 -070039class RateLimiter;
Danil Chapovalov31e4e802016-08-03 18:27:40 +020040class RtcEventLog;
41class RtpPacketToSend;
niklase@google.com470e71d2011-07-07 08:21:25 +000042class RTPSenderAudio;
43class RTPSenderVideo;
44
danilchap5fb291a2016-08-09 07:43:25 -070045class RTPSender {
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +000046 public:
Peter Boströmac547a62015-09-17 23:03:57 +020047 RTPSender(bool audio,
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +000048 Clock* clock,
49 Transport* transport,
sprangebbf8a82015-09-21 15:11:14 -070050 RtpPacketSender* paced_sender,
brandtrdbdb3f12016-11-10 05:04:48 -080051 // TODO(brandtr): Remove |flexfec_sender| when that is hooked up
52 // to PacedSender instead.
53 FlexfecSender* flexfec_sender,
sprangebbf8a82015-09-21 15:11:14 -070054 TransportSequenceNumberAllocator* sequence_number_allocator,
sprang5e023eb2015-09-14 06:42:43 -070055 TransportFeedbackObserver* transport_feedback_callback,
andresp@webrtc.org8f151212014-07-10 09:39:23 +000056 BitrateStatisticsObserver* bitrate_callback,
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000057 FrameCountObserver* frame_count_observer,
terelius429c3452016-01-21 05:42:04 -080058 SendSideDelayObserver* send_side_delay_observer,
asapersson35151f32016-05-02 23:44:01 -070059 RtcEventLog* event_log,
sprangcd349d92016-07-13 09:11:28 -070060 SendPacketObserver* send_packet_observer,
michaelt4da30442016-11-17 01:38:43 -080061 RateLimiter* nack_rate_limiter,
62 OverheadObserver* overhead_observer);
asapersson35151f32016-05-02 23:44:01 -070063
danilchap5fb291a2016-08-09 07:43:25 -070064 ~RTPSender();
niklase@google.com470e71d2011-07-07 08:21:25 +000065
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +000066 void ProcessBitrate();
niklase@google.com470e71d2011-07-07 08:21:25 +000067
danilchap5fb291a2016-08-09 07:43:25 -070068 uint16_t ActualSendBitrateKbit() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000069
pbos@webrtc.org2f446732013-04-08 11:08:41 +000070 uint32_t VideoBitrateSent() const;
71 uint32_t FecOverheadRate() const;
72 uint32_t NackOverheadRate() const;
stefan@webrtc.orgd0bdab02011-10-14 14:24:54 +000073
nisse284542b2017-01-10 08:58:32 -080074 // Excluding size of RTP and FEC headers.
75 size_t MaxPayloadSize() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000076
Peter Boström8b79b072016-02-26 16:31:37 +010077 int32_t RegisterPayload(const char* payload_name,
78 const int8_t payload_type,
79 const uint32_t frequency,
80 const size_t channels,
81 const uint32_t rate);
niklase@google.com470e71d2011-07-07 08:21:25 +000082
pbos@webrtc.org2f446732013-04-08 11:08:41 +000083 int32_t DeRegisterSendPayload(const int8_t payload_type);
niklase@google.com470e71d2011-07-07 08:21:25 +000084
andresp@webrtc.orgc3c29112014-08-27 09:39:43 +000085 void SetSendPayloadType(int8_t payload_type);
86
pbos@webrtc.org2f446732013-04-08 11:08:41 +000087 int8_t SendPayloadType() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000088
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +000089 void SetSendingMediaStatus(bool enabled);
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +000090 bool SendingMedia() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000091
pbos@webrtc.org2f4b14e2014-07-15 15:25:39 +000092 void GetDataCounters(StreamDataCounters* rtp_stats,
93 StreamDataCounters* rtx_stats) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000094
danilchap71fead22016-08-18 02:01:49 -070095 uint32_t TimestampOffset() const;
96 void SetTimestampOffset(uint32_t timestamp);
niklase@google.com470e71d2011-07-07 08:21:25 +000097
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +000098 void SetSSRC(uint32_t ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000099
danilchap5fb291a2016-08-09 07:43:25 -0700100 uint16_t SequenceNumber() const;
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000101 void SetSequenceNumber(uint16_t seq);
niklase@google.com470e71d2011-07-07 08:21:25 +0000102
pbos@webrtc.org9334ac22014-11-24 08:25:50 +0000103 void SetCsrcs(const std::vector<uint32_t>& csrcs);
niklase@google.com470e71d2011-07-07 08:21:25 +0000104
nisse284542b2017-01-10 08:58:32 -0800105 void SetMaxRtpPacketSize(size_t max_packet_size);
niklase@google.com470e71d2011-07-07 08:21:25 +0000106
Sergey Ulanov525df3f2016-08-02 17:46:41 -0700107 bool SendOutgoingData(FrameType frame_type,
108 int8_t payload_type,
109 uint32_t timestamp,
110 int64_t capture_time_ms,
111 const uint8_t* payload_data,
112 size_t payload_size,
113 const RTPFragmentationHeader* fragmentation,
114 const RTPVideoHeader* rtp_header,
115 uint32_t* transport_frame_id_out);
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,
126 int probe_cluster_id);
127 size_t TimeToSendPadding(size_t bytes, int probe_cluster_id);
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
pkasting@chromium.org16825b12015-01-12 21:51:21 +0000139 int32_t ReSendPacket(uint16_t packet_id, int64_t min_resend_time = 0);
niklase@google.com470e71d2011-07-07 08:21:25 +0000140
isheriff6b4b5f32016-06-08 00:24:21 -0700141 // Feedback to decide when to stop sending playout delay.
142 void OnReceivedRtcpReportBlocks(const ReportBlockList& report_blocks);
143
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000144 // RTX.
pbos@webrtc.org0b0c2412015-01-13 14:15:15 +0000145 void SetRtxStatus(int mode);
146 int RtxStatus() const;
mflodman@webrtc.org9f5ebb52013-04-12 14:55:46 +0000147
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000148 uint32_t RtxSsrc() const;
stefan@webrtc.orgef927552014-06-05 08:25:29 +0000149 void SetRtxSsrc(uint32_t ssrc);
150
Shao Changbine62202f2015-04-21 20:24:50 +0800151 void SetRtxPayloadType(int payload_type, int associated_payload_type);
pwestin@webrtc.org8281e7d2012-01-10 14:09:18 +0000152
Danil Chapovalov5e57b172016-09-02 19:15:59 +0200153 // Create empty packet, fills ssrc, csrcs and reserve place for header
154 // extensions RtpSender updates before sending.
155 std::unique_ptr<RtpPacketToSend> AllocatePacket() const;
156 // Allocate sequence number for provided packet.
157 // Save packet's fields to generate padding that doesn't break media stream.
158 // Return false if sending was turned off.
159 bool AssignSequenceNumber(RtpPacketToSend* packet);
160
danilchap5fb291a2016-08-09 07:43:25 -0700161 size_t RtpHeaderLength() const;
162 uint16_t AllocateSequenceNumber(uint16_t packets_to_send);
nisse284542b2017-01-10 08:58:32 -0800163 // Including RTP headers.
164 size_t MaxRtpPacketSize() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000165
danilchap5fb291a2016-08-09 07:43:25 -0700166 uint32_t SSRC() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000167
brandtr9dfff292016-11-14 05:14:50 -0800168 rtc::Optional<uint32_t> FlexfecSsrc() const;
169
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200170 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet,
171 StorageType storage,
172 RtpPacketSender::Priority priority);
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000173
174 // Audio.
175
176 // Send a DTMF tone using RFC 2833 (4733).
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000177 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level);
niklase@google.com470e71d2011-07-07 08:21:25 +0000178
ossu00bceb12016-12-02 02:40:02 -0800179 // This function is deprecated. It was previously used to determine when it
180 // was time to send a DTMF packet in silence (CNG).
181 RTC_DEPRECATED int32_t SetAudioPacketSize(uint16_t packet_size_samples);
niklase@google.com470e71d2011-07-07 08:21:25 +0000182
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000183 // Store the audio level in d_bov for
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000184 // header-extension-for-audio-level-indication.
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000185 int32_t SetAudioLevel(uint8_t level_d_bov);
niklase@google.com470e71d2011-07-07 08:21:25 +0000186
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000187 RtpVideoCodecTypes VideoCodecType() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000188
pbos@webrtc.org2f446732013-04-08 11:08:41 +0000189 uint32_t MaxConfiguredBitrateVideo() const;
niklase@google.com470e71d2011-07-07 08:21:25 +0000190
brandtrf1bb4762016-11-07 03:05:06 -0800191 // ULPFEC.
192 void SetUlpfecConfig(int red_payload_type, int ulpfec_payload_type);
niklase@google.com470e71d2011-07-07 08:21:25 +0000193
brandtr1743a192016-11-07 03:36:05 -0800194 bool SetFecParameters(const FecProtectionParams& delta_params,
195 const FecProtectionParams& key_params);
niklase@google.com470e71d2011-07-07 08:21:25 +0000196
sprang@webrtc.orgebad7652013-12-05 14:29:02 +0000197 // Called on update of RTP statistics.
198 void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback);
199 StreamDataCountersCallback* GetRtpStatisticsCallback() const;
200
sprang@webrtc.org6811b6e2013-12-13 09:46:59 +0000201 uint32_t BitrateSent() const;
202
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000203 void SetRtpState(const RtpState& rtp_state);
204 RtpState GetRtpState() const;
205 void SetRtxRtpState(const RtpState& rtp_state);
206 RtpState GetRtxRtpState() const;
207
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +0000208 protected:
pbos@webrtc.orgd16e8392014-12-19 13:49:55 +0000209 int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type);
niklase@google.com470e71d2011-07-07 08:21:25 +0000210
pwestin@webrtc.orgc66e8b32012-11-07 17:01:04 +0000211 private:
stefan@webrtc.org0a3c1472013-12-05 14:05:07 +0000212 // Maps capture time in milliseconds to send-side delay in milliseconds.
213 // Send-side delay is the difference between transmission time and capture
214 // time.
215 typedef std::map<int64_t, int> SendDelayMap;
216
danilchap7bfe3a22016-09-19 05:37:56 -0700217 size_t SendPadData(size_t bytes, int probe_cluster_id);
218
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200219 bool PrepareAndSendPacket(std::unique_ptr<RtpPacketToSend> packet,
stefan@webrtc.org7c6ff2d2014-03-19 18:14:52 +0000220 bool send_over_rtx,
philipela1ed0b32016-06-01 06:31:17 -0700221 bool is_retransmit,
222 int probe_cluster_id);
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000223
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +0000224 // Return the number of bytes sent. Note that both of these functions may
225 // return a larger value that their argument.
philipela1ed0b32016-06-01 06:31:17 -0700226 size_t TrySendRedundantPayloads(size_t bytes, int probe_cluster_id);
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +0000227
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200228 std::unique_ptr<RtpPacketToSend> BuildRtxPacket(
229 const RtpPacketToSend& packet);
phoglund@webrtc.orgbaaf2432012-05-31 10:47:35 +0000230
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200231 bool SendPacketToNetwork(const RtpPacketToSend& packet,
stefan1d8a5062015-10-02 03:39:33 -0700232 const PacketOptions& options);
pwestin@webrtc.orgb0061f92013-04-27 00:41:08 +0000233
stefan@webrtc.org0a3c1472013-12-05 14:05:07 +0000234 void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms);
asapersson35151f32016-05-02 23:44:01 -0700235 void UpdateOnSendPacket(int packet_id,
236 int64_t capture_time_ms,
237 uint32_t ssrc);
stefan@webrtc.org0a3c1472013-12-05 14:05:07 +0000238
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200239 bool UpdateTransportSequenceNumber(RtpPacketToSend* packet,
240 int* packet_id) const;
asapersson35151f32016-05-02 23:44:01 -0700241
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200242 void UpdateRtpStats(const RtpPacketToSend& packet,
sprang@webrtc.orgebad7652013-12-05 14:29:02 +0000243 bool is_rtx,
244 bool is_retransmit);
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200245 bool IsFecPacket(const RtpPacketToSend& packet) const;
sprang@webrtc.orgebad7652013-12-05 14:29:02 +0000246
michaelt4da30442016-11-17 01:38:43 -0800247 void AddPacketToTransportFeedback(uint16_t packet_id,
248 const RtpPacketToSend& packet,
249 int probe_cluster_id);
250
251 void UpdateRtpOverhead(const RtpPacketToSend& packet);
252
tommiae695e92016-02-02 08:31:45 -0800253 Clock* const clock_;
254 const int64_t clock_delta_ms_;
danilchap47a740b2015-12-15 00:30:07 -0800255 Random random_ GUARDED_BY(send_critsect_);
stefan@webrtc.org0bae1fa2014-11-05 14:05:29 +0000256
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000257 const bool audio_configured_;
kwiberg84be5112016-04-27 01:19:58 -0700258 const std::unique_ptr<RTPSenderAudio> audio_;
259 const std::unique_ptr<RTPSenderVideo> video_;
phoglund@webrtc.orgbaaf2432012-05-31 10:47:35 +0000260
sprangebbf8a82015-09-21 15:11:14 -0700261 RtpPacketSender* const paced_sender_;
262 TransportSequenceNumberAllocator* const transport_sequence_number_allocator_;
sprang5e023eb2015-09-14 06:42:43 -0700263 TransportFeedbackObserver* const transport_feedback_observer_;
sprang@webrtc.orgdcebf2d2014-11-04 16:27:16 +0000264 int64_t last_capture_time_ms_sent_;
tommiae695e92016-02-02 08:31:45 -0800265 rtc::CriticalSection send_critsect_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000266
brandtrd8048952016-11-07 02:08:51 -0800267 Transport* transport_;
sprang@webrtc.org5a320fb2014-03-13 15:12:37 +0000268 bool sending_media_ GUARDED_BY(send_critsect_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000269
nisse284542b2017-01-10 08:58:32 -0800270 size_t max_packet_size_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000271
sprang@webrtc.orgefcad392014-03-25 16:51:35 +0000272 int8_t payload_type_ GUARDED_BY(send_critsect_);
pbos@webrtc.org62bafae2014-07-08 12:10:51 +0000273 std::map<int8_t, RtpUtility::Payload*> payload_type_map_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000274
stefana23fc622016-07-28 07:56:38 -0700275 RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(send_critsect_);
niklase@google.com470e71d2011-07-07 08:21:25 +0000276
isheriff6b4b5f32016-06-08 00:24:21 -0700277 // Tracks the current request for playout delay limits from application
278 // and decides whether the current RTP frame should include the playout
279 // delay extension on header.
280 PlayoutDelayOracle playout_delay_oracle_;
isheriff6b4b5f32016-06-08 00:24:21 -0700281
Danil Chapovalov31e4e802016-08-03 18:27:40 +0200282 RtpPacketHistory packet_history_;
brandtr9dfff292016-11-14 05:14:50 -0800283 // TODO(brandtr): Remove |flexfec_packet_history_| when the FlexfecSender
284 // is hooked up to the PacedSender.
285 RtpPacketHistory flexfec_packet_history_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000286
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000287 // Statistics
danilchap7c9426c2016-04-14 03:05:31 -0700288 rtc::CriticalSection statistics_crit_;
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000289 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_);
pbos@webrtc.orgce4e9a32014-12-18 13:50:16 +0000290 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_);
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000291 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_);
292 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_);
293 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_);
sprangcd349d92016-07-13 09:11:28 -0700294 RateStatistics total_bitrate_sent_ GUARDED_BY(statistics_crit_);
295 RateStatistics nack_bitrate_sent_ GUARDED_BY(statistics_crit_);
andresp@webrtc.org8f151212014-07-10 09:39:23 +0000296 FrameCountObserver* const frame_count_observer_;
stefan@webrtc.org168f23f2014-07-11 13:44:02 +0000297 SendSideDelayObserver* const send_side_delay_observer_;
terelius429c3452016-01-21 05:42:04 -0800298 RtcEventLog* const event_log_;
asapersson35151f32016-05-02 23:44:01 -0700299 SendPacketObserver* const send_packet_observer_;
sprangcd349d92016-07-13 09:11:28 -0700300 BitrateStatisticsObserver* const bitrate_callback_;
asapersson@webrtc.org0b3c35a2012-01-16 11:06:31 +0000301
pwestin@webrtc.org571a1c02012-11-13 21:12:39 +0000302 // RTP variables
danilchap71fead22016-08-18 02:01:49 -0700303 uint32_t timestamp_offset_ GUARDED_BY(send_critsect_);
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000304 uint32_t remote_ssrc_ GUARDED_BY(send_critsect_);
305 bool sequence_number_forced_ GUARDED_BY(send_critsect_);
306 uint16_t sequence_number_ GUARDED_BY(send_critsect_);
307 uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_);
nisse7d59f6b2017-02-21 03:40:24 -0800308 // Must be explicitly set by the application, use of rtc::Optional
309 // only to keep track of correct use.
310 rtc::Optional<uint32_t> ssrc_ GUARDED_BY(send_critsect_);
danilchape5b41412016-08-22 03:39:23 -0700311 uint32_t last_rtp_timestamp_ GUARDED_BY(send_critsect_);
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000312 int64_t capture_time_ms_ GUARDED_BY(send_critsect_);
313 int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_);
stefan@webrtc.org8b94e3d2014-07-17 16:10:14 +0000314 bool media_has_been_sent_ GUARDED_BY(send_critsect_);
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000315 bool last_packet_marker_bit_ GUARDED_BY(send_critsect_);
pbos@webrtc.org9334ac22014-11-24 08:25:50 +0000316 std::vector<uint32_t> csrcs_ GUARDED_BY(send_critsect_);
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +0000317 int rtx_ GUARDED_BY(send_critsect_);
nisse7d59f6b2017-02-21 03:40:24 -0800318 rtc::Optional<uint32_t> ssrc_rtx_ GUARDED_BY(send_critsect_);
Shao Changbine62202f2015-04-21 20:24:50 +0800319 // Mapping rtx_payload_type_map_[associated] = rtx.
320 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_);
michaelt4da30442016-11-17 01:38:43 -0800321 size_t rtp_overhead_bytes_per_packet_ GUARDED_BY(send_critsect_);
andresp@webrtc.orgd09d0742014-03-26 14:27:34 +0000322
sprangcd349d92016-07-13 09:11:28 -0700323 RateLimiter* const retransmission_rate_limiter_;
michaelt4da30442016-11-17 01:38:43 -0800324 OverheadObserver* overhead_observer_;
terelius429c3452016-01-21 05:42:04 -0800325
elad.alonc3dfff32017-01-26 02:46:55 -0800326 const bool send_side_bwe_with_overhead_;
327
terelius429c3452016-01-21 05:42:04 -0800328 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender);
niklase@google.com470e71d2011-07-07 08:21:25 +0000329};
niklase@google.com470e71d2011-07-07 08:21:25 +0000330
phoglund@webrtc.org43da54a2013-01-25 10:53:38 +0000331} // namespace webrtc
332
333#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_