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 18 matching lines...) Expand all Loading... |
29 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" | 29 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
34 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" | 34 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" |
35 #include "webrtc/transport.h" | 35 #include "webrtc/transport.h" |
36 | 36 |
37 namespace webrtc { | 37 namespace webrtc { |
38 | 38 |
| 39 class OverheadObserver; |
39 class RateLimiter; | 40 class RateLimiter; |
40 class RtcEventLog; | 41 class RtcEventLog; |
41 class RtpPacketToSend; | 42 class RtpPacketToSend; |
42 class RTPSenderAudio; | 43 class RTPSenderAudio; |
43 class RTPSenderVideo; | 44 class RTPSenderVideo; |
44 | 45 |
45 class RTPSender { | 46 class RTPSender { |
46 public: | 47 public: |
47 RTPSender(bool audio, | 48 RTPSender(bool audio, |
48 Clock* clock, | 49 Clock* clock, |
49 Transport* transport, | 50 Transport* transport, |
50 RtpPacketSender* paced_sender, | 51 RtpPacketSender* paced_sender, |
51 // TODO(brandtr): Remove |flexfec_sender| when that is hooked up | 52 // TODO(brandtr): Remove |flexfec_sender| when that is hooked up |
52 // to PacedSender instead. | 53 // to PacedSender instead. |
53 FlexfecSender* flexfec_sender, | 54 FlexfecSender* flexfec_sender, |
54 TransportSequenceNumberAllocator* sequence_number_allocator, | 55 TransportSequenceNumberAllocator* sequence_number_allocator, |
55 TransportFeedbackObserver* transport_feedback_callback, | 56 TransportFeedbackObserver* transport_feedback_callback, |
56 BitrateStatisticsObserver* bitrate_callback, | 57 BitrateStatisticsObserver* bitrate_callback, |
57 FrameCountObserver* frame_count_observer, | 58 FrameCountObserver* frame_count_observer, |
58 SendSideDelayObserver* send_side_delay_observer, | 59 SendSideDelayObserver* send_side_delay_observer, |
59 RtcEventLog* event_log, | 60 RtcEventLog* event_log, |
60 SendPacketObserver* send_packet_observer, | 61 SendPacketObserver* send_packet_observer, |
61 RateLimiter* nack_rate_limiter); | 62 RateLimiter* nack_rate_limiter, |
| 63 OverheadObserver* overhead_observer); |
62 | 64 |
63 ~RTPSender(); | 65 ~RTPSender(); |
64 | 66 |
65 void ProcessBitrate(); | 67 void ProcessBitrate(); |
66 | 68 |
67 uint16_t ActualSendBitrateKbit() const; | 69 uint16_t ActualSendBitrateKbit() const; |
68 | 70 |
69 uint32_t VideoBitrateSent() const; | 71 uint32_t VideoBitrateSent() const; |
70 uint32_t FecOverheadRate() const; | 72 uint32_t FecOverheadRate() const; |
71 uint32_t NackOverheadRate() const; | 73 uint32_t NackOverheadRate() const; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback); | 209 void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback); |
208 StreamDataCountersCallback* GetRtpStatisticsCallback() const; | 210 StreamDataCountersCallback* GetRtpStatisticsCallback() const; |
209 | 211 |
210 uint32_t BitrateSent() const; | 212 uint32_t BitrateSent() const; |
211 | 213 |
212 void SetRtpState(const RtpState& rtp_state); | 214 void SetRtpState(const RtpState& rtp_state); |
213 RtpState GetRtpState() const; | 215 RtpState GetRtpState() const; |
214 void SetRtxRtpState(const RtpState& rtp_state); | 216 void SetRtxRtpState(const RtpState& rtp_state); |
215 RtpState GetRtxRtpState() const; | 217 RtpState GetRtxRtpState() const; |
216 | 218 |
| 219 void SetTransportOverhead(int transport_overhead); |
| 220 |
217 protected: | 221 protected: |
218 int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type); | 222 int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type); |
219 | 223 |
220 private: | 224 private: |
221 // Maps capture time in milliseconds to send-side delay in milliseconds. | 225 // Maps capture time in milliseconds to send-side delay in milliseconds. |
222 // Send-side delay is the difference between transmission time and capture | 226 // Send-side delay is the difference between transmission time and capture |
223 // time. | 227 // time. |
224 typedef std::map<int64_t, int> SendDelayMap; | 228 typedef std::map<int64_t, int> SendDelayMap; |
225 | 229 |
226 size_t SendPadData(size_t bytes, int probe_cluster_id); | 230 size_t SendPadData(size_t bytes, int probe_cluster_id); |
(...skipping 25 matching lines...) Expand all Loading... |
252 uint32_t ssrc); | 256 uint32_t ssrc); |
253 | 257 |
254 bool UpdateTransportSequenceNumber(RtpPacketToSend* packet, | 258 bool UpdateTransportSequenceNumber(RtpPacketToSend* packet, |
255 int* packet_id) const; | 259 int* packet_id) const; |
256 | 260 |
257 void UpdateRtpStats(const RtpPacketToSend& packet, | 261 void UpdateRtpStats(const RtpPacketToSend& packet, |
258 bool is_rtx, | 262 bool is_rtx, |
259 bool is_retransmit); | 263 bool is_retransmit); |
260 bool IsFecPacket(const RtpPacketToSend& packet) const; | 264 bool IsFecPacket(const RtpPacketToSend& packet) const; |
261 | 265 |
| 266 void AddPacketToTransportFeedback(uint16_t packet_id, |
| 267 const RtpPacketToSend& packet, |
| 268 int probe_cluster_id); |
| 269 |
| 270 void UpdateRtpOverhead(const RtpPacketToSend& packet); |
| 271 |
262 Clock* const clock_; | 272 Clock* const clock_; |
263 const int64_t clock_delta_ms_; | 273 const int64_t clock_delta_ms_; |
264 Random random_ GUARDED_BY(send_critsect_); | 274 Random random_ GUARDED_BY(send_critsect_); |
265 | 275 |
266 const bool audio_configured_; | 276 const bool audio_configured_; |
267 const std::unique_ptr<RTPSenderAudio> audio_; | 277 const std::unique_ptr<RTPSenderAudio> audio_; |
268 const std::unique_ptr<RTPSenderVideo> video_; | 278 const std::unique_ptr<RTPSenderVideo> video_; |
269 | 279 |
270 RtpPacketSender* const paced_sender_; | 280 RtpPacketSender* const paced_sender_; |
271 TransportSequenceNumberAllocator* const transport_sequence_number_allocator_; | 281 TransportSequenceNumberAllocator* const transport_sequence_number_allocator_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 uint32_t last_rtp_timestamp_ GUARDED_BY(send_critsect_); | 330 uint32_t last_rtp_timestamp_ GUARDED_BY(send_critsect_); |
321 int64_t capture_time_ms_ GUARDED_BY(send_critsect_); | 331 int64_t capture_time_ms_ GUARDED_BY(send_critsect_); |
322 int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_); | 332 int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_); |
323 bool media_has_been_sent_ GUARDED_BY(send_critsect_); | 333 bool media_has_been_sent_ GUARDED_BY(send_critsect_); |
324 bool last_packet_marker_bit_ GUARDED_BY(send_critsect_); | 334 bool last_packet_marker_bit_ GUARDED_BY(send_critsect_); |
325 std::vector<uint32_t> csrcs_ GUARDED_BY(send_critsect_); | 335 std::vector<uint32_t> csrcs_ GUARDED_BY(send_critsect_); |
326 int rtx_ GUARDED_BY(send_critsect_); | 336 int rtx_ GUARDED_BY(send_critsect_); |
327 uint32_t ssrc_rtx_ GUARDED_BY(send_critsect_); | 337 uint32_t ssrc_rtx_ GUARDED_BY(send_critsect_); |
328 // Mapping rtx_payload_type_map_[associated] = rtx. | 338 // Mapping rtx_payload_type_map_[associated] = rtx. |
329 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); | 339 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); |
| 340 size_t transport_overhead_bytes_per_packet_ GUARDED_BY(send_critsect_); |
| 341 size_t rtp_overhead_bytes_per_packet_ GUARDED_BY(send_critsect_); |
330 | 342 |
331 RateLimiter* const retransmission_rate_limiter_; | 343 RateLimiter* const retransmission_rate_limiter_; |
| 344 OverheadObserver* overhead_observer_; |
332 | 345 |
333 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); | 346 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
334 }; | 347 }; |
335 | 348 |
336 } // namespace webrtc | 349 } // namespace webrtc |
337 | 350 |
338 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 351 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
OLD | NEW |