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/base/constructormagic.h" | 19 #include "webrtc/base/constructormagic.h" |
20 #include "webrtc/base/criticalsection.h" | 20 #include "webrtc/base/criticalsection.h" |
21 #include "webrtc/base/deprecation.h" | 21 #include "webrtc/base/deprecation.h" |
| 22 #include "webrtc/base/optional.h" |
22 #include "webrtc/base/random.h" | 23 #include "webrtc/base/random.h" |
23 #include "webrtc/base/rate_statistics.h" | 24 #include "webrtc/base/rate_statistics.h" |
24 #include "webrtc/base/thread_annotations.h" | 25 #include "webrtc/base/thread_annotations.h" |
25 #include "webrtc/common_types.h" | 26 #include "webrtc/common_types.h" |
26 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" | 27 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" |
27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 28 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
28 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" | 29 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" |
29 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const RTPVideoHeader* rtp_header, | 116 const RTPVideoHeader* rtp_header, |
116 uint32_t* transport_frame_id_out); | 117 uint32_t* transport_frame_id_out); |
117 | 118 |
118 // RTP header extension | 119 // RTP header extension |
119 int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); | 120 int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); |
120 bool IsRtpHeaderExtensionRegistered(RTPExtensionType type); | 121 bool IsRtpHeaderExtensionRegistered(RTPExtensionType type); |
121 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); | 122 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); |
122 | 123 |
123 size_t RtpHeaderExtensionLength() const; | 124 size_t RtpHeaderExtensionLength() const; |
124 | 125 |
125 bool TimeToSendPacket(uint16_t sequence_number, | 126 bool TimeToSendPacket(uint32_t ssrc, |
| 127 uint16_t sequence_number, |
126 int64_t capture_time_ms, | 128 int64_t capture_time_ms, |
127 bool retransmission, | 129 bool retransmission, |
128 int probe_cluster_id); | 130 int probe_cluster_id); |
129 size_t TimeToSendPadding(size_t bytes, int probe_cluster_id); | 131 size_t TimeToSendPadding(size_t bytes, int probe_cluster_id); |
130 | 132 |
131 // NACK. | 133 // NACK. |
132 int SelectiveRetransmissions() const; | 134 int SelectiveRetransmissions() const; |
133 int SetSelectiveRetransmissions(uint8_t settings); | 135 int SetSelectiveRetransmissions(uint8_t settings); |
134 void OnReceivedNack(const std::vector<uint16_t>& nack_sequence_numbers, | 136 void OnReceivedNack(const std::vector<uint16_t>& nack_sequence_numbers, |
135 int64_t avg_rtt); | 137 int64_t avg_rtt); |
(...skipping 23 matching lines...) Expand all Loading... |
159 // Save packet's fields to generate padding that doesn't break media stream. | 161 // Save packet's fields to generate padding that doesn't break media stream. |
160 // Return false if sending was turned off. | 162 // Return false if sending was turned off. |
161 bool AssignSequenceNumber(RtpPacketToSend* packet); | 163 bool AssignSequenceNumber(RtpPacketToSend* packet); |
162 | 164 |
163 size_t RtpHeaderLength() const; | 165 size_t RtpHeaderLength() const; |
164 uint16_t AllocateSequenceNumber(uint16_t packets_to_send); | 166 uint16_t AllocateSequenceNumber(uint16_t packets_to_send); |
165 size_t MaxPayloadLength() const; | 167 size_t MaxPayloadLength() const; |
166 | 168 |
167 uint32_t SSRC() const; | 169 uint32_t SSRC() const; |
168 | 170 |
| 171 rtc::Optional<uint32_t> FlexfecSsrc() const; |
| 172 |
169 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet, | 173 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet, |
170 StorageType storage, | 174 StorageType storage, |
171 RtpPacketSender::Priority priority); | 175 RtpPacketSender::Priority priority); |
172 | 176 |
173 // Audio. | 177 // Audio. |
174 | 178 |
175 // Send a DTMF tone using RFC 2833 (4733). | 179 // Send a DTMF tone using RFC 2833 (4733). |
176 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); | 180 int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); |
177 | 181 |
178 // Set audio packet size, used to determine when it's time to send a DTMF | 182 // Set audio packet size, used to determine when it's time to send a DTMF |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 std::map<int8_t, RtpUtility::Payload*> payload_type_map_; | 282 std::map<int8_t, RtpUtility::Payload*> payload_type_map_; |
279 | 283 |
280 RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(send_critsect_); | 284 RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(send_critsect_); |
281 | 285 |
282 // Tracks the current request for playout delay limits from application | 286 // Tracks the current request for playout delay limits from application |
283 // and decides whether the current RTP frame should include the playout | 287 // and decides whether the current RTP frame should include the playout |
284 // delay extension on header. | 288 // delay extension on header. |
285 PlayoutDelayOracle playout_delay_oracle_; | 289 PlayoutDelayOracle playout_delay_oracle_; |
286 | 290 |
287 RtpPacketHistory packet_history_; | 291 RtpPacketHistory packet_history_; |
| 292 // TODO(brandtr): Remove |flexfec_packet_history_| when the FlexfecSender |
| 293 // is hooked up to the PacedSender. |
| 294 RtpPacketHistory flexfec_packet_history_; |
288 | 295 |
289 // Statistics | 296 // Statistics |
290 rtc::CriticalSection statistics_crit_; | 297 rtc::CriticalSection statistics_crit_; |
291 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); | 298 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); |
292 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); | 299 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); |
293 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); | 300 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); |
294 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); | 301 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); |
295 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); | 302 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); |
296 RateStatistics total_bitrate_sent_ GUARDED_BY(statistics_crit_); | 303 RateStatistics total_bitrate_sent_ GUARDED_BY(statistics_crit_); |
297 RateStatistics nack_bitrate_sent_ GUARDED_BY(statistics_crit_); | 304 RateStatistics nack_bitrate_sent_ GUARDED_BY(statistics_crit_); |
(...skipping 24 matching lines...) Expand all Loading... |
322 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); | 329 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); |
323 | 330 |
324 RateLimiter* const retransmission_rate_limiter_; | 331 RateLimiter* const retransmission_rate_limiter_; |
325 | 332 |
326 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); | 333 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
327 }; | 334 }; |
328 | 335 |
329 } // namespace webrtc | 336 } // namespace webrtc |
330 | 337 |
331 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 338 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
OLD | NEW |