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 <memory> | 16 #include <memory> |
| 17 #include <utility> | 17 #include <utility> |
| 18 #include <vector> | 18 #include <vector> |
| 19 | 19 |
| 20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
| 21 #include "webrtc/base/criticalsection.h" | 21 #include "webrtc/base/criticalsection.h" |
| 22 #include "webrtc/base/random.h" | 22 #include "webrtc/base/random.h" |
| 23 #include "webrtc/base/thread_annotations.h" | 23 #include "webrtc/base/thread_annotations.h" |
| 24 #include "webrtc/common_types.h" | 24 #include "webrtc/common_types.h" |
| 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 26 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" | 26 #include "webrtc/modules/rtp_rtcp/source/bitrate.h" |
| 27 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" | |
| 27 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
| 28 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" |
| 29 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
| 30 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 31 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" | 32 #include "webrtc/modules/rtp_rtcp/source/ssrc_database.h" |
| 32 #include "webrtc/transport.h" | 33 #include "webrtc/transport.h" |
| 33 | 34 |
| 34 namespace webrtc { | 35 namespace webrtc { |
| 35 | 36 |
| 36 class RTPSenderAudio; | 37 class RTPSenderAudio; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 int32_t SetAbsoluteSendTime(uint32_t absolute_send_time); | 166 int32_t SetAbsoluteSendTime(uint32_t absolute_send_time); |
| 166 void SetVideoRotation(VideoRotation rotation); | 167 void SetVideoRotation(VideoRotation rotation); |
| 167 int32_t SetTransportSequenceNumber(uint16_t sequence_number); | 168 int32_t SetTransportSequenceNumber(uint16_t sequence_number); |
| 168 | 169 |
| 169 int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); | 170 int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); |
| 170 bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) override; | 171 bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) override; |
| 171 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); | 172 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); |
| 172 | 173 |
| 173 size_t RtpHeaderExtensionTotalLength() const; | 174 size_t RtpHeaderExtensionTotalLength() const; |
| 174 | 175 |
| 175 uint16_t BuildRTPHeaderExtension(uint8_t* data_buffer, bool marker_bit) const; | 176 uint16_t BuildRTPHeaderExtension(uint32_t ssrc, |
| 177 uint8_t* data_buffer, | |
| 178 bool marker_bit) const; | |
|
sprang_webrtc
2016/05/24 14:46:08
RtpSender should already know which ssrc is used?
Irfan
2016/05/25 09:32:53
Removed
| |
| 176 | 179 |
| 177 uint8_t BuildTransmissionTimeOffsetExtension(uint8_t *data_buffer) const; | 180 uint8_t BuildTransmissionTimeOffsetExtension(uint8_t *data_buffer) const; |
| 178 uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const; | 181 uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const; |
| 179 uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const; | 182 uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const; |
| 180 uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const; | 183 uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const; |
| 181 uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer, | 184 uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer, |
| 182 uint16_t sequence_number) const; | 185 uint16_t sequence_number) const; |
| 186 uint8_t BuildPlayoutDelayExtension(uint8_t* data_buffer, | |
| 187 uint16_t min_playout_delay_ms, | |
| 188 uint16_t max_playout_delay_ms) const; | |
| 183 | 189 |
| 184 // Verifies that the specified extension is registered, and that it is | 190 // Verifies that the specified extension is registered, and that it is |
| 185 // present in rtp packet. If extension is not registered kNotRegistered is | 191 // present in rtp packet. If extension is not registered kNotRegistered is |
| 186 // returned. If extension cannot be found in the rtp header, or if it is | 192 // returned. If extension cannot be found in the rtp header, or if it is |
| 187 // malformed, kError is returned. Otherwise *extension_offset is set to the | 193 // malformed, kError is returned. Otherwise *extension_offset is set to the |
| 188 // offset of the extension from the beginning of the rtp packet and kOk is | 194 // offset of the extension from the beginning of the rtp packet and kOk is |
| 189 // returned. | 195 // returned. |
| 190 enum class ExtensionStatus { | 196 enum class ExtensionStatus { |
| 191 kNotRegistered, | 197 kNotRegistered, |
| 192 kOk, | 198 kOk, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 213 | 219 |
| 214 bool TimeToSendPacket(uint16_t sequence_number, int64_t capture_time_ms, | 220 bool TimeToSendPacket(uint16_t sequence_number, int64_t capture_time_ms, |
| 215 bool retransmission); | 221 bool retransmission); |
| 216 size_t TimeToSendPadding(size_t bytes); | 222 size_t TimeToSendPadding(size_t bytes); |
| 217 | 223 |
| 218 // NACK. | 224 // NACK. |
| 219 int SelectiveRetransmissions() const; | 225 int SelectiveRetransmissions() const; |
| 220 int SetSelectiveRetransmissions(uint8_t settings); | 226 int SetSelectiveRetransmissions(uint8_t settings); |
| 221 void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers, | 227 void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers, |
| 222 int64_t avg_rtt); | 228 int64_t avg_rtt); |
| 229 void OnReceivedRtcpReceiverReport(const ReportBlockList& report_blocks); | |
| 223 | 230 |
| 224 void SetStorePacketsStatus(bool enable, uint16_t number_to_store); | 231 void SetStorePacketsStatus(bool enable, uint16_t number_to_store); |
| 225 | 232 |
| 226 bool StorePackets() const; | 233 bool StorePackets() const; |
| 227 | 234 |
| 228 int32_t ReSendPacket(uint16_t packet_id, int64_t min_resend_time = 0); | 235 int32_t ReSendPacket(uint16_t packet_id, int64_t min_resend_time = 0); |
| 229 | 236 |
| 230 bool ProcessNACKBitRate(uint32_t now); | 237 bool ProcessNACKBitRate(uint32_t now); |
| 231 | 238 |
| 232 // RTX. | 239 // RTX. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, | 381 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, |
| 375 size_t rtp_packet_length, | 382 size_t rtp_packet_length, |
| 376 const RTPHeader& rtp_header, | 383 const RTPHeader& rtp_header, |
| 377 int64_t now_ms) const; | 384 int64_t now_ms) const; |
| 378 | 385 |
| 379 bool UpdateTransportSequenceNumber(uint16_t sequence_number, | 386 bool UpdateTransportSequenceNumber(uint16_t sequence_number, |
| 380 uint8_t* rtp_packet, | 387 uint8_t* rtp_packet, |
| 381 size_t rtp_packet_length, | 388 size_t rtp_packet_length, |
| 382 const RTPHeader& rtp_header) const; | 389 const RTPHeader& rtp_header) const; |
| 383 | 390 |
| 391 void UpdatePlayoutDelayLimits(uint8_t* rtp_packet, | |
| 392 size_t rtp_packet_length, | |
| 393 const RTPHeader& rtp_header, | |
| 394 uint16_t min_playout_delay, | |
| 395 uint16_t max_playout_delay) const; | |
| 396 | |
| 384 bool AllocateTransportSequenceNumber(int* packet_id) const; | 397 bool AllocateTransportSequenceNumber(int* packet_id) const; |
| 385 | 398 |
| 386 void UpdateRtpStats(const uint8_t* buffer, | 399 void UpdateRtpStats(const uint8_t* buffer, |
| 387 size_t packet_length, | 400 size_t packet_length, |
| 388 const RTPHeader& header, | 401 const RTPHeader& header, |
| 389 bool is_rtx, | 402 bool is_rtx, |
| 390 bool is_retransmit); | 403 bool is_retransmit); |
| 391 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; | 404 bool IsFecPacket(const uint8_t* buffer, const RTPHeader& header) const; |
| 392 | 405 |
| 393 class BitrateAggregator { | 406 class BitrateAggregator { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 uint32_t absolute_send_time_; | 465 uint32_t absolute_send_time_; |
| 453 VideoRotation rotation_; | 466 VideoRotation rotation_; |
| 454 CVOMode cvo_mode_; | 467 CVOMode cvo_mode_; |
| 455 uint16_t transport_sequence_number_; | 468 uint16_t transport_sequence_number_; |
| 456 | 469 |
| 457 // NACK | 470 // NACK |
| 458 uint32_t nack_byte_count_times_[NACK_BYTECOUNT_SIZE]; | 471 uint32_t nack_byte_count_times_[NACK_BYTECOUNT_SIZE]; |
| 459 size_t nack_byte_count_[NACK_BYTECOUNT_SIZE]; | 472 size_t nack_byte_count_[NACK_BYTECOUNT_SIZE]; |
| 460 Bitrate nack_bitrate_; | 473 Bitrate nack_bitrate_; |
| 461 | 474 |
| 475 // Tracks the current request for playout delay limits from application | |
| 476 // and decides whether the current RTP frame should include the playout | |
| 477 // delay extension on header. | |
| 478 PlayoutDelayOracle playout_delay_oracle_; | |
| 479 | |
| 462 RTPPacketHistory packet_history_; | 480 RTPPacketHistory packet_history_; |
| 463 | 481 |
| 464 // Statistics | 482 // Statistics |
| 465 rtc::CriticalSection statistics_crit_; | 483 rtc::CriticalSection statistics_crit_; |
| 466 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); | 484 SendDelayMap send_delays_ GUARDED_BY(statistics_crit_); |
| 467 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); | 485 FrameCounts frame_counts_ GUARDED_BY(statistics_crit_); |
| 468 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); | 486 StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_); |
| 469 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); | 487 StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_); |
| 470 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); | 488 StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_); |
| 471 FrameCountObserver* const frame_count_observer_; | 489 FrameCountObserver* const frame_count_observer_; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 500 // that the target bitrate is still valid. | 518 // that the target bitrate is still valid. |
| 501 rtc::CriticalSection target_bitrate_critsect_; | 519 rtc::CriticalSection target_bitrate_critsect_; |
| 502 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); | 520 uint32_t target_bitrate_ GUARDED_BY(target_bitrate_critsect_); |
| 503 | 521 |
| 504 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); | 522 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
| 505 }; | 523 }; |
| 506 | 524 |
| 507 } // namespace webrtc | 525 } // namespace webrtc |
| 508 | 526 |
| 509 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 527 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
| OLD | NEW |