niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
pwestin@webrtc.org | f6bb77a | 2012-01-24 17:16:59 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
| 12 | #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
pbos@webrtc.org | 12dc1a3 | 2013-08-05 16:22:53 +0000 | [diff] [blame] | 13 | |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 14 | #include <list> |
pwestin@webrtc.org | 0074187 | 2012-01-19 15:56:10 +0000 | [diff] [blame] | 15 | #include <map> |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 16 | #include <memory> |
danilchap | b8b6fbb | 2015-12-10 05:05:27 -0800 | [diff] [blame] | 17 | #include <utility> |
| 18 | #include <vector> |
pwestin@webrtc.org | 0074187 | 2012-01-19 15:56:10 +0000 | [diff] [blame] | 19 | |
kwiberg | 4485ffb | 2016-04-26 08:14:39 -0700 | [diff] [blame] | 20 | #include "webrtc/base/constructormagic.h" |
tommi | ae695e9 | 2016-02-02 08:31:45 -0800 | [diff] [blame] | 21 | #include "webrtc/base/criticalsection.h" |
danilchap | 47a740b | 2015-12-15 00:30:07 -0800 | [diff] [blame] | 22 | #include "webrtc/base/random.h" |
sprang | cd349d9 | 2016-07-13 09:11:28 -0700 | [diff] [blame] | 23 | #include "webrtc/base/rate_statistics.h" |
pbos@webrtc.org | 38344ed | 2014-09-24 06:05:00 +0000 | [diff] [blame] | 24 | #include "webrtc/base/thread_annotations.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 25 | #include "webrtc/common_types.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 26 | #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 27 | #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 28 | #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 29 | #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 30 | #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
mflodman | fcf54bd | 2015-04-14 21:28:08 +0200 | [diff] [blame] | 31 | #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 32 | #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" |
pbos | 2d56668 | 2015-09-28 09:59:31 -0700 | [diff] [blame] | 33 | #include "webrtc/transport.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | namespace webrtc { |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 36 | |
sprang | cd349d9 | 2016-07-13 09:11:28 -0700 | [diff] [blame] | 37 | class RateLimiter; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 38 | class RTPSenderAudio; |
| 39 | class RTPSenderVideo; |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame] | 40 | class RtcEventLog; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 41 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 42 | class RTPSenderInterface { |
| 43 | public: |
| 44 | RTPSenderInterface() {} |
| 45 | virtual ~RTPSenderInterface() {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 46 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 47 | virtual uint32_t SSRC() const = 0; |
| 48 | virtual uint32_t Timestamp() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 49 | |
Sergey Ulanov | ec4f068 | 2016-07-28 15:19:10 -0700 | [diff] [blame^] | 50 | // Deprecated version of BuildRtpHeader(). |timestamp_provided| and |
| 51 | // |inc_sequence_number| are ignored. |
| 52 | // TODO(sergeyu): Remove this method. |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 53 | virtual int32_t BuildRTPheader(uint8_t* data_buffer, |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 54 | int8_t payload_type, |
| 55 | bool marker_bit, |
| 56 | uint32_t capture_timestamp, |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 57 | int64_t capture_time_ms, |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 58 | bool timestamp_provided = true, |
| 59 | bool inc_sequence_number = true) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 60 | |
Sergey Ulanov | ec4f068 | 2016-07-28 15:19:10 -0700 | [diff] [blame^] | 61 | virtual int32_t BuildRtpHeader(uint8_t* data_buffer, |
| 62 | int8_t payload_type, |
| 63 | bool marker_bit, |
| 64 | uint32_t capture_timestamp, |
| 65 | int64_t capture_time_ms) = 0; |
| 66 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 67 | // This returns the expected header length taking into consideration |
| 68 | // the optional RTP header extensions that may not be currently active. |
| 69 | virtual size_t RtpHeaderLength() const = 0; |
mflodman | fcf54bd | 2015-04-14 21:28:08 +0200 | [diff] [blame] | 70 | // Returns the next sequence number to use for a packet and allocates |
| 71 | // 'packets_to_send' number of sequence numbers. It's important all allocated |
| 72 | // sequence numbers are used in sequence to avoid perceived packet loss. |
| 73 | virtual uint16_t AllocateSequenceNumber(uint16_t packets_to_send) = 0; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 74 | virtual uint16_t SequenceNumber() const = 0; |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 75 | virtual size_t MaxPayloadLength() const = 0; |
| 76 | virtual size_t MaxDataPayloadLength() const = 0; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 77 | virtual uint16_t ActualSendBitrateKbit() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | |
sprang | ebbf8a8 | 2015-09-21 15:11:14 -0700 | [diff] [blame] | 79 | virtual int32_t SendToNetwork(uint8_t* data_buffer, |
| 80 | size_t payload_length, |
| 81 | size_t rtp_header_length, |
| 82 | int64_t capture_time_ms, |
| 83 | StorageType storage, |
| 84 | RtpPacketSender::Priority priority) = 0; |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 85 | |
| 86 | virtual bool UpdateVideoRotation(uint8_t* rtp_packet, |
| 87 | size_t rtp_packet_length, |
| 88 | const RTPHeader& rtp_header, |
| 89 | VideoRotation rotation) const = 0; |
| 90 | virtual bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) = 0; |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 91 | virtual bool ActivateCVORtpHeaderExtension() = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 92 | }; |
| 93 | |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 94 | class RTPSender : public RTPSenderInterface { |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 95 | public: |
Peter Boström | ac547a6 | 2015-09-17 23:03:57 +0200 | [diff] [blame] | 96 | RTPSender(bool audio, |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 97 | Clock* clock, |
| 98 | Transport* transport, |
sprang | ebbf8a8 | 2015-09-21 15:11:14 -0700 | [diff] [blame] | 99 | RtpPacketSender* paced_sender, |
| 100 | TransportSequenceNumberAllocator* sequence_number_allocator, |
sprang | 5e023eb | 2015-09-14 06:42:43 -0700 | [diff] [blame] | 101 | TransportFeedbackObserver* transport_feedback_callback, |
andresp@webrtc.org | 8f15121 | 2014-07-10 09:39:23 +0000 | [diff] [blame] | 102 | BitrateStatisticsObserver* bitrate_callback, |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 103 | FrameCountObserver* frame_count_observer, |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame] | 104 | SendSideDelayObserver* send_side_delay_observer, |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 105 | RtcEventLog* event_log, |
sprang | cd349d9 | 2016-07-13 09:11:28 -0700 | [diff] [blame] | 106 | SendPacketObserver* send_packet_observer, |
| 107 | RateLimiter* nack_rate_limiter); |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 108 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 109 | virtual ~RTPSender(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 110 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 111 | void ProcessBitrate(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 112 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 113 | uint16_t ActualSendBitrateKbit() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 114 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 115 | uint32_t VideoBitrateSent() const; |
| 116 | uint32_t FecOverheadRate() const; |
| 117 | uint32_t NackOverheadRate() const; |
stefan@webrtc.org | d0bdab0 | 2011-10-14 14:24:54 +0000 | [diff] [blame] | 118 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 119 | // Includes size of RTP and FEC headers. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 120 | size_t MaxDataPayloadLength() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 121 | |
Peter Boström | 8b79b07 | 2016-02-26 16:31:37 +0100 | [diff] [blame] | 122 | int32_t RegisterPayload(const char* payload_name, |
| 123 | const int8_t payload_type, |
| 124 | const uint32_t frequency, |
| 125 | const size_t channels, |
| 126 | const uint32_t rate); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 127 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 128 | int32_t DeRegisterSendPayload(const int8_t payload_type); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 129 | |
andresp@webrtc.org | c3c2911 | 2014-08-27 09:39:43 +0000 | [diff] [blame] | 130 | void SetSendPayloadType(int8_t payload_type); |
| 131 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 132 | int8_t SendPayloadType() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 133 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 134 | int SendPayloadFrequency() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 135 | |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 136 | void SetSendingStatus(bool enabled); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 137 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 138 | void SetSendingMediaStatus(bool enabled); |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 139 | bool SendingMedia() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 140 | |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 141 | void GetDataCounters(StreamDataCounters* rtp_stats, |
| 142 | StreamDataCounters* rtx_stats) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 143 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 144 | uint32_t StartTimestamp() const; |
| 145 | void SetStartTimestamp(uint32_t timestamp, bool force); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 146 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 147 | uint32_t GenerateNewSSRC(); |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 148 | void SetSSRC(uint32_t ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 149 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 150 | uint16_t SequenceNumber() const override; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 151 | void SetSequenceNumber(uint16_t seq); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 152 | |
pbos@webrtc.org | 9334ac2 | 2014-11-24 08:25:50 +0000 | [diff] [blame] | 153 | void SetCsrcs(const std::vector<uint32_t>& csrcs); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 154 | |
danilchap | 41befce | 2016-03-30 11:11:51 -0700 | [diff] [blame] | 155 | void SetMaxPayloadLength(size_t max_payload_length); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 156 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 157 | int32_t SendOutgoingData(FrameType frame_type, |
| 158 | int8_t payload_type, |
| 159 | uint32_t timestamp, |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 160 | int64_t capture_time_ms, |
| 161 | const uint8_t* payload_data, |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 162 | size_t payload_size, |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 163 | const RTPFragmentationHeader* fragmentation, |
Sergey Ulanov | ec4f068 | 2016-07-28 15:19:10 -0700 | [diff] [blame^] | 164 | const RTPVideoHeader* rtp_header); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 165 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 166 | // RTP header extension |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 167 | int32_t SetTransmissionTimeOffset(int32_t transmission_time_offset); |
| 168 | int32_t SetAbsoluteSendTime(uint32_t absolute_send_time); |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 169 | void SetVideoRotation(VideoRotation rotation); |
sprang@webrtc.org | 3093390 | 2015-03-17 14:33:12 +0000 | [diff] [blame] | 170 | int32_t SetTransportSequenceNumber(uint16_t sequence_number); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 171 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 172 | int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 173 | bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) override; |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 174 | int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 175 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 176 | size_t RtpHeaderExtensionLength() const; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 177 | |
Sergey Ulanov | ec4f068 | 2016-07-28 15:19:10 -0700 | [diff] [blame^] | 178 | uint16_t BuildRtpHeaderExtension(uint8_t* data_buffer, bool marker_bit) const |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 179 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 180 | |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 181 | uint8_t BuildTransmissionTimeOffsetExtension(uint8_t* data_buffer) const |
| 182 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 183 | uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const |
| 184 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 185 | uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const |
| 186 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 187 | uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const |
| 188 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
sprang | 867fb52 | 2015-08-03 04:38:41 -0700 | [diff] [blame] | 189 | uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer, |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 190 | uint16_t sequence_number) const |
| 191 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 192 | uint8_t BuildPlayoutDelayExtension(uint8_t* data_buffer, |
| 193 | uint16_t min_playout_delay_ms, |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 194 | uint16_t max_playout_delay_ms) const |
| 195 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
sprang | 867fb52 | 2015-08-03 04:38:41 -0700 | [diff] [blame] | 196 | |
| 197 | // Verifies that the specified extension is registered, and that it is |
| 198 | // present in rtp packet. If extension is not registered kNotRegistered is |
| 199 | // returned. If extension cannot be found in the rtp header, or if it is |
| 200 | // malformed, kError is returned. Otherwise *extension_offset is set to the |
| 201 | // offset of the extension from the beginning of the rtp packet and kOk is |
| 202 | // returned. |
| 203 | enum class ExtensionStatus { |
| 204 | kNotRegistered, |
| 205 | kOk, |
| 206 | kError, |
| 207 | }; |
| 208 | ExtensionStatus VerifyExtension(RTPExtensionType extension_type, |
| 209 | uint8_t* rtp_packet, |
| 210 | size_t rtp_packet_length, |
| 211 | const RTPHeader& rtp_header, |
| 212 | size_t extension_length_bytes, |
| 213 | size_t* extension_offset) const |
tommi | ae695e9 | 2016-02-02 08:31:45 -0800 | [diff] [blame] | 214 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 215 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 216 | bool UpdateAudioLevel(uint8_t* rtp_packet, |
| 217 | size_t rtp_packet_length, |
| 218 | const RTPHeader& rtp_header, |
| 219 | bool is_voiced, |
| 220 | uint8_t dBov) const; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 221 | |
danilchap | 162abd3 | 2015-12-10 02:39:40 -0800 | [diff] [blame] | 222 | bool UpdateVideoRotation(uint8_t* rtp_packet, |
| 223 | size_t rtp_packet_length, |
| 224 | const RTPHeader& rtp_header, |
| 225 | VideoRotation rotation) const override; |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 226 | |
philipel | a1ed0b3 | 2016-06-01 06:31:17 -0700 | [diff] [blame] | 227 | bool TimeToSendPacket(uint16_t sequence_number, |
| 228 | int64_t capture_time_ms, |
| 229 | bool retransmission, |
| 230 | int probe_cluster_id); |
| 231 | size_t TimeToSendPadding(size_t bytes, int probe_cluster_id); |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 232 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 233 | // NACK. |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 234 | int SelectiveRetransmissions() const; |
| 235 | int SetSelectiveRetransmissions(uint8_t settings); |
stefan@webrtc.org | becf9c8 | 2013-02-01 15:09:57 +0000 | [diff] [blame] | 236 | void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers, |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 237 | int64_t avg_rtt); |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 238 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 239 | void SetStorePacketsStatus(bool enable, uint16_t number_to_store); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 240 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 241 | bool StorePackets() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 242 | |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 243 | int32_t ReSendPacket(uint16_t packet_id, int64_t min_resend_time = 0); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 244 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 245 | // Feedback to decide when to stop sending playout delay. |
| 246 | void OnReceivedRtcpReportBlocks(const ReportBlockList& report_blocks); |
| 247 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 248 | // RTX. |
pbos@webrtc.org | 0b0c241 | 2015-01-13 14:15:15 +0000 | [diff] [blame] | 249 | void SetRtxStatus(int mode); |
| 250 | int RtxStatus() const; |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 251 | |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 252 | uint32_t RtxSsrc() const; |
stefan@webrtc.org | ef92755 | 2014-06-05 08:25:29 +0000 | [diff] [blame] | 253 | void SetRtxSsrc(uint32_t ssrc); |
| 254 | |
Shao Changbin | e62202f | 2015-04-21 20:24:50 +0800 | [diff] [blame] | 255 | void SetRtxPayloadType(int payload_type, int associated_payload_type); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 256 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 257 | // Functions wrapping RTPSenderInterface. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 258 | int32_t BuildRTPheader(uint8_t* data_buffer, |
| 259 | int8_t payload_type, |
| 260 | bool marker_bit, |
| 261 | uint32_t capture_timestamp, |
| 262 | int64_t capture_time_ms, |
Sergey Ulanov | ec4f068 | 2016-07-28 15:19:10 -0700 | [diff] [blame^] | 263 | bool timestamp_provided = true, |
| 264 | bool inc_sequence_number = true) override; |
| 265 | int32_t BuildRtpHeader(uint8_t* data_buffer, |
| 266 | int8_t payload_type, |
| 267 | bool marker_bit, |
| 268 | uint32_t capture_timestamp, |
| 269 | int64_t capture_time_ms) override; |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 270 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 271 | size_t RtpHeaderLength() const override; |
mflodman | fcf54bd | 2015-04-14 21:28:08 +0200 | [diff] [blame] | 272 | uint16_t AllocateSequenceNumber(uint16_t packets_to_send) override; |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 273 | size_t MaxPayloadLength() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 274 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 275 | // Current timestamp. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 276 | uint32_t Timestamp() const override; |
| 277 | uint32_t SSRC() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 278 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 279 | int32_t SendToNetwork(uint8_t* data_buffer, |
| 280 | size_t payload_length, |
| 281 | size_t rtp_header_length, |
| 282 | int64_t capture_time_ms, |
| 283 | StorageType storage, |
sprang | ebbf8a8 | 2015-09-21 15:11:14 -0700 | [diff] [blame] | 284 | RtpPacketSender::Priority priority) override; |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 285 | |
| 286 | // Audio. |
| 287 | |
| 288 | // Send a DTMF tone using RFC 2833 (4733). |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 289 | int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 290 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 291 | // Set audio packet size, used to determine when it's time to send a DTMF |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 292 | // packet in silence (CNG). |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 293 | int32_t SetAudioPacketSize(uint16_t packet_size_samples); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 294 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 295 | // Store the audio level in d_bov for |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 296 | // header-extension-for-audio-level-indication. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 297 | int32_t SetAudioLevel(uint8_t level_d_bov); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 298 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 299 | // Set payload type for Redundant Audio Data RFC 2198. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 300 | int32_t SetRED(int8_t payload_type); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 301 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 302 | // Get payload type for Redundant Audio Data RFC 2198. |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 303 | int32_t RED(int8_t *payload_type) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 304 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 305 | RtpVideoCodecTypes VideoCodecType() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 306 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 307 | uint32_t MaxConfiguredBitrateVideo() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 308 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 309 | // FEC. |
pbos | ba8c15b | 2015-07-14 09:36:34 -0700 | [diff] [blame] | 310 | void SetGenericFECStatus(bool enable, |
| 311 | uint8_t payload_type_red, |
| 312 | uint8_t payload_type_fec); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 313 | |
pbos | ba8c15b | 2015-07-14 09:36:34 -0700 | [diff] [blame] | 314 | void GenericFECStatus(bool* enable, |
| 315 | uint8_t* payload_type_red, |
| 316 | uint8_t* payload_type_fec) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 317 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 318 | int32_t SetFecParameters(const FecProtectionParams *delta_params, |
| 319 | const FecProtectionParams *key_params); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 320 | |
Stefan Holmer | 586b19b | 2015-09-18 11:14:31 +0200 | [diff] [blame] | 321 | size_t SendPadData(size_t bytes, |
| 322 | bool timestamp_provided, |
| 323 | uint32_t timestamp, |
philipel | 46948c1 | 2016-06-01 04:04:40 -0700 | [diff] [blame] | 324 | int64_t capture_time_ms); |
philipel | a1ed0b3 | 2016-06-01 06:31:17 -0700 | [diff] [blame] | 325 | size_t SendPadData(size_t bytes, |
| 326 | bool timestamp_provided, |
| 327 | uint32_t timestamp, |
| 328 | int64_t capture_time_ms, |
| 329 | int probe_cluster_id); |
| 330 | |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 331 | // Called on update of RTP statistics. |
| 332 | void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback); |
| 333 | StreamDataCountersCallback* GetRtpStatisticsCallback() const; |
| 334 | |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 335 | uint32_t BitrateSent() const; |
| 336 | |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 337 | void SetRtpState(const RtpState& rtp_state); |
| 338 | RtpState GetRtpState() const; |
| 339 | void SetRtxRtpState(const RtpState& rtp_state); |
| 340 | RtpState GetRtxRtpState() const; |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 341 | bool ActivateCVORtpHeaderExtension() override; |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 342 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 343 | protected: |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 344 | int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 345 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 346 | private: |
stefan@webrtc.org | 0a3c147 | 2013-12-05 14:05:07 +0000 | [diff] [blame] | 347 | // Maps capture time in milliseconds to send-side delay in milliseconds. |
| 348 | // Send-side delay is the difference between transmission time and capture |
| 349 | // time. |
| 350 | typedef std::map<int64_t, int> SendDelayMap; |
| 351 | |
pbos@webrtc.org | 9334ac2 | 2014-11-24 08:25:50 +0000 | [diff] [blame] | 352 | size_t CreateRtpHeader(uint8_t* header, |
| 353 | int8_t payload_type, |
| 354 | uint32_t ssrc, |
| 355 | bool marker_bit, |
| 356 | uint32_t timestamp, |
| 357 | uint16_t sequence_number, |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 358 | const std::vector<uint32_t>& csrcs) const |
| 359 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
stefan@webrtc.org | a817962 | 2013-06-04 13:47:36 +0000 | [diff] [blame] | 360 | |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 361 | bool PrepareAndSendPacket(uint8_t* buffer, |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 362 | size_t length, |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 363 | int64_t capture_time_ms, |
stefan@webrtc.org | 7c6ff2d | 2014-03-19 18:14:52 +0000 | [diff] [blame] | 364 | bool send_over_rtx, |
philipel | a1ed0b3 | 2016-06-01 06:31:17 -0700 | [diff] [blame] | 365 | bool is_retransmit, |
| 366 | int probe_cluster_id); |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 367 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 368 | // Return the number of bytes sent. Note that both of these functions may |
| 369 | // return a larger value that their argument. |
philipel | a1ed0b3 | 2016-06-01 06:31:17 -0700 | [diff] [blame] | 370 | size_t TrySendRedundantPayloads(size_t bytes, int probe_cluster_id); |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 371 | |
Stefan Holmer | 586b19b | 2015-09-18 11:14:31 +0200 | [diff] [blame] | 372 | void BuildPaddingPacket(uint8_t* packet, |
| 373 | size_t header_length, |
| 374 | size_t padding_length); |
phoglund@webrtc.org | baaf243 | 2012-05-31 10:47:35 +0000 | [diff] [blame] | 375 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 376 | void BuildRtxPacket(uint8_t* buffer, size_t* length, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 377 | uint8_t* buffer_rtx); |
mikhal@webrtc.org | bda7f30 | 2013-03-15 23:21:52 +0000 | [diff] [blame] | 378 | |
stefan | 1d8a506 | 2015-10-02 03:39:33 -0700 | [diff] [blame] | 379 | bool SendPacketToNetwork(const uint8_t* packet, |
| 380 | size_t size, |
| 381 | const PacketOptions& options); |
pwestin@webrtc.org | b0061f9 | 2013-04-27 00:41:08 +0000 | [diff] [blame] | 382 | |
stefan@webrtc.org | 0a3c147 | 2013-12-05 14:05:07 +0000 | [diff] [blame] | 383 | void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms); |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 384 | void UpdateOnSendPacket(int packet_id, |
| 385 | int64_t capture_time_ms, |
| 386 | uint32_t ssrc); |
stefan@webrtc.org | 0a3c147 | 2013-12-05 14:05:07 +0000 | [diff] [blame] | 387 | |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 388 | // Find the byte position of the RTP extension as indicated by |type| in |
| 389 | // |rtp_packet|. Return false if such extension doesn't exist. |
| 390 | bool FindHeaderExtensionPosition(RTPExtensionType type, |
| 391 | const uint8_t* rtp_packet, |
| 392 | size_t rtp_packet_length, |
| 393 | const RTPHeader& rtp_header, |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 394 | size_t* position) const |
| 395 | EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 396 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 397 | void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, |
| 398 | size_t rtp_packet_length, |
| 399 | const RTPHeader& rtp_header, |
| 400 | int64_t time_diff_ms) const; |
| 401 | void UpdateAbsoluteSendTime(uint8_t* rtp_packet, |
| 402 | size_t rtp_packet_length, |
| 403 | const RTPHeader& rtp_header, |
| 404 | int64_t now_ms) const; |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 405 | |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 406 | bool UpdateTransportSequenceNumber(uint8_t* rtp_packet, |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 407 | size_t rtp_packet_length, |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 408 | const RTPHeader& rtp_header, |
| 409 | int* sequence_number) const; |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 410 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 411 | void UpdatePlayoutDelayLimits(uint8_t* rtp_packet, |
| 412 | size_t rtp_packet_length, |
| 413 | const RTPHeader& rtp_header, |
| 414 | uint16_t min_playout_delay, |
| 415 | uint16_t max_playout_delay) const; |
| 416 | |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 417 | bool AllocateTransportSequenceNumber(int* packet_id) const; |
stefan@webrtc.org | 420b256 | 2014-05-30 12:17:15 +0000 | [diff] [blame] | 418 | |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 419 | void UpdateRtpStats(const uint8_t* buffer, |
asapersson@webrtc.org | 97d0489 | 2014-12-09 09:47:53 +0000 | [diff] [blame] | 420 | size_t packet_length, |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 421 | const RTPHeader& header, |
| 422 | bool is_rtx, |
| 423 | bool is_retransmit); |
| 424 | bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; |
| 425 | |
tommi | ae695e9 | 2016-02-02 08:31:45 -0800 | [diff] [blame] | 426 | Clock* const clock_; |
| 427 | const int64_t clock_delta_ms_; |
danilchap | 47a740b | 2015-12-15 00:30:07 -0800 | [diff] [blame] | 428 | Random random_ GUARDED_BY(send_critsect_); |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 429 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 430 | const bool audio_configured_; |
kwiberg | 84be511 | 2016-04-27 01:19:58 -0700 | [diff] [blame] | 431 | const std::unique_ptr<RTPSenderAudio> audio_; |
| 432 | const std::unique_ptr<RTPSenderVideo> video_; |
phoglund@webrtc.org | baaf243 | 2012-05-31 10:47:35 +0000 | [diff] [blame] | 433 | |
sprang | ebbf8a8 | 2015-09-21 15:11:14 -0700 | [diff] [blame] | 434 | RtpPacketSender* const paced_sender_; |
| 435 | TransportSequenceNumberAllocator* const transport_sequence_number_allocator_; |
sprang | 5e023eb | 2015-09-14 06:42:43 -0700 | [diff] [blame] | 436 | TransportFeedbackObserver* const transport_feedback_observer_; |
sprang@webrtc.org | dcebf2d | 2014-11-04 16:27:16 +0000 | [diff] [blame] | 437 | int64_t last_capture_time_ms_sent_; |
tommi | ae695e9 | 2016-02-02 08:31:45 -0800 | [diff] [blame] | 438 | rtc::CriticalSection send_critsect_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 439 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 440 | Transport *transport_; |
sprang@webrtc.org | 5a320fb | 2014-03-13 15:12:37 +0000 | [diff] [blame] | 441 | bool sending_media_ GUARDED_BY(send_critsect_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 442 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 443 | size_t max_payload_length_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 444 | |
sprang@webrtc.org | efcad39 | 2014-03-25 16:51:35 +0000 | [diff] [blame] | 445 | int8_t payload_type_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 62bafae | 2014-07-08 12:10:51 +0000 | [diff] [blame] | 446 | std::map<int8_t, RtpUtility::Payload*> payload_type_map_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 447 | |
stefan | a23fc62 | 2016-07-28 07:56:38 -0700 | [diff] [blame] | 448 | RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 449 | int32_t transmission_time_offset_; |
solenberg@webrtc.org | 7ebbea1 | 2013-05-16 11:10:31 +0000 | [diff] [blame] | 450 | uint32_t absolute_send_time_; |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 451 | VideoRotation rotation_; |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 452 | bool video_rotation_active_; |
sprang@webrtc.org | 3093390 | 2015-03-17 14:33:12 +0000 | [diff] [blame] | 453 | uint16_t transport_sequence_number_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 454 | |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 455 | // Tracks the current request for playout delay limits from application |
| 456 | // and decides whether the current RTP frame should include the playout |
| 457 | // delay extension on header. |
| 458 | PlayoutDelayOracle playout_delay_oracle_; |
| 459 | bool playout_delay_active_ GUARDED_BY(send_critsect_); |
| 460 | |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 461 | RTPPacketHistory packet_history_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 462 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 463 | // Statistics |
danilchap | 7c9426c | 2016-04-14 03:05:31 -0700 | [diff] [blame] | 464 | rtc::CriticalSection statistics_crit_; |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 465 | SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 +0000 | [diff] [blame] | 466 | FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 467 | StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); |
| 468 | StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); |
| 469 | StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); |
sprang | cd349d9 | 2016-07-13 09:11:28 -0700 | [diff] [blame] | 470 | RateStatistics total_bitrate_sent_ GUARDED_BY(statistics_crit_); |
| 471 | RateStatistics nack_bitrate_sent_ GUARDED_BY(statistics_crit_); |
andresp@webrtc.org | 8f15121 | 2014-07-10 09:39:23 +0000 | [diff] [blame] | 472 | FrameCountObserver* const frame_count_observer_; |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 473 | SendSideDelayObserver* const send_side_delay_observer_; |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame] | 474 | RtcEventLog* const event_log_; |
asapersson | 35151f3 | 2016-05-02 23:44:01 -0700 | [diff] [blame] | 475 | SendPacketObserver* const send_packet_observer_; |
sprang | cd349d9 | 2016-07-13 09:11:28 -0700 | [diff] [blame] | 476 | BitrateStatisticsObserver* const bitrate_callback_; |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 477 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 478 | // RTP variables |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 479 | bool start_timestamp_forced_ GUARDED_BY(send_critsect_); |
| 480 | uint32_t start_timestamp_ GUARDED_BY(send_critsect_); |
tommi | ae695e9 | 2016-02-02 08:31:45 -0800 | [diff] [blame] | 481 | SSRCDatabase* const ssrc_db_; |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 482 | uint32_t remote_ssrc_ GUARDED_BY(send_critsect_); |
| 483 | bool sequence_number_forced_ GUARDED_BY(send_critsect_); |
| 484 | uint16_t sequence_number_ GUARDED_BY(send_critsect_); |
| 485 | uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_); |
| 486 | bool ssrc_forced_ GUARDED_BY(send_critsect_); |
| 487 | uint32_t ssrc_ GUARDED_BY(send_critsect_); |
| 488 | uint32_t timestamp_ GUARDED_BY(send_critsect_); |
| 489 | int64_t capture_time_ms_ GUARDED_BY(send_critsect_); |
| 490 | int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_); |
stefan@webrtc.org | 8b94e3d | 2014-07-17 16:10:14 +0000 | [diff] [blame] | 491 | bool media_has_been_sent_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 492 | bool last_packet_marker_bit_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 9334ac2 | 2014-11-24 08:25:50 +0000 | [diff] [blame] | 493 | std::vector<uint32_t> csrcs_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 494 | int rtx_ GUARDED_BY(send_critsect_); |
| 495 | uint32_t ssrc_rtx_ GUARDED_BY(send_critsect_); |
Shao Changbin | e62202f | 2015-04-21 20:24:50 +0800 | [diff] [blame] | 496 | // Mapping rtx_payload_type_map_[associated] = rtx. |
| 497 | std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); |
andresp@webrtc.org | d09d074 | 2014-03-26 14:27:34 +0000 | [diff] [blame] | 498 | |
sprang | cd349d9 | 2016-07-13 09:11:28 -0700 | [diff] [blame] | 499 | RateLimiter* const retransmission_rate_limiter_; |
terelius | 429c345 | 2016-01-21 05:42:04 -0800 | [diff] [blame] | 500 | |
| 501 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 502 | }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 503 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 504 | } // namespace webrtc |
| 505 | |
| 506 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |