Index: webrtc/modules/rtp_rtcp/source/rtp_sender.h |
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.h b/webrtc/modules/rtp_rtcp/source/rtp_sender.h |
index 070c282d98a13bec5940e8a96d81d7d4225e0e3a..ffbcb817e709cb569da1ec09c0e5d43adfd14735 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.h |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.h |
@@ -24,6 +24,7 @@ |
#include "webrtc/common_types.h" |
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
#include "webrtc/modules/rtp_rtcp/source/bitrate.h" |
+#include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" |
#include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_history.h" |
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
@@ -42,14 +43,6 @@ class RTPSenderInterface { |
RTPSenderInterface() {} |
virtual ~RTPSenderInterface() {} |
- enum CVOMode { |
- kCVONone, |
- kCVOInactive, // CVO rtp header extension is registered but haven't |
- // received any frame with rotation pending. |
- kCVOActivated, // CVO rtp header extension will be present in the rtp |
- // packets. |
- }; |
- |
virtual uint32_t SSRC() const = 0; |
virtual uint32_t Timestamp() const = 0; |
@@ -61,7 +54,9 @@ class RTPSenderInterface { |
bool timestamp_provided = true, |
bool inc_sequence_number = true) = 0; |
- virtual size_t RTPHeaderLength() const = 0; |
+ // This returns the expected header length taking into consideration |
+ // the optional RTP header extensions that may not be currently active. |
+ virtual size_t RtpHeaderLength() const = 0; |
// Returns the next sequence number to use for a packet and allocates |
// 'packets_to_send' number of sequence numbers. It's important all allocated |
// sequence numbers are used in sequence to avoid perceived packet loss. |
@@ -83,7 +78,7 @@ class RTPSenderInterface { |
const RTPHeader& rtp_header, |
VideoRotation rotation) const = 0; |
virtual bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) = 0; |
- virtual CVOMode ActivateCVORtpHeaderExtension() = 0; |
+ virtual bool ActivateCVORtpHeaderExtension() = 0; |
}; |
class RTPSender : public RTPSenderInterface { |
@@ -170,7 +165,7 @@ class RTPSender : public RTPSenderInterface { |
bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) override; |
int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); |
- size_t RtpHeaderExtensionTotalLength() const; |
+ size_t RtpHeaderExtensionLength() const; |
uint16_t BuildRTPHeaderExtension(uint8_t* data_buffer, bool marker_bit) const; |
@@ -180,6 +175,9 @@ class RTPSender : public RTPSenderInterface { |
uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const; |
uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer, |
uint16_t sequence_number) const; |
+ uint8_t BuildPlayoutDelayExtension(uint8_t* data_buffer, |
+ uint16_t min_playout_delay_ms, |
+ uint16_t max_playout_delay_ms) const; |
// Verifies that the specified extension is registered, and that it is |
// present in rtp packet. If extension is not registered kNotRegistered is |
@@ -231,6 +229,9 @@ class RTPSender : public RTPSenderInterface { |
bool ProcessNACKBitRate(uint32_t now); |
+ // Feedback to decide when to stop sending playout delay. |
+ void OnReceivedRtcpReportBlocks(const ReportBlockList& report_blocks); |
+ |
// RTX. |
void SetRtxStatus(int mode); |
int RtxStatus() const; |
@@ -249,7 +250,7 @@ class RTPSender : public RTPSenderInterface { |
const bool timestamp_provided = true, |
const bool inc_sequence_number = true) override; |
- size_t RTPHeaderLength() const override; |
+ size_t RtpHeaderLength() const override; |
uint16_t AllocateSequenceNumber(uint16_t packets_to_send) override; |
size_t MaxPayloadLength() const override; |
@@ -320,7 +321,7 @@ class RTPSender : public RTPSenderInterface { |
RtpState GetRtpState() const; |
void SetRtxRtpState(const RtpState& rtp_state); |
RtpState GetRtxRtpState() const; |
- CVOMode ActivateCVORtpHeaderExtension() override; |
+ bool ActivateCVORtpHeaderExtension() override; |
protected: |
int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type); |
@@ -390,6 +391,12 @@ class RTPSender : public RTPSenderInterface { |
size_t rtp_packet_length, |
const RTPHeader& rtp_header) const; |
+ void UpdatePlayoutDelayLimits(uint8_t* rtp_packet, |
+ size_t rtp_packet_length, |
+ const RTPHeader& rtp_header, |
+ uint16_t min_playout_delay, |
+ uint16_t max_playout_delay) const; |
+ |
bool AllocateTransportSequenceNumber(int* packet_id) const; |
void UpdateRtpStats(const uint8_t* buffer, |
@@ -460,7 +467,7 @@ class RTPSender : public RTPSenderInterface { |
int32_t transmission_time_offset_; |
uint32_t absolute_send_time_; |
VideoRotation rotation_; |
- CVOMode cvo_mode_; |
+ bool video_rotation_active_; |
uint16_t transport_sequence_number_; |
// NACK |
@@ -468,6 +475,12 @@ class RTPSender : public RTPSenderInterface { |
size_t nack_byte_count_[NACK_BYTECOUNT_SIZE]; |
Bitrate nack_bitrate_; |
+ // Tracks the current request for playout delay limits from application |
+ // and decides whether the current RTP frame should include the playout |
+ // delay extension on header. |
+ PlayoutDelayOracle playout_delay_oracle_; |
+ bool playout_delay_active_ GUARDED_BY(send_critsect_); |
+ |
RTPPacketHistory packet_history_; |
// Statistics |