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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 public: | 89 public: |
90 RTPSender(bool audio, | 90 RTPSender(bool audio, |
91 Clock* clock, | 91 Clock* clock, |
92 Transport* transport, | 92 Transport* transport, |
93 RtpAudioFeedback* audio_feedback, | 93 RtpAudioFeedback* audio_feedback, |
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 SendPacketObserver* send_packet_observer); |
100 virtual ~RTPSender(); | 101 virtual ~RTPSender(); |
101 | 102 |
102 void ProcessBitrate(); | 103 void ProcessBitrate(); |
103 | 104 |
104 uint16_t ActualSendBitrateKbit() const override; | 105 uint16_t ActualSendBitrateKbit() const override; |
105 | 106 |
106 uint32_t VideoBitrateSent() const; | 107 uint32_t VideoBitrateSent() const; |
107 uint32_t FecOverheadRate() const; | 108 uint32_t FecOverheadRate() const; |
108 uint32_t NackOverheadRate() const; | 109 uint32_t NackOverheadRate() const; |
109 | 110 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 size_t padding_length); | 347 size_t padding_length); |
347 | 348 |
348 void BuildRtxPacket(uint8_t* buffer, size_t* length, | 349 void BuildRtxPacket(uint8_t* buffer, size_t* length, |
349 uint8_t* buffer_rtx); | 350 uint8_t* buffer_rtx); |
350 | 351 |
351 bool SendPacketToNetwork(const uint8_t* packet, | 352 bool SendPacketToNetwork(const uint8_t* packet, |
352 size_t size, | 353 size_t size, |
353 const PacketOptions& options); | 354 const PacketOptions& options); |
354 | 355 |
355 void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms); | 356 void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms); |
| 357 void UpdateOnSendPacket(int packet_id, |
| 358 int64_t capture_time_ms, |
| 359 uint32_t ssrc); |
356 | 360 |
357 // Find the byte position of the RTP extension as indicated by |type| in | 361 // Find the byte position of the RTP extension as indicated by |type| in |
358 // |rtp_packet|. Return false if such extension doesn't exist. | 362 // |rtp_packet|. Return false if such extension doesn't exist. |
359 bool FindHeaderExtensionPosition(RTPExtensionType type, | 363 bool FindHeaderExtensionPosition(RTPExtensionType type, |
360 const uint8_t* rtp_packet, | 364 const uint8_t* rtp_packet, |
361 size_t rtp_packet_length, | 365 size_t rtp_packet_length, |
362 const RTPHeader& rtp_header, | 366 const RTPHeader& rtp_header, |
363 size_t* position) const; | 367 size_t* position) const; |
364 | 368 |
365 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, | 369 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, |
366 size_t rtp_packet_length, | 370 size_t rtp_packet_length, |
367 const RTPHeader& rtp_header, | 371 const RTPHeader& rtp_header, |
368 int64_t time_diff_ms) const; | 372 int64_t time_diff_ms) const; |
369 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, | 373 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, |
370 size_t rtp_packet_length, | 374 size_t rtp_packet_length, |
371 const RTPHeader& rtp_header, | 375 const RTPHeader& rtp_header, |
372 int64_t now_ms) const; | 376 int64_t now_ms) const; |
373 // Update the transport sequence number of the packet using a new sequence | 377 |
374 // number allocated by SequenceNumberAllocator. Returns the assigned sequence | 378 bool UpdateTransportSequenceNumber(uint16_t sequence_number, |
375 // number, or 0 if extension could not be updated. | 379 uint8_t* rtp_packet, |
376 uint16_t UpdateTransportSequenceNumber(uint8_t* rtp_packet, | 380 size_t rtp_packet_length, |
377 size_t rtp_packet_length, | 381 const RTPHeader& rtp_header) const; |
378 const RTPHeader& rtp_header) const; | 382 |
| 383 // Returns true if transport sequence number is used, false otherwise. |
| 384 // The |packet_id| is always updated with a new sequence number allocated by |
| 385 // the SequenceNumberAllocator (if allocator exists). |
| 386 bool UseTransportSequenceNumber(int* packet_id) const; |
379 | 387 |
380 void UpdateRtpStats(const uint8_t* buffer, | 388 void UpdateRtpStats(const uint8_t* buffer, |
381 size_t packet_length, | 389 size_t packet_length, |
382 const RTPHeader& header, | 390 const RTPHeader& header, |
383 bool is_rtx, | 391 bool is_rtx, |
384 bool is_retransmit); | 392 bool is_retransmit); |
385 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; | 393 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; |
386 | 394 |
387 Clock* clock_; | 395 Clock* clock_; |
388 int64_t clock_delta_ms_; | 396 int64_t clock_delta_ms_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 433 |
426 // Statistics | 434 // Statistics |
427 rtc::scoped_ptr<CriticalSectionWrapper> statistics_crit_; | 435 rtc::scoped_ptr<CriticalSectionWrapper> statistics_crit_; |
428 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); | 436 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); |
429 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); | 437 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); |
430 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); | 438 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); |
431 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); | 439 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); |
432 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); | 440 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); |
433 FrameCountObserver* const frame_count_observer_; | 441 FrameCountObserver* const frame_count_observer_; |
434 SendSideDelayObserver* const send_side_delay_observer_; | 442 SendSideDelayObserver* const send_side_delay_observer_; |
| 443 SendPacketObserver* const send_packet_observer_; |
435 | 444 |
436 // RTP variables | 445 // RTP variables |
437 bool start_timestamp_forced_ GUARDED_BY(send_critsect_); | 446 bool start_timestamp_forced_ GUARDED_BY(send_critsect_); |
438 uint32_t start_timestamp_ GUARDED_BY(send_critsect_); | 447 uint32_t start_timestamp_ GUARDED_BY(send_critsect_); |
439 SSRCDatabase& ssrc_db_ GUARDED_BY(send_critsect_); | 448 SSRCDatabase& ssrc_db_ GUARDED_BY(send_critsect_); |
440 uint32_t remote_ssrc_ GUARDED_BY(send_critsect_); | 449 uint32_t remote_ssrc_ GUARDED_BY(send_critsect_); |
441 bool sequence_number_forced_ GUARDED_BY(send_critsect_); | 450 bool sequence_number_forced_ GUARDED_BY(send_critsect_); |
442 uint16_t sequence_number_ GUARDED_BY(send_critsect_); | 451 uint16_t sequence_number_ GUARDED_BY(send_critsect_); |
443 uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_); | 452 uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_); |
444 bool ssrc_forced_ GUARDED_BY(send_critsect_); | 453 bool ssrc_forced_ GUARDED_BY(send_critsect_); |
(...skipping 16 matching lines...) Expand all Loading... |
461 // SetTargetBitrateKbps or GetTargetBitrateKbps. Also remember | 470 // SetTargetBitrateKbps or GetTargetBitrateKbps. Also remember |
462 // that by the time the function returns there is no guarantee | 471 // that by the time the function returns there is no guarantee |
463 // that the target bitrate is still valid. | 472 // that the target bitrate is still valid. |
464 rtc::scoped_ptr<CriticalSectionWrapper> target_bitrate_critsect_; | 473 rtc::scoped_ptr<CriticalSectionWrapper> target_bitrate_critsect_; |
465 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); | 474 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); |
466 }; | 475 }; |
467 | 476 |
468 } // namespace webrtc | 477 } // namespace webrtc |
469 | 478 |
470 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 479 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
OLD | NEW |