Chromium Code Reviews| 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 |
| 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 #include <map> | 15 #include <map> |
| 16 #include <utility> | 16 #include <utility> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/criticalsection.h" | |
| 19 #include "webrtc/base/random.h" | 20 #include "webrtc/base/random.h" |
| 20 #include "webrtc/base/thread_annotations.h" | 21 #include "webrtc/base/thread_annotations.h" |
| 21 #include "webrtc/common_types.h" | 22 #include "webrtc/common_types.h" |
| 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 23 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" | 24 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" |
| 24 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
| 25 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" |
| 26 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
| 27 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 28 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" | 29 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" |
| 29 #include "webrtc/transport.h" | 30 #include "webrtc/transport.h" |
| 30 | 31 |
| 31 namespace webrtc { | 32 namespace webrtc { |
| 32 | 33 |
| 33 class BitrateAggregator; | 34 class BitrateAggregator; |
| 34 class CriticalSectionWrapper; | |
| 35 class RTPSenderAudio; | 35 class RTPSenderAudio; |
| 36 class RTPSenderVideo; | 36 class RTPSenderVideo; |
| 37 class RtcEventLog; | 37 class RtcEventLog; |
| 38 | 38 |
| 39 class RTPSenderInterface { | 39 class RTPSenderInterface { |
| 40 public: | 40 public: |
| 41 RTPSenderInterface() {} | 41 RTPSenderInterface() {} |
| 42 virtual ~RTPSenderInterface() {} | 42 virtual ~RTPSenderInterface() {} |
| 43 | 43 |
| 44 enum CVOMode { | 44 enum CVOMode { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 RTPSender(bool audio, | 91 RTPSender(bool audio, |
| 92 Clock* clock, | 92 Clock* clock, |
| 93 Transport* transport, | 93 Transport* transport, |
| 94 RtpAudioFeedback* audio_feedback, | 94 RtpAudioFeedback* audio_feedback, |
| 95 RtpPacketSender* paced_sender, | 95 RtpPacketSender* paced_sender, |
| 96 TransportSequenceNumberAllocator* sequence_number_allocator, | 96 TransportSequenceNumberAllocator* sequence_number_allocator, |
| 97 TransportFeedbackObserver* transport_feedback_callback, | 97 TransportFeedbackObserver* transport_feedback_callback, |
| 98 BitrateStatisticsObserver* bitrate_callback, | 98 BitrateStatisticsObserver* bitrate_callback, |
| 99 FrameCountObserver* frame_count_observer, | 99 FrameCountObserver* frame_count_observer, |
| 100 SendSideDelayObserver* send_side_delay_observer, | 100 SendSideDelayObserver* send_side_delay_observer, |
| 101 RtcEventLog* event_log); | 101 RtcEventLog* event_log, |
| 102 SSRCDatabase* ssrc_database); | |
| 102 virtual ~RTPSender(); | 103 virtual ~RTPSender(); |
| 103 | 104 |
| 104 void ProcessBitrate(); | 105 void ProcessBitrate(); |
| 105 | 106 |
| 106 uint16_t ActualSendBitrateKbit() const override; | 107 uint16_t ActualSendBitrateKbit() const override; |
| 107 | 108 |
| 108 uint32_t VideoBitrateSent() const; | 109 uint32_t VideoBitrateSent() const; |
| 109 uint32_t FecOverheadRate() const; | 110 uint32_t FecOverheadRate() const; |
| 110 uint32_t NackOverheadRate() const; | 111 uint32_t NackOverheadRate() const; |
| 111 | 112 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 kNotRegistered, | 190 kNotRegistered, |
| 190 kOk, | 191 kOk, |
| 191 kError, | 192 kError, |
| 192 }; | 193 }; |
| 193 ExtensionStatus VerifyExtension(RTPExtensionType extension_type, | 194 ExtensionStatus VerifyExtension(RTPExtensionType extension_type, |
| 194 uint8_t* rtp_packet, | 195 uint8_t* rtp_packet, |
| 195 size_t rtp_packet_length, | 196 size_t rtp_packet_length, |
| 196 const RTPHeader& rtp_header, | 197 const RTPHeader& rtp_header, |
| 197 size_t extension_length_bytes, | 198 size_t extension_length_bytes, |
| 198 size_t* extension_offset) const | 199 size_t* extension_offset) const |
| 199 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_.get()); | 200 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 200 | 201 |
| 201 bool UpdateAudioLevel(uint8_t* rtp_packet, | 202 bool UpdateAudioLevel(uint8_t* rtp_packet, |
| 202 size_t rtp_packet_length, | 203 size_t rtp_packet_length, |
| 203 const RTPHeader& rtp_header, | 204 const RTPHeader& rtp_header, |
| 204 bool is_voiced, | 205 bool is_voiced, |
| 205 uint8_t dBov) const; | 206 uint8_t dBov) const; |
| 206 | 207 |
| 207 bool UpdateVideoRotation(uint8_t* rtp_packet, | 208 bool UpdateVideoRotation(uint8_t* rtp_packet, |
| 208 size_t rtp_packet_length, | 209 size_t rtp_packet_length, |
| 209 const RTPHeader& rtp_header, | 210 const RTPHeader& rtp_header, |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 size_t rtp_packet_length, | 380 size_t rtp_packet_length, |
| 380 const RTPHeader& rtp_header) const; | 381 const RTPHeader& rtp_header) const; |
| 381 | 382 |
| 382 void UpdateRtpStats(const uint8_t* buffer, | 383 void UpdateRtpStats(const uint8_t* buffer, |
| 383 size_t packet_length, | 384 size_t packet_length, |
| 384 const RTPHeader& header, | 385 const RTPHeader& header, |
| 385 bool is_rtx, | 386 bool is_rtx, |
| 386 bool is_retransmit); | 387 bool is_retransmit); |
| 387 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; | 388 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; |
| 388 | 389 |
| 389 Clock* clock_; | 390 Clock* const clock_; |
| 390 int64_t clock_delta_ms_; | 391 const int64_t clock_delta_ms_; |
| 391 Random random_ GUARDED_BY(send_critsect_); | 392 Random random_ GUARDED_BY(send_critsect_); |
| 392 | 393 |
| 393 rtc::scoped_ptr<BitrateAggregator> bitrates_; | 394 // TODO(tommi): BitrateAggregator doesn't need to be allocated this way. |
| 395 // it could be a regular member variable. | |
|
stefan-webrtc
2016/01/23 17:38:40
I guess the same is true for RTPSenderAudio/Video
tommi
2016/01/24 11:51:49
Moved the BitrateAggregator class declaration.
Fo
stefan-webrtc
2016/01/25 10:09:32
Ah, ok. Let's leave it as is for now then.
| |
| 396 const rtc::scoped_ptr<BitrateAggregator> bitrates_; | |
| 394 Bitrate total_bitrate_sent_; | 397 Bitrate total_bitrate_sent_; |
| 395 | 398 |
| 396 const bool audio_configured_; | 399 const bool audio_configured_; |
| 397 rtc::scoped_ptr<RTPSenderAudio> audio_; | 400 const rtc::scoped_ptr<RTPSenderAudio> audio_; |
| 398 rtc::scoped_ptr<RTPSenderVideo> video_; | 401 const rtc::scoped_ptr<RTPSenderVideo> video_; |
| 399 | 402 |
| 400 RtpPacketSender* const paced_sender_; | 403 RtpPacketSender* const paced_sender_; |
| 401 TransportSequenceNumberAllocator* const transport_sequence_number_allocator_; | 404 TransportSequenceNumberAllocator* const transport_sequence_number_allocator_; |
| 402 TransportFeedbackObserver* const transport_feedback_observer_; | 405 TransportFeedbackObserver* const transport_feedback_observer_; |
| 403 int64_t last_capture_time_ms_sent_; | 406 int64_t last_capture_time_ms_sent_; |
| 404 rtc::scoped_ptr<CriticalSectionWrapper> send_critsect_; | 407 rtc::CriticalSection send_critsect_; |
| 405 | 408 |
| 406 Transport *transport_; | 409 Transport *transport_; |
| 407 bool sending_media_ GUARDED_BY(send_critsect_); | 410 bool sending_media_ GUARDED_BY(send_critsect_); |
| 408 | 411 |
| 409 size_t max_payload_length_; | 412 size_t max_payload_length_; |
| 410 uint16_t packet_over_head_; | 413 uint16_t packet_over_head_; |
| 411 | 414 |
| 412 int8_t payload_type_ GUARDED_BY(send_critsect_); | 415 int8_t payload_type_ GUARDED_BY(send_critsect_); |
| 413 std::map<int8_t, RtpUtility::Payload*> payload_type_map_; | 416 std::map<int8_t, RtpUtility::Payload*> payload_type_map_; |
| 414 | 417 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 433 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); | 436 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); |
| 434 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); | 437 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); |
| 435 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); | 438 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); |
| 436 FrameCountObserver* const frame_count_observer_; | 439 FrameCountObserver* const frame_count_observer_; |
| 437 SendSideDelayObserver* const send_side_delay_observer_; | 440 SendSideDelayObserver* const send_side_delay_observer_; |
| 438 RtcEventLog* const event_log_; | 441 RtcEventLog* const event_log_; |
| 439 | 442 |
| 440 // RTP variables | 443 // RTP variables |
| 441 bool start_timestamp_forced_ GUARDED_BY(send_critsect_); | 444 bool start_timestamp_forced_ GUARDED_BY(send_critsect_); |
| 442 uint32_t start_timestamp_ GUARDED_BY(send_critsect_); | 445 uint32_t start_timestamp_ GUARDED_BY(send_critsect_); |
| 443 SSRCDatabase& ssrc_db_ GUARDED_BY(send_critsect_); | 446 SSRCDatabase* const ssrc_db_; |
| 444 uint32_t remote_ssrc_ GUARDED_BY(send_critsect_); | 447 uint32_t remote_ssrc_ GUARDED_BY(send_critsect_); |
| 445 bool sequence_number_forced_ GUARDED_BY(send_critsect_); | 448 bool sequence_number_forced_ GUARDED_BY(send_critsect_); |
| 446 uint16_t sequence_number_ GUARDED_BY(send_critsect_); | 449 uint16_t sequence_number_ GUARDED_BY(send_critsect_); |
| 447 uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_); | 450 uint16_t sequence_number_rtx_ GUARDED_BY(send_critsect_); |
| 448 bool ssrc_forced_ GUARDED_BY(send_critsect_); | 451 bool ssrc_forced_ GUARDED_BY(send_critsect_); |
| 449 uint32_t ssrc_ GUARDED_BY(send_critsect_); | 452 uint32_t ssrc_ GUARDED_BY(send_critsect_); |
| 450 uint32_t timestamp_ GUARDED_BY(send_critsect_); | 453 uint32_t timestamp_ GUARDED_BY(send_critsect_); |
| 451 int64_t capture_time_ms_ GUARDED_BY(send_critsect_); | 454 int64_t capture_time_ms_ GUARDED_BY(send_critsect_); |
| 452 int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_); | 455 int64_t last_timestamp_time_ms_ GUARDED_BY(send_critsect_); |
| 453 bool media_has_been_sent_ GUARDED_BY(send_critsect_); | 456 bool media_has_been_sent_ GUARDED_BY(send_critsect_); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 467 // that the target bitrate is still valid. | 470 // that the target bitrate is still valid. |
| 468 rtc::scoped_ptr<CriticalSectionWrapper> target_bitrate_critsect_; | 471 rtc::scoped_ptr<CriticalSectionWrapper> target_bitrate_critsect_; |
| 469 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); | 472 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); |
| 470 | 473 |
| 471 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); | 474 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
| 472 }; | 475 }; |
| 473 | 476 |
| 474 } // namespace webrtc | 477 } // namespace webrtc |
| 475 | 478 |
| 476 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 479 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
| OLD | NEW |