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_ |
| 13 | |
pbos@webrtc.org | 12dc1a3 | 2013-08-05 16:22:53 +0000 | [diff] [blame] | 14 | #include <assert.h> |
| 15 | #include <math.h> |
| 16 | |
pwestin@webrtc.org | 0074187 | 2012-01-19 15:56:10 +0000 | [diff] [blame] | 17 | #include <map> |
| 18 | |
pbos@webrtc.org | 38344ed | 2014-09-24 06:05:00 +0000 | [diff] [blame] | 19 | #include "webrtc/base/thread_annotations.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 20 | #include "webrtc/common_types.h" |
stefan@webrtc.org | 508a84b | 2013-06-17 12:53:37 +0000 | [diff] [blame] | 21 | #include "webrtc/modules/pacing/include/paced_sender.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 22 | #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" |
phoglund@webrtc.org | c38eef8 | 2013-01-07 10:18:30 +0000 | [diff] [blame] | 23 | #include "webrtc/modules/rtp_rtcp/source/bitrate.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 24 | #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 25 | #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 26 | #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
mflodman | 903c0f2 | 2015-03-31 15:07:16 +0200 | [diff] [blame] | 27 | #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 28 | #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 29 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 30 | #define MAX_INIT_RTP_SEQ_NUMBER 32767 // 2^15 -1. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | |
| 32 | namespace webrtc { |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 33 | |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 34 | class BitrateAggregator; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | class CriticalSectionWrapper; |
| 36 | class RTPSenderAudio; |
| 37 | class RTPSenderVideo; |
| 38 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 39 | class RTPSenderInterface { |
| 40 | public: |
| 41 | RTPSenderInterface() {} |
| 42 | virtual ~RTPSenderInterface() {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 43 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 44 | virtual uint32_t SSRC() const = 0; |
| 45 | virtual uint32_t Timestamp() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 46 | |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 47 | virtual int32_t BuildRTPheader(uint8_t* data_buffer, |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 48 | int8_t payload_type, |
| 49 | bool marker_bit, |
| 50 | uint32_t capture_timestamp, |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 51 | int64_t capture_time_ms, |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 52 | bool timestamp_provided = true, |
| 53 | bool inc_sequence_number = true) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 54 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 55 | virtual size_t RTPHeaderLength() const = 0; |
mflodman | 903c0f2 | 2015-03-31 15:07:16 +0200 | [diff] [blame] | 56 | // Returns the next sequence number to use for a packet and allocates |
| 57 | // 'packets_to_send' number of sequence numbers. It's important all allocated |
| 58 | // sequence numbers are used in sequence to avoid perceived packet loss. |
| 59 | virtual uint16_t AllocateSequenceNumber(uint16_t packets_to_send) = 0; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 60 | virtual uint16_t SequenceNumber() const = 0; |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 61 | virtual size_t MaxPayloadLength() const = 0; |
| 62 | virtual size_t MaxDataPayloadLength() const = 0; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 63 | virtual uint16_t PacketOverHead() const = 0; |
| 64 | virtual uint16_t ActualSendBitrateKbit() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 65 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 66 | virtual int32_t SendToNetwork( |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 67 | uint8_t *data_buffer, size_t payload_length, size_t rtp_header_length, |
stefan@webrtc.org | 508a84b | 2013-06-17 12:53:37 +0000 | [diff] [blame] | 68 | int64_t capture_time_ms, StorageType storage, |
| 69 | PacedSender::Priority priority) = 0; |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 70 | |
| 71 | virtual bool UpdateVideoRotation(uint8_t* rtp_packet, |
| 72 | size_t rtp_packet_length, |
| 73 | const RTPHeader& rtp_header, |
| 74 | VideoRotation rotation) const = 0; |
| 75 | virtual bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 76 | }; |
| 77 | |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 78 | class RTPSender : public RTPSenderInterface { |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 79 | public: |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 80 | RTPSender(int32_t id, |
| 81 | bool audio, |
| 82 | Clock* clock, |
| 83 | Transport* transport, |
| 84 | RtpAudioFeedback* audio_feedback, |
| 85 | PacedSender* paced_sender, |
andresp@webrtc.org | 8f15121 | 2014-07-10 09:39:23 +0000 | [diff] [blame] | 86 | BitrateStatisticsObserver* bitrate_callback, |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 87 | FrameCountObserver* frame_count_observer, |
| 88 | SendSideDelayObserver* send_side_delay_observer); |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 89 | virtual ~RTPSender(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 90 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 91 | void ProcessBitrate(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 92 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 93 | uint16_t ActualSendBitrateKbit() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 94 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 95 | uint32_t VideoBitrateSent() const; |
| 96 | uint32_t FecOverheadRate() const; |
| 97 | uint32_t NackOverheadRate() const; |
stefan@webrtc.org | d0bdab0 | 2011-10-14 14:24:54 +0000 | [diff] [blame] | 98 | |
stefan@webrtc.org | 0a3c147 | 2013-12-05 14:05:07 +0000 | [diff] [blame] | 99 | // Returns true if the statistics have been calculated, and false if no frame |
| 100 | // was sent within the statistics window. |
| 101 | bool GetSendSideDelay(int* avg_send_delay_ms, int* max_send_delay_ms) const; |
| 102 | |
stefan@webrtc.org | a15fbfd | 2014-06-17 17:32:05 +0000 | [diff] [blame] | 103 | void SetTargetBitrate(uint32_t bitrate); |
| 104 | uint32_t GetTargetBitrate(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 105 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 106 | // Includes size of RTP and FEC headers. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 107 | size_t MaxDataPayloadLength() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 108 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 109 | int32_t RegisterPayload( |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 110 | const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 111 | const int8_t payload_type, const uint32_t frequency, |
| 112 | const uint8_t channels, const uint32_t rate); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 113 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 114 | int32_t DeRegisterSendPayload(const int8_t payload_type); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 115 | |
andresp@webrtc.org | c3c2911 | 2014-08-27 09:39:43 +0000 | [diff] [blame] | 116 | void SetSendPayloadType(int8_t payload_type); |
| 117 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 118 | int8_t SendPayloadType() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 119 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 120 | int SendPayloadFrequency() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 121 | |
pbos@webrtc.org | 59f20bb | 2013-09-09 16:02:19 +0000 | [diff] [blame] | 122 | void SetSendingStatus(bool enabled); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 123 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 124 | void SetSendingMediaStatus(bool enabled); |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 125 | bool SendingMedia() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 126 | |
pbos@webrtc.org | 2f4b14e | 2014-07-15 15:25:39 +0000 | [diff] [blame] | 127 | void GetDataCounters(StreamDataCounters* rtp_stats, |
| 128 | StreamDataCounters* rtx_stats) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 129 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 130 | void ResetDataCounters(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 131 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 132 | uint32_t StartTimestamp() const; |
| 133 | void SetStartTimestamp(uint32_t timestamp, bool force); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 134 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 135 | uint32_t GenerateNewSSRC(); |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 136 | void SetSSRC(uint32_t ssrc); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 137 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 138 | uint16_t SequenceNumber() const override; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 139 | void SetSequenceNumber(uint16_t seq); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 140 | |
pbos@webrtc.org | 9334ac2 | 2014-11-24 08:25:50 +0000 | [diff] [blame] | 141 | void SetCsrcs(const std::vector<uint32_t>& csrcs); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 142 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 143 | int32_t SetMaxPayloadLength(size_t length, uint16_t packet_over_head); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 144 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 145 | int32_t SendOutgoingData(FrameType frame_type, |
| 146 | int8_t payload_type, |
| 147 | uint32_t timestamp, |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 148 | int64_t capture_time_ms, |
| 149 | const uint8_t* payload_data, |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 150 | size_t payload_size, |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 151 | const RTPFragmentationHeader* fragmentation, |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 152 | const RTPVideoHeader* rtp_hdr = NULL); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 153 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 154 | // RTP header extension |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 155 | int32_t SetTransmissionTimeOffset(int32_t transmission_time_offset); |
| 156 | int32_t SetAbsoluteSendTime(uint32_t absolute_send_time); |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 157 | void SetVideoRotation(VideoRotation rotation); |
sprang@webrtc.org | 3093390 | 2015-03-17 14:33:12 +0000 | [diff] [blame] | 158 | int32_t SetTransportSequenceNumber(uint16_t sequence_number); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 159 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 160 | int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 161 | virtual bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) override; |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 162 | int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 163 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 164 | size_t RtpHeaderExtensionTotalLength() const; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 165 | |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 166 | uint16_t BuildRTPHeaderExtension(uint8_t* data_buffer, bool marker_bit) const; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 167 | |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 168 | uint8_t BuildTransmissionTimeOffsetExtension(uint8_t *data_buffer) const; |
| 169 | uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const; |
| 170 | uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const; |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 171 | uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const; |
sprang@webrtc.org | 3093390 | 2015-03-17 14:33:12 +0000 | [diff] [blame] | 172 | uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer) const; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 173 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 174 | bool UpdateAudioLevel(uint8_t* rtp_packet, |
| 175 | size_t rtp_packet_length, |
| 176 | const RTPHeader& rtp_header, |
| 177 | bool is_voiced, |
| 178 | uint8_t dBov) const; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 179 | |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 180 | virtual bool UpdateVideoRotation(uint8_t* rtp_packet, |
| 181 | size_t rtp_packet_length, |
| 182 | const RTPHeader& rtp_header, |
| 183 | VideoRotation rotation) const override; |
| 184 | |
stefan@webrtc.org | 9b82f5a | 2013-11-13 15:29:21 +0000 | [diff] [blame] | 185 | bool TimeToSendPacket(uint16_t sequence_number, int64_t capture_time_ms, |
| 186 | bool retransmission); |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 187 | size_t TimeToSendPadding(size_t bytes); |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 188 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 189 | // NACK. |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 190 | int SelectiveRetransmissions() const; |
| 191 | int SetSelectiveRetransmissions(uint8_t settings); |
stefan@webrtc.org | becf9c8 | 2013-02-01 15:09:57 +0000 | [diff] [blame] | 192 | void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers, |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 193 | int64_t avg_rtt); |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 194 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 195 | void SetStorePacketsStatus(bool enable, uint16_t number_to_store); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 196 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 197 | bool StorePackets() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 198 | |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 199 | 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] | 200 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 201 | bool ProcessNACKBitRate(uint32_t now); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 202 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 203 | // RTX. |
pbos@webrtc.org | 0b0c241 | 2015-01-13 14:15:15 +0000 | [diff] [blame] | 204 | void SetRtxStatus(int mode); |
| 205 | int RtxStatus() const; |
mflodman@webrtc.org | 9f5ebb5 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 206 | |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 207 | uint32_t RtxSsrc() const; |
stefan@webrtc.org | ef92755 | 2014-06-05 08:25:29 +0000 | [diff] [blame] | 208 | void SetRtxSsrc(uint32_t ssrc); |
| 209 | |
andrew@webrtc.org | 8f27fcc | 2015-01-09 20:22:46 +0000 | [diff] [blame] | 210 | void SetRtxPayloadType(int payloadType); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 211 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 212 | // Functions wrapping RTPSenderInterface. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 213 | int32_t BuildRTPheader(uint8_t* data_buffer, |
| 214 | int8_t payload_type, |
| 215 | bool marker_bit, |
| 216 | uint32_t capture_timestamp, |
| 217 | int64_t capture_time_ms, |
| 218 | const bool timestamp_provided = true, |
| 219 | const bool inc_sequence_number = true) override; |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 220 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 221 | size_t RTPHeaderLength() const override; |
mflodman | 903c0f2 | 2015-03-31 15:07:16 +0200 | [diff] [blame] | 222 | uint16_t AllocateSequenceNumber(uint16_t packets_to_send) override; |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 223 | size_t MaxPayloadLength() const override; |
| 224 | uint16_t PacketOverHead() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 225 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 226 | // Current timestamp. |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 227 | uint32_t Timestamp() const override; |
| 228 | uint32_t SSRC() const override; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 229 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 230 | int32_t SendToNetwork(uint8_t* data_buffer, |
| 231 | size_t payload_length, |
| 232 | size_t rtp_header_length, |
| 233 | int64_t capture_time_ms, |
| 234 | StorageType storage, |
| 235 | PacedSender::Priority priority) override; |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 236 | |
| 237 | // Audio. |
| 238 | |
| 239 | // Send a DTMF tone using RFC 2833 (4733). |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 240 | 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] | 241 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 242 | // 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] | 243 | // packet in silence (CNG). |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 244 | int32_t SetAudioPacketSize(uint16_t packet_size_samples); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 245 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 246 | // Store the audio level in d_bov for |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 247 | // header-extension-for-audio-level-indication. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 248 | int32_t SetAudioLevel(uint8_t level_d_bov); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 249 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 250 | // Set payload type for Redundant Audio Data RFC 2198. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 251 | int32_t SetRED(int8_t payload_type); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 252 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 253 | // Get payload type for Redundant Audio Data RFC 2198. |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 254 | int32_t RED(int8_t *payload_type) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 255 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 256 | RtpVideoCodecTypes VideoCodecType() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 257 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 258 | uint32_t MaxConfiguredBitrateVideo() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 259 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 260 | int32_t SendRTPIntraRequest(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 261 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 262 | // FEC. |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 263 | int32_t SetGenericFECStatus(bool enable, |
| 264 | uint8_t payload_type_red, |
| 265 | uint8_t payload_type_fec); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 266 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 267 | int32_t GenericFECStatus(bool *enable, uint8_t *payload_type_red, |
| 268 | uint8_t *payload_type_fec) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 269 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 270 | int32_t SetFecParameters(const FecProtectionParams *delta_params, |
| 271 | const FecProtectionParams *key_params); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 272 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 273 | size_t SendPadData(uint32_t timestamp, |
| 274 | int64_t capture_time_ms, |
| 275 | size_t bytes); |
stefan@webrtc.org | c4726d0 | 2013-12-05 09:16:33 +0000 | [diff] [blame] | 276 | |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 277 | // Called on update of RTP statistics. |
| 278 | void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback); |
| 279 | StreamDataCountersCallback* GetRtpStatisticsCallback() const; |
| 280 | |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 281 | uint32_t BitrateSent() const; |
| 282 | |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 283 | void SetRtpState(const RtpState& rtp_state); |
| 284 | RtpState GetRtpState() const; |
| 285 | void SetRtxRtpState(const RtpState& rtp_state); |
| 286 | RtpState GetRtxRtpState() const; |
| 287 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 288 | protected: |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 289 | int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 290 | |
pwestin@webrtc.org | c66e8b3 | 2012-11-07 17:01:04 +0000 | [diff] [blame] | 291 | private: |
stefan@webrtc.org | 0a3c147 | 2013-12-05 14:05:07 +0000 | [diff] [blame] | 292 | // Maps capture time in milliseconds to send-side delay in milliseconds. |
| 293 | // Send-side delay is the difference between transmission time and capture |
| 294 | // time. |
| 295 | typedef std::map<int64_t, int> SendDelayMap; |
| 296 | |
pbos@webrtc.org | 9334ac2 | 2014-11-24 08:25:50 +0000 | [diff] [blame] | 297 | size_t CreateRtpHeader(uint8_t* header, |
| 298 | int8_t payload_type, |
| 299 | uint32_t ssrc, |
| 300 | bool marker_bit, |
| 301 | uint32_t timestamp, |
| 302 | uint16_t sequence_number, |
| 303 | const std::vector<uint32_t>& csrcs) const; |
stefan@webrtc.org | a817962 | 2013-06-04 13:47:36 +0000 | [diff] [blame] | 304 | |
stefan@webrtc.org | 11d8176 | 2014-12-19 09:52:24 +0000 | [diff] [blame] | 305 | void UpdateNACKBitRate(uint32_t bytes, int64_t now); |
pwestin@webrtc.org | 8281e7d | 2012-01-10 14:09:18 +0000 | [diff] [blame] | 306 | |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 307 | bool PrepareAndSendPacket(uint8_t* buffer, |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 308 | size_t length, |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 309 | int64_t capture_time_ms, |
stefan@webrtc.org | 7c6ff2d | 2014-03-19 18:14:52 +0000 | [diff] [blame] | 310 | bool send_over_rtx, |
| 311 | bool is_retransmit); |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 312 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 313 | // Return the number of bytes sent. Note that both of these functions may |
| 314 | // return a larger value that their argument. |
| 315 | size_t TrySendRedundantPayloads(size_t bytes); |
| 316 | size_t TrySendPadData(size_t bytes); |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 317 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 318 | size_t BuildPaddingPacket(uint8_t* packet, size_t header_length); |
phoglund@webrtc.org | baaf243 | 2012-05-31 10:47:35 +0000 | [diff] [blame] | 319 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 320 | void BuildRtxPacket(uint8_t* buffer, size_t* length, |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 321 | uint8_t* buffer_rtx); |
mikhal@webrtc.org | bda7f30 | 2013-03-15 23:21:52 +0000 | [diff] [blame] | 322 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 323 | bool SendPacketToNetwork(const uint8_t *packet, size_t size); |
pwestin@webrtc.org | b0061f9 | 2013-04-27 00:41:08 +0000 | [diff] [blame] | 324 | |
stefan@webrtc.org | 0a3c147 | 2013-12-05 14:05:07 +0000 | [diff] [blame] | 325 | void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms); |
| 326 | |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 327 | // Find the byte position of the RTP extension as indicated by |type| in |
| 328 | // |rtp_packet|. Return false if such extension doesn't exist. |
| 329 | bool FindHeaderExtensionPosition(RTPExtensionType type, |
| 330 | const uint8_t* rtp_packet, |
| 331 | size_t rtp_packet_length, |
| 332 | const RTPHeader& rtp_header, |
| 333 | size_t* position) const; |
| 334 | |
pbos@webrtc.org | d16e839 | 2014-12-19 13:49:55 +0000 | [diff] [blame] | 335 | void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, |
| 336 | size_t rtp_packet_length, |
| 337 | const RTPHeader& rtp_header, |
| 338 | int64_t time_diff_ms) const; |
| 339 | void UpdateAbsoluteSendTime(uint8_t* rtp_packet, |
| 340 | size_t rtp_packet_length, |
| 341 | const RTPHeader& rtp_header, |
| 342 | int64_t now_ms) const; |
stefan@webrtc.org | 420b256 | 2014-05-30 12:17:15 +0000 | [diff] [blame] | 343 | |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 344 | void UpdateRtpStats(const uint8_t* buffer, |
asapersson@webrtc.org | 97d0489 | 2014-12-09 09:47:53 +0000 | [diff] [blame] | 345 | size_t packet_length, |
sprang@webrtc.org | ebad765 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 346 | const RTPHeader& header, |
| 347 | bool is_rtx, |
| 348 | bool is_retransmit); |
| 349 | bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; |
| 350 | |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 351 | Clock* clock_; |
sprang@webrtc.org | dcebf2d | 2014-11-04 16:27:16 +0000 | [diff] [blame] | 352 | int64_t clock_delta_ms_; |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 353 | |
kwiberg@webrtc.org | 00b8f6b | 2015-02-26 14:34:55 +0000 | [diff] [blame] | 354 | rtc::scoped_ptr<BitrateAggregator> bitrates_; |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 355 | Bitrate total_bitrate_sent_; |
sprang@webrtc.org | 6811b6e | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 356 | |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 357 | int32_t id_; |
pbos@webrtc.org | 7c4d20f | 2015-02-12 12:20:08 +0000 | [diff] [blame] | 358 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 359 | const bool audio_configured_; |
kwiberg@webrtc.org | 00b8f6b | 2015-02-26 14:34:55 +0000 | [diff] [blame] | 360 | rtc::scoped_ptr<RTPSenderAudio> audio_; |
| 361 | rtc::scoped_ptr<RTPSenderVideo> video_; |
phoglund@webrtc.org | baaf243 | 2012-05-31 10:47:35 +0000 | [diff] [blame] | 362 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 363 | PacedSender *paced_sender_; |
sprang@webrtc.org | dcebf2d | 2014-11-04 16:27:16 +0000 | [diff] [blame] | 364 | int64_t last_capture_time_ms_sent_; |
kwiberg@webrtc.org | 00b8f6b | 2015-02-26 14:34:55 +0000 | [diff] [blame] | 365 | rtc::scoped_ptr<CriticalSectionWrapper> send_critsect_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 366 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 367 | Transport *transport_; |
sprang@webrtc.org | 5a320fb | 2014-03-13 15:12:37 +0000 | [diff] [blame] | 368 | bool sending_media_ GUARDED_BY(send_critsect_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 369 | |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 370 | size_t max_payload_length_; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 371 | uint16_t packet_over_head_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 372 | |
sprang@webrtc.org | efcad39 | 2014-03-25 16:51:35 +0000 | [diff] [blame] | 373 | int8_t payload_type_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 62bafae | 2014-07-08 12:10:51 +0000 | [diff] [blame] | 374 | std::map<int8_t, RtpUtility::Payload*> payload_type_map_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 375 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 376 | RtpHeaderExtensionMap rtp_header_extension_map_; |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 377 | int32_t transmission_time_offset_; |
solenberg@webrtc.org | 7ebbea1 | 2013-05-16 11:10:31 +0000 | [diff] [blame] | 378 | uint32_t absolute_send_time_; |
guoweis@webrtc.org | 4536289 | 2015-03-04 22:55:15 +0000 | [diff] [blame] | 379 | VideoRotation rotation_; |
sprang@webrtc.org | 3093390 | 2015-03-17 14:33:12 +0000 | [diff] [blame] | 380 | uint16_t transport_sequence_number_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 381 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 382 | // NACK |
pbos@webrtc.org | 2f44673 | 2013-04-08 11:08:41 +0000 | [diff] [blame] | 383 | uint32_t nack_byte_count_times_[NACK_BYTECOUNT_SIZE]; |
pkasting@chromium.org | 4591fbd | 2014-11-20 22:28:14 +0000 | [diff] [blame] | 384 | size_t nack_byte_count_[NACK_BYTECOUNT_SIZE]; |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 385 | Bitrate nack_bitrate_; |
asapersson@webrtc.org | 5249cc8 | 2011-12-16 14:31:37 +0000 | [diff] [blame] | 386 | |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 387 | RTPPacketHistory packet_history_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 388 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 389 | // Statistics |
kwiberg@webrtc.org | 00b8f6b | 2015-02-26 14:34:55 +0000 | [diff] [blame] | 390 | rtc::scoped_ptr<CriticalSectionWrapper> statistics_crit_; |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 391 | SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 +0000 | [diff] [blame] | 392 | FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 393 | StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); |
| 394 | StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); |
| 395 | StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); |
andresp@webrtc.org | 8f15121 | 2014-07-10 09:39:23 +0000 | [diff] [blame] | 396 | FrameCountObserver* const frame_count_observer_; |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 397 | SendSideDelayObserver* const send_side_delay_observer_; |
asapersson@webrtc.org | 0b3c35a | 2012-01-16 11:06:31 +0000 | [diff] [blame] | 398 | |
pwestin@webrtc.org | 571a1c0 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 399 | // RTP variables |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 400 | bool start_timestamp_forced_ GUARDED_BY(send_critsect_); |
| 401 | uint32_t start_timestamp_ GUARDED_BY(send_critsect_); |
| 402 | SSRCDatabase& ssrc_db_ GUARDED_BY(send_critsect_); |
| 403 | uint32_t remote_ssrc_ GUARDED_BY(send_critsect_); |
| 404 | bool sequence_number_forced_ GUARDED_BY(send_critsect_); |
| 405 | uint16_t sequence_number_ GUARDED_BY(send_critsect_); |
| 406 | uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_); |
| 407 | bool ssrc_forced_ GUARDED_BY(send_critsect_); |
| 408 | uint32_t ssrc_ GUARDED_BY(send_critsect_); |
| 409 | uint32_t timestamp_ GUARDED_BY(send_critsect_); |
| 410 | int64_t capture_time_ms_ GUARDED_BY(send_critsect_); |
| 411 | int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_); |
stefan@webrtc.org | 8b94e3d | 2014-07-17 16:10:14 +0000 | [diff] [blame] | 412 | bool media_has_been_sent_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 413 | bool last_packet_marker_bit_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 9334ac2 | 2014-11-24 08:25:50 +0000 | [diff] [blame] | 414 | std::vector<uint32_t> csrcs_ GUARDED_BY(send_critsect_); |
pbos@webrtc.org | 2bb1bda | 2014-07-07 13:06:48 +0000 | [diff] [blame] | 415 | int rtx_ GUARDED_BY(send_critsect_); |
| 416 | uint32_t ssrc_rtx_ GUARDED_BY(send_critsect_); |
andrew@webrtc.org | 8f27fcc | 2015-01-09 20:22:46 +0000 | [diff] [blame] | 417 | int payload_type_rtx_ GUARDED_BY(send_critsect_); |
andresp@webrtc.org | d09d074 | 2014-03-26 14:27:34 +0000 | [diff] [blame] | 418 | |
| 419 | // Note: Don't access this variable directly, always go through |
| 420 | // SetTargetBitrateKbps or GetTargetBitrateKbps. Also remember |
| 421 | // that by the time the function returns there is no guarantee |
| 422 | // that the target bitrate is still valid. |
kwiberg@webrtc.org | 00b8f6b | 2015-02-26 14:34:55 +0000 | [diff] [blame] | 423 | rtc::scoped_ptr<CriticalSectionWrapper> target_bitrate_critsect_; |
stefan@webrtc.org | aa0e56e | 2014-06-26 11:44:49 +0000 | [diff] [blame] | 424 | uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 425 | }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 426 | |
phoglund@webrtc.org | 43da54a | 2013-01-25 10:53:38 +0000 | [diff] [blame] | 427 | } // namespace webrtc |
| 428 | |
| 429 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |