OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <memory> | 15 #include <memory> |
16 #include <utility> | 16 #include <utility> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/api/call/transport.h" | 19 #include "webrtc/api/call/transport.h" |
| 20 #include "webrtc/base/array_view.h" |
20 #include "webrtc/base/constructormagic.h" | 21 #include "webrtc/base/constructormagic.h" |
21 #include "webrtc/base/criticalsection.h" | 22 #include "webrtc/base/criticalsection.h" |
22 #include "webrtc/base/deprecation.h" | 23 #include "webrtc/base/deprecation.h" |
23 #include "webrtc/base/optional.h" | 24 #include "webrtc/base/optional.h" |
24 #include "webrtc/base/random.h" | 25 #include "webrtc/base/random.h" |
25 #include "webrtc/base/rate_statistics.h" | 26 #include "webrtc/base/rate_statistics.h" |
26 #include "webrtc/base/thread_annotations.h" | 27 #include "webrtc/base/thread_annotations.h" |
27 #include "webrtc/common_types.h" | 28 #include "webrtc/common_types.h" |
28 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" | 29 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" |
29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 ~RTPSender(); | 65 ~RTPSender(); |
65 | 66 |
66 void ProcessBitrate(); | 67 void ProcessBitrate(); |
67 | 68 |
68 uint16_t ActualSendBitrateKbit() const; | 69 uint16_t ActualSendBitrateKbit() const; |
69 | 70 |
70 uint32_t VideoBitrateSent() const; | 71 uint32_t VideoBitrateSent() const; |
71 uint32_t FecOverheadRate() const; | 72 uint32_t FecOverheadRate() const; |
72 uint32_t NackOverheadRate() const; | 73 uint32_t NackOverheadRate() const; |
73 | 74 |
74 // Excluding size of RTP and FEC headers. | |
75 size_t MaxPayloadSize() const; | |
76 | |
77 int32_t RegisterPayload(const char* payload_name, | 75 int32_t RegisterPayload(const char* payload_name, |
78 const int8_t payload_type, | 76 const int8_t payload_type, |
79 const uint32_t frequency, | 77 const uint32_t frequency, |
80 const size_t channels, | 78 const size_t channels, |
81 const uint32_t rate); | 79 const uint32_t rate); |
82 | 80 |
83 int32_t DeRegisterSendPayload(const int8_t payload_type); | 81 int32_t DeRegisterSendPayload(const int8_t payload_type); |
84 | 82 |
85 void SetSendPayloadType(int8_t payload_type); | 83 void SetSendPayloadType(int8_t payload_type); |
86 | 84 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 139 |
142 // RTX. | 140 // RTX. |
143 void SetRtxStatus(int mode); | 141 void SetRtxStatus(int mode); |
144 int RtxStatus() const; | 142 int RtxStatus() const; |
145 | 143 |
146 uint32_t RtxSsrc() const; | 144 uint32_t RtxSsrc() const; |
147 void SetRtxSsrc(uint32_t ssrc); | 145 void SetRtxSsrc(uint32_t ssrc); |
148 | 146 |
149 void SetRtxPayloadType(int payload_type, int associated_payload_type); | 147 void SetRtxPayloadType(int payload_type, int associated_payload_type); |
150 | 148 |
| 149 // Size info for header extensions used by FEC packets. |
| 150 static rtc::ArrayView<const RtpExtensionSize> FecExtensionSizes(); |
| 151 |
151 // Create empty packet, fills ssrc, csrcs and reserve place for header | 152 // Create empty packet, fills ssrc, csrcs and reserve place for header |
152 // extensions RtpSender updates before sending. | 153 // extensions RtpSender updates before sending. |
153 std::unique_ptr<RtpPacketToSend> AllocatePacket() const; | 154 std::unique_ptr<RtpPacketToSend> AllocatePacket() const; |
154 // Allocate sequence number for provided packet. | 155 // Allocate sequence number for provided packet. |
155 // Save packet's fields to generate padding that doesn't break media stream. | 156 // Save packet's fields to generate padding that doesn't break media stream. |
156 // Return false if sending was turned off. | 157 // Return false if sending was turned off. |
157 bool AssignSequenceNumber(RtpPacketToSend* packet); | 158 bool AssignSequenceNumber(RtpPacketToSend* packet); |
158 | 159 |
| 160 // Used for padding and FEC packets only. |
159 size_t RtpHeaderLength() const; | 161 size_t RtpHeaderLength() const; |
160 uint16_t AllocateSequenceNumber(uint16_t packets_to_send); | 162 uint16_t AllocateSequenceNumber(uint16_t packets_to_send); |
161 // Including RTP headers. | 163 // Including RTP headers. |
162 size_t MaxRtpPacketSize() const; | 164 size_t MaxRtpPacketSize() const; |
163 | 165 |
164 uint32_t SSRC() const; | 166 uint32_t SSRC() const; |
165 | 167 |
166 rtc::Optional<uint32_t> FlexfecSsrc() const; | 168 rtc::Optional<uint32_t> FlexfecSsrc() const; |
167 | 169 |
168 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet, | 170 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 OverheadObserver* overhead_observer_; | 326 OverheadObserver* overhead_observer_; |
325 | 327 |
326 const bool send_side_bwe_with_overhead_; | 328 const bool send_side_bwe_with_overhead_; |
327 | 329 |
328 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); | 330 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
329 }; | 331 }; |
330 | 332 |
331 } // namespace webrtc | 333 } // namespace webrtc |
332 | 334 |
333 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 335 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
OLD | NEW |