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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 public: | 90 public: |
91 RTPSender(bool audio, | 91 RTPSender(bool audio, |
92 Clock* clock, | 92 Clock* clock, |
93 Transport* transport, | 93 Transport* transport, |
94 RtpPacketSender* paced_sender, | 94 RtpPacketSender* paced_sender, |
95 TransportSequenceNumberAllocator* sequence_number_allocator, | 95 TransportSequenceNumberAllocator* sequence_number_allocator, |
96 TransportFeedbackObserver* transport_feedback_callback, | 96 TransportFeedbackObserver* transport_feedback_callback, |
97 BitrateStatisticsObserver* bitrate_callback, | 97 BitrateStatisticsObserver* bitrate_callback, |
98 FrameCountObserver* frame_count_observer, | 98 FrameCountObserver* frame_count_observer, |
99 SendSideDelayObserver* send_side_delay_observer, | 99 SendSideDelayObserver* send_side_delay_observer, |
100 RtcEventLog* event_log); | 100 RtcEventLog* event_log, |
| 101 SendPacketObserver* send_packet_observer); |
| 102 |
101 virtual ~RTPSender(); | 103 virtual ~RTPSender(); |
102 | 104 |
103 void ProcessBitrate(); | 105 void ProcessBitrate(); |
104 | 106 |
105 uint16_t ActualSendBitrateKbit() const override; | 107 uint16_t ActualSendBitrateKbit() const override; |
106 | 108 |
107 uint32_t VideoBitrateSent() const; | 109 uint32_t VideoBitrateSent() const; |
108 uint32_t FecOverheadRate() const; | 110 uint32_t FecOverheadRate() const; |
109 uint32_t NackOverheadRate() const; | 111 uint32_t NackOverheadRate() const; |
110 | 112 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 size_t padding_length); | 348 size_t padding_length); |
347 | 349 |
348 void BuildRtxPacket(uint8_t* buffer, size_t* length, | 350 void BuildRtxPacket(uint8_t* buffer, size_t* length, |
349 uint8_t* buffer_rtx); | 351 uint8_t* buffer_rtx); |
350 | 352 |
351 bool SendPacketToNetwork(const uint8_t* packet, | 353 bool SendPacketToNetwork(const uint8_t* packet, |
352 size_t size, | 354 size_t size, |
353 const PacketOptions& options); | 355 const PacketOptions& options); |
354 | 356 |
355 void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms); | 357 void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms); |
| 358 void UpdateOnSendPacket(int packet_id, |
| 359 int64_t capture_time_ms, |
| 360 uint32_t ssrc); |
356 | 361 |
357 // Find the byte position of the RTP extension as indicated by |type| in | 362 // Find the byte position of the RTP extension as indicated by |type| in |
358 // |rtp_packet|. Return false if such extension doesn't exist. | 363 // |rtp_packet|. Return false if such extension doesn't exist. |
359 bool FindHeaderExtensionPosition(RTPExtensionType type, | 364 bool FindHeaderExtensionPosition(RTPExtensionType type, |
360 const uint8_t* rtp_packet, | 365 const uint8_t* rtp_packet, |
361 size_t rtp_packet_length, | 366 size_t rtp_packet_length, |
362 const RTPHeader& rtp_header, | 367 const RTPHeader& rtp_header, |
363 size_t* position) const; | 368 size_t* position) const; |
364 | 369 |
365 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, | 370 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, |
366 size_t rtp_packet_length, | 371 size_t rtp_packet_length, |
367 const RTPHeader& rtp_header, | 372 const RTPHeader& rtp_header, |
368 int64_t time_diff_ms) const; | 373 int64_t time_diff_ms) const; |
369 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, | 374 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, |
370 size_t rtp_packet_length, | 375 size_t rtp_packet_length, |
371 const RTPHeader& rtp_header, | 376 const RTPHeader& rtp_header, |
372 int64_t now_ms) const; | 377 int64_t now_ms) const; |
373 // Update the transport sequence number of the packet using a new sequence | 378 |
374 // number allocated by SequenceNumberAllocator. Returns the assigned sequence | 379 bool UpdateTransportSequenceNumber(uint16_t sequence_number, |
375 // number, or 0 if extension could not be updated. | 380 uint8_t* rtp_packet, |
376 uint16_t UpdateTransportSequenceNumber(uint8_t* rtp_packet, | 381 size_t rtp_packet_length, |
377 size_t rtp_packet_length, | 382 const RTPHeader& rtp_header) const; |
378 const RTPHeader& rtp_header) const; | 383 |
| 384 bool AllocateTransportSequenceNumber(int* packet_id) const; |
379 | 385 |
380 void UpdateRtpStats(const uint8_t* buffer, | 386 void UpdateRtpStats(const uint8_t* buffer, |
381 size_t packet_length, | 387 size_t packet_length, |
382 const RTPHeader& header, | 388 const RTPHeader& header, |
383 bool is_rtx, | 389 bool is_rtx, |
384 bool is_retransmit); | 390 bool is_retransmit); |
385 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; | 391 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; |
386 | 392 |
387 class BitrateAggregator { | 393 class BitrateAggregator { |
388 public: | 394 public: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // Statistics | 464 // Statistics |
459 rtc::CriticalSection statistics_crit_; | 465 rtc::CriticalSection statistics_crit_; |
460 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); | 466 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); |
461 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); | 467 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); |
462 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); | 468 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); |
463 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); | 469 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); |
464 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); | 470 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); |
465 FrameCountObserver* const frame_count_observer_; | 471 FrameCountObserver* const frame_count_observer_; |
466 SendSideDelayObserver* const send_side_delay_observer_; | 472 SendSideDelayObserver* const send_side_delay_observer_; |
467 RtcEventLog* const event_log_; | 473 RtcEventLog* const event_log_; |
| 474 SendPacketObserver* const send_packet_observer_; |
468 | 475 |
469 // RTP variables | 476 // RTP variables |
470 bool start_timestamp_forced_ GUARDED_BY(send_critsect_); | 477 bool start_timestamp_forced_ GUARDED_BY(send_critsect_); |
471 uint32_t start_timestamp_ GUARDED_BY(send_critsect_); | 478 uint32_t start_timestamp_ GUARDED_BY(send_critsect_); |
472 SSRCDatabase* const ssrc_db_; | 479 SSRCDatabase* const ssrc_db_; |
473 uint32_t remote_ssrc_ GUARDED_BY(send_critsect_); | 480 uint32_t remote_ssrc_ GUARDED_BY(send_critsect_); |
474 bool sequence_number_forced_ GUARDED_BY(send_critsect_); | 481 bool sequence_number_forced_ GUARDED_BY(send_critsect_); |
475 uint16_t sequence_number_ GUARDED_BY(send_critsect_); | 482 uint16_t sequence_number_ GUARDED_BY(send_critsect_); |
476 uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_); | 483 uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_); |
477 bool ssrc_forced_ GUARDED_BY(send_critsect_); | 484 bool ssrc_forced_ GUARDED_BY(send_critsect_); |
(...skipping 15 matching lines...) Expand all Loading... |
493 // that the target bitrate is still valid. | 500 // that the target bitrate is still valid. |
494 rtc::CriticalSection target_bitrate_critsect_; | 501 rtc::CriticalSection target_bitrate_critsect_; |
495 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); | 502 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); |
496 | 503 |
497 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); | 504 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
498 }; | 505 }; |
499 | 506 |
500 } // namespace webrtc | 507 } // namespace webrtc |
501 | 508 |
502 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 509 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
OLD | NEW |