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 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 ~RTPSender(); | 65 ~RTPSender(); |
66 | 66 |
67 void ProcessBitrate(); | 67 void ProcessBitrate(); |
68 | 68 |
69 uint16_t ActualSendBitrateKbit() const; | 69 uint16_t ActualSendBitrateKbit() const; |
70 | 70 |
71 uint32_t VideoBitrateSent() const; | 71 uint32_t VideoBitrateSent() const; |
72 uint32_t FecOverheadRate() const; | 72 uint32_t FecOverheadRate() const; |
73 uint32_t NackOverheadRate() const; | 73 uint32_t NackOverheadRate() const; |
74 | 74 |
75 // Includes size of RTP and FEC headers. | 75 // Excluding size of RTP and FEC headers. |
76 size_t MaxDataPayloadLength() const; | 76 size_t MaxPayloadSize() const; |
77 | 77 |
78 int32_t RegisterPayload(const char* payload_name, | 78 int32_t RegisterPayload(const char* payload_name, |
79 const int8_t payload_type, | 79 const int8_t payload_type, |
80 const uint32_t frequency, | 80 const uint32_t frequency, |
81 const size_t channels, | 81 const size_t channels, |
82 const uint32_t rate); | 82 const uint32_t rate); |
83 | 83 |
84 int32_t DeRegisterSendPayload(const int8_t payload_type); | 84 int32_t DeRegisterSendPayload(const int8_t payload_type); |
85 | 85 |
86 void SetSendPayloadType(int8_t payload_type); | 86 void SetSendPayloadType(int8_t payload_type); |
(...skipping 12 matching lines...) Expand all Loading... |
99 void SetTimestampOffset(uint32_t timestamp); | 99 void SetTimestampOffset(uint32_t timestamp); |
100 | 100 |
101 uint32_t GenerateNewSSRC(); | 101 uint32_t GenerateNewSSRC(); |
102 void SetSSRC(uint32_t ssrc); | 102 void SetSSRC(uint32_t ssrc); |
103 | 103 |
104 uint16_t SequenceNumber() const; | 104 uint16_t SequenceNumber() const; |
105 void SetSequenceNumber(uint16_t seq); | 105 void SetSequenceNumber(uint16_t seq); |
106 | 106 |
107 void SetCsrcs(const std::vector<uint32_t>& csrcs); | 107 void SetCsrcs(const std::vector<uint32_t>& csrcs); |
108 | 108 |
109 void SetMaxPayloadLength(size_t max_payload_length); | 109 void SetMaxRtpPacketSize(size_t max_packet_size); |
110 | 110 |
111 bool SendOutgoingData(FrameType frame_type, | 111 bool SendOutgoingData(FrameType frame_type, |
112 int8_t payload_type, | 112 int8_t payload_type, |
113 uint32_t timestamp, | 113 uint32_t timestamp, |
114 int64_t capture_time_ms, | 114 int64_t capture_time_ms, |
115 const uint8_t* payload_data, | 115 const uint8_t* payload_data, |
116 size_t payload_size, | 116 size_t payload_size, |
117 const RTPFragmentationHeader* fragmentation, | 117 const RTPFragmentationHeader* fragmentation, |
118 const RTPVideoHeader* rtp_header, | 118 const RTPVideoHeader* rtp_header, |
119 uint32_t* transport_frame_id_out); | 119 uint32_t* transport_frame_id_out); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Create empty packet, fills ssrc, csrcs and reserve place for header | 157 // Create empty packet, fills ssrc, csrcs and reserve place for header |
158 // extensions RtpSender updates before sending. | 158 // extensions RtpSender updates before sending. |
159 std::unique_ptr<RtpPacketToSend> AllocatePacket() const; | 159 std::unique_ptr<RtpPacketToSend> AllocatePacket() const; |
160 // Allocate sequence number for provided packet. | 160 // Allocate sequence number for provided packet. |
161 // 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. |
162 // Return false if sending was turned off. | 162 // Return false if sending was turned off. |
163 bool AssignSequenceNumber(RtpPacketToSend* packet); | 163 bool AssignSequenceNumber(RtpPacketToSend* packet); |
164 | 164 |
165 size_t RtpHeaderLength() const; | 165 size_t RtpHeaderLength() const; |
166 uint16_t AllocateSequenceNumber(uint16_t packets_to_send); | 166 uint16_t AllocateSequenceNumber(uint16_t packets_to_send); |
167 size_t MaxPayloadLength() const; | 167 // Including RTP headers. |
| 168 size_t MaxRtpPacketSize() const; |
168 | 169 |
169 uint32_t SSRC() const; | 170 uint32_t SSRC() const; |
170 | 171 |
171 rtc::Optional<uint32_t> FlexfecSsrc() const; | 172 rtc::Optional<uint32_t> FlexfecSsrc() const; |
172 | 173 |
173 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet, | 174 bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet, |
174 StorageType storage, | 175 StorageType storage, |
175 RtpPacketSender::Priority priority); | 176 RtpPacketSender::Priority priority); |
176 | 177 |
177 // Audio. | 178 // Audio. |
(...skipping 23 matching lines...) Expand all Loading... |
201 void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback); | 202 void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback); |
202 StreamDataCountersCallback* GetRtpStatisticsCallback() const; | 203 StreamDataCountersCallback* GetRtpStatisticsCallback() const; |
203 | 204 |
204 uint32_t BitrateSent() const; | 205 uint32_t BitrateSent() const; |
205 | 206 |
206 void SetRtpState(const RtpState& rtp_state); | 207 void SetRtpState(const RtpState& rtp_state); |
207 RtpState GetRtpState() const; | 208 RtpState GetRtpState() const; |
208 void SetRtxRtpState(const RtpState& rtp_state); | 209 void SetRtxRtpState(const RtpState& rtp_state); |
209 RtpState GetRtxRtpState() const; | 210 RtpState GetRtxRtpState() const; |
210 | 211 |
211 void SetTransportOverhead(int transport_overhead); | |
212 | |
213 protected: | 212 protected: |
214 int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type); | 213 int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type); |
215 | 214 |
216 private: | 215 private: |
217 // Maps capture time in milliseconds to send-side delay in milliseconds. | 216 // Maps capture time in milliseconds to send-side delay in milliseconds. |
218 // Send-side delay is the difference between transmission time and capture | 217 // Send-side delay is the difference between transmission time and capture |
219 // time. | 218 // time. |
220 typedef std::map<int64_t, int> SendDelayMap; | 219 typedef std::map<int64_t, int> SendDelayMap; |
221 | 220 |
222 size_t SendPadData(size_t bytes, int probe_cluster_id); | 221 size_t SendPadData(size_t bytes, int probe_cluster_id); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 264 |
266 RtpPacketSender* const paced_sender_; | 265 RtpPacketSender* const paced_sender_; |
267 TransportSequenceNumberAllocator* const transport_sequence_number_allocator_; | 266 TransportSequenceNumberAllocator* const transport_sequence_number_allocator_; |
268 TransportFeedbackObserver* const transport_feedback_observer_; | 267 TransportFeedbackObserver* const transport_feedback_observer_; |
269 int64_t last_capture_time_ms_sent_; | 268 int64_t last_capture_time_ms_sent_; |
270 rtc::CriticalSection send_critsect_; | 269 rtc::CriticalSection send_critsect_; |
271 | 270 |
272 Transport* transport_; | 271 Transport* transport_; |
273 bool sending_media_ GUARDED_BY(send_critsect_); | 272 bool sending_media_ GUARDED_BY(send_critsect_); |
274 | 273 |
275 size_t max_payload_length_; | 274 size_t max_packet_size_; |
276 | 275 |
277 int8_t payload_type_ GUARDED_BY(send_critsect_); | 276 int8_t payload_type_ GUARDED_BY(send_critsect_); |
278 std::map<int8_t, RtpUtility::Payload*> payload_type_map_; | 277 std::map<int8_t, RtpUtility::Payload*> payload_type_map_; |
279 | 278 |
280 RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(send_critsect_); | 279 RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(send_critsect_); |
281 | 280 |
282 // Tracks the current request for playout delay limits from application | 281 // Tracks the current request for playout delay limits from application |
283 // and decides whether the current RTP frame should include the playout | 282 // and decides whether the current RTP frame should include the playout |
284 // delay extension on header. | 283 // delay extension on header. |
285 PlayoutDelayOracle playout_delay_oracle_; | 284 PlayoutDelayOracle playout_delay_oracle_; |
(...skipping 30 matching lines...) Expand all Loading... |
316 uint32_t last_rtp_timestamp_ GUARDED_BY(send_critsect_); | 315 uint32_t last_rtp_timestamp_ GUARDED_BY(send_critsect_); |
317 int64_t capture_time_ms_ GUARDED_BY(send_critsect_); | 316 int64_t capture_time_ms_ GUARDED_BY(send_critsect_); |
318 int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_); | 317 int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_); |
319 bool media_has_been_sent_ GUARDED_BY(send_critsect_); | 318 bool media_has_been_sent_ GUARDED_BY(send_critsect_); |
320 bool last_packet_marker_bit_ GUARDED_BY(send_critsect_); | 319 bool last_packet_marker_bit_ GUARDED_BY(send_critsect_); |
321 std::vector<uint32_t> csrcs_ GUARDED_BY(send_critsect_); | 320 std::vector<uint32_t> csrcs_ GUARDED_BY(send_critsect_); |
322 int rtx_ GUARDED_BY(send_critsect_); | 321 int rtx_ GUARDED_BY(send_critsect_); |
323 uint32_t ssrc_rtx_ GUARDED_BY(send_critsect_); | 322 uint32_t ssrc_rtx_ GUARDED_BY(send_critsect_); |
324 // Mapping rtx_payload_type_map_[associated] = rtx. | 323 // Mapping rtx_payload_type_map_[associated] = rtx. |
325 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); | 324 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); |
326 size_t transport_overhead_bytes_per_packet_ GUARDED_BY(send_critsect_); | |
327 size_t rtp_overhead_bytes_per_packet_ GUARDED_BY(send_critsect_); | 325 size_t rtp_overhead_bytes_per_packet_ GUARDED_BY(send_critsect_); |
328 | 326 |
329 RateLimiter* const retransmission_rate_limiter_; | 327 RateLimiter* const retransmission_rate_limiter_; |
330 OverheadObserver* overhead_observer_; | 328 OverheadObserver* overhead_observer_; |
331 | 329 |
332 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); | 330 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
333 }; | 331 }; |
334 | 332 |
335 } // namespace webrtc | 333 } // namespace webrtc |
336 | 334 |
337 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 335 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
OLD | NEW |