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