Revert "Revert of Propagate probing cluster id to SendTimeHistory. (patchset #5 id:80001 of https://codereview.webrtc.org/2005313003/ )"

This reverts commit 46948c17fd09e4957bebc8ea61f0a8e77ff84b48.
TBR=mflodman@webrtc.org
BUG=webrtc:5859

Review-Url: https://codereview.webrtc.org/2032473002
Cr-Commit-Position: refs/heads/master@{#12992}
This commit is contained in:
philipel
2016-06-01 06:31:17 -07:00
committed by Commit bot
parent 98bba39816
commit a1ed0b3241
24 changed files with 290 additions and 190 deletions

View File

@ -428,17 +428,19 @@ int32_t ModuleRtpRtcpImpl::SendOutgoingData(
bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
uint16_t sequence_number,
int64_t capture_time_ms,
bool retransmission) {
bool retransmission,
int probe_cluster_id) {
if (SendingMedia() && ssrc == rtp_sender_.SSRC()) {
return rtp_sender_.TimeToSendPacket(
sequence_number, capture_time_ms, retransmission);
return rtp_sender_.TimeToSendPacket(sequence_number, capture_time_ms,
retransmission, probe_cluster_id);
}
// No RTP sender is interested in sending this packet.
return true;
}
size_t ModuleRtpRtcpImpl::TimeToSendPadding(size_t bytes) {
return rtp_sender_.TimeToSendPadding(bytes);
size_t ModuleRtpRtcpImpl::TimeToSendPadding(size_t bytes,
int probe_cluster_id) {
return rtp_sender_.TimeToSendPadding(bytes, probe_cluster_id);
}
uint16_t ModuleRtpRtcpImpl::MaxPayloadLength() const {

View File

@ -123,11 +123,12 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
bool TimeToSendPacket(uint32_t ssrc,
uint16_t sequence_number,
int64_t capture_time_ms,
bool retransmission) override;
bool retransmission,
int probe_cluster_id) override;
// Returns the number of padding bytes actually sent, which can be more or
// less than |bytes|.
size_t TimeToSendPadding(size_t bytes) override;
size_t TimeToSendPadding(size_t bytes, int probe_cluster_id) override;
// RTCP part.

View File

@ -543,7 +543,8 @@ int32_t RTPSender::SendOutgoingData(FrameType frame_type,
return ret_val;
}
size_t RTPSender::TrySendRedundantPayloads(size_t bytes_to_send) {
size_t RTPSender::TrySendRedundantPayloads(size_t bytes_to_send,
int probe_cluster_id) {
{
rtc::CritScope lock(&send_critsect_);
if (!sending_media_)
@ -561,7 +562,8 @@ size_t RTPSender::TrySendRedundantPayloads(size_t bytes_to_send) {
&capture_time_ms)) {
break;
}
if (!PrepareAndSendPacket(buffer, length, capture_time_ms, true, false))
if (!PrepareAndSendPacket(buffer, length, capture_time_ms, true, false,
probe_cluster_id))
break;
RtpUtility::RtpHeaderParser rtp_parser(buffer, length);
RTPHeader rtp_header;
@ -590,6 +592,15 @@ size_t RTPSender::SendPadData(size_t bytes,
bool timestamp_provided,
uint32_t timestamp,
int64_t capture_time_ms) {
return SendPadData(bytes, timestamp_provided, timestamp, capture_time_ms,
PacketInfo::kNotAProbe);
}
size_t RTPSender::SendPadData(size_t bytes,
bool timestamp_provided,
uint32_t timestamp,
int64_t capture_time_ms,
int probe_cluster_id) {
// Always send full padding packets. This is accounted for by the
// RtpPacketSender,
// which will make sure we don't send too much padding even if a single packet
@ -677,7 +688,7 @@ size_t RTPSender::SendPadData(size_t bytes,
length, rtp_header)) {
if (transport_feedback_observer_)
transport_feedback_observer_->AddPacket(options.packet_id, length,
true);
true, probe_cluster_id);
}
}
@ -733,7 +744,8 @@ int32_t RTPSender::ReSendPacket(uint16_t packet_id, int64_t min_resend_time) {
rtx = rtx_;
}
if (!PrepareAndSendPacket(data_buffer, length, capture_time_ms,
(rtx & kRtxRetransmitted) > 0, true)) {
(rtx & kRtxRetransmitted) > 0, true,
PacketInfo::kNotAProbe)) {
return -1;
}
return static_cast<int32_t>(length);
@ -869,7 +881,8 @@ void RTPSender::UpdateNACKBitRate(uint32_t bytes, int64_t now) {
// Called from pacer when we can send the packet.
bool RTPSender::TimeToSendPacket(uint16_t sequence_number,
int64_t capture_time_ms,
bool retransmission) {
bool retransmission,
int probe_cluster_id) {
size_t length = IP_PACKET_SIZE;
uint8_t data_buffer[IP_PACKET_SIZE];
int64_t stored_time_ms;
@ -889,18 +902,17 @@ bool RTPSender::TimeToSendPacket(uint16_t sequence_number,
rtc::CritScope lock(&send_critsect_);
rtx = rtx_;
}
return PrepareAndSendPacket(data_buffer,
length,
capture_time_ms,
return PrepareAndSendPacket(data_buffer, length, capture_time_ms,
retransmission && (rtx & kRtxRetransmitted) > 0,
retransmission);
retransmission, probe_cluster_id);
}
bool RTPSender::PrepareAndSendPacket(uint8_t* buffer,
size_t length,
int64_t capture_time_ms,
bool send_over_rtx,
bool is_retransmit) {
bool is_retransmit,
int probe_cluster_id) {
uint8_t* buffer_to_send_ptr = buffer;
RtpUtility::RtpHeaderParser rtp_parser(buffer, length);
@ -932,8 +944,8 @@ bool RTPSender::PrepareAndSendPacket(uint8_t* buffer,
if (UpdateTransportSequenceNumber(options.packet_id, buffer_to_send_ptr,
length, rtp_header)) {
if (transport_feedback_observer_)
transport_feedback_observer_->AddPacket(options.packet_id, length,
true);
transport_feedback_observer_->AddPacket(options.packet_id, length, true,
probe_cluster_id);
}
}
@ -1000,12 +1012,13 @@ bool RTPSender::IsFecPacket(const uint8_t* buffer,
buffer[header.headerLength] == pt_fec;
}
size_t RTPSender::TimeToSendPadding(size_t bytes) {
size_t RTPSender::TimeToSendPadding(size_t bytes, int probe_cluster_id) {
if (audio_configured_ || bytes == 0)
return 0;
size_t bytes_sent = TrySendRedundantPayloads(bytes);
size_t bytes_sent = TrySendRedundantPayloads(bytes, probe_cluster_id);
if (bytes_sent < bytes)
bytes_sent += SendPadData(bytes - bytes_sent, false, 0, 0);
bytes_sent +=
SendPadData(bytes - bytes_sent, false, 0, 0, probe_cluster_id);
return bytes_sent;
}
@ -1062,8 +1075,8 @@ int32_t RTPSender::SendToNetwork(uint8_t* buffer,
if (UpdateTransportSequenceNumber(options.packet_id, buffer, length,
rtp_header)) {
if (transport_feedback_observer_)
transport_feedback_observer_->AddPacket(options.packet_id, length,
true);
transport_feedback_observer_->AddPacket(options.packet_id, length, true,
PacketInfo::kNotAProbe);
}
}
UpdateDelayStatistics(capture_time_ms, now_ms);

View File

@ -211,9 +211,11 @@ class RTPSender : public RTPSenderInterface {
const RTPHeader& rtp_header,
VideoRotation rotation) const override;
bool TimeToSendPacket(uint16_t sequence_number, int64_t capture_time_ms,
bool retransmission);
size_t TimeToSendPadding(size_t bytes);
bool TimeToSendPacket(uint16_t sequence_number,
int64_t capture_time_ms,
bool retransmission,
int probe_cluster_id);
size_t TimeToSendPadding(size_t bytes, int probe_cluster_id);
// NACK.
int SelectiveRetransmissions() const;
@ -302,6 +304,12 @@ class RTPSender : public RTPSenderInterface {
uint32_t timestamp,
int64_t capture_time_ms);
size_t SendPadData(size_t bytes,
bool timestamp_provided,
uint32_t timestamp,
int64_t capture_time_ms,
int probe_cluster_id);
// Called on update of RTP statistics.
void RegisterRtpStatisticsCallback(StreamDataCountersCallback* callback);
StreamDataCountersCallback* GetRtpStatisticsCallback() const;
@ -337,11 +345,12 @@ class RTPSender : public RTPSenderInterface {
size_t length,
int64_t capture_time_ms,
bool send_over_rtx,
bool is_retransmit);
bool is_retransmit,
int probe_cluster_id);
// Return the number of bytes sent. Note that both of these functions may
// return a larger value that their argument.
size_t TrySendRedundantPayloads(size_t bytes);
size_t TrySendRedundantPayloads(size_t bytes, int probe_cluster_id);
void BuildPaddingPacket(uint8_t* packet,
size_t header_length,

View File

@ -766,7 +766,8 @@ TEST_F(RtpSenderTest, TrafficSmoothingWithExtensions) {
const int kStoredTimeInMs = 100;
fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs);
rtp_sender_->TimeToSendPacket(kSeqNum, capture_time_ms, false);
rtp_sender_->TimeToSendPacket(kSeqNum, capture_time_ms, false,
PacketInfo::kNotAProbe);
// Process send bucket. Packet should now be sent.
EXPECT_EQ(1, transport_.packets_sent_);
@ -825,7 +826,8 @@ TEST_F(RtpSenderTest, TrafficSmoothingRetransmits) {
EXPECT_EQ(rtp_length_int, rtp_sender_->ReSendPacket(kSeqNum));
EXPECT_EQ(0, transport_.packets_sent_);
rtp_sender_->TimeToSendPacket(kSeqNum, capture_time_ms, false);
rtp_sender_->TimeToSendPacket(kSeqNum, capture_time_ms, false,
PacketInfo::kNotAProbe);
// Process send bucket. Packet should now be sent.
EXPECT_EQ(1, transport_.packets_sent_);
@ -901,7 +903,8 @@ TEST_F(RtpSenderTest, SendPadding) {
const int kStoredTimeInMs = 100;
fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs);
rtp_sender_->TimeToSendPacket(seq_num++, capture_time_ms, false);
rtp_sender_->TimeToSendPacket(seq_num++, capture_time_ms, false,
PacketInfo::kNotAProbe);
// Packet should now be sent. This test doesn't verify the regular video
// packet, since it is tested in another test.
EXPECT_EQ(++total_packets_sent, transport_.packets_sent_);
@ -913,7 +916,8 @@ TEST_F(RtpSenderTest, SendPadding) {
const size_t kPaddingBytes = 100;
const size_t kMaxPaddingLength = 224; // Value taken from rtp_sender.cc.
// Padding will be forced to full packets.
EXPECT_EQ(kMaxPaddingLength, rtp_sender_->TimeToSendPadding(kPaddingBytes));
EXPECT_EQ(kMaxPaddingLength, rtp_sender_->TimeToSendPadding(
kPaddingBytes, PacketInfo::kNotAProbe));
// Process send bucket. Padding should now be sent.
EXPECT_EQ(++total_packets_sent, transport_.packets_sent_);
@ -954,7 +958,8 @@ TEST_F(RtpSenderTest, SendPadding) {
capture_time_ms, kAllowRetransmission,
RtpPacketSender::kNormalPriority));
rtp_sender_->TimeToSendPacket(seq_num, capture_time_ms, false);
rtp_sender_->TimeToSendPacket(seq_num, capture_time_ms, false,
PacketInfo::kNotAProbe);
// Process send bucket.
EXPECT_EQ(++total_packets_sent, transport_.packets_sent_);
EXPECT_EQ(rtp_length, transport_.last_sent_packet_len_);
@ -987,7 +992,7 @@ TEST_F(RtpSenderTest, OnSendPacketUpdated) {
SendGenericPayload(); // Packet passed to pacer.
const bool kIsRetransmit = false;
rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(),
kIsRetransmit);
kIsRetransmit, PacketInfo::kNotAProbe);
EXPECT_EQ(1, transport_.packets_sent_);
}
@ -1004,7 +1009,7 @@ TEST_F(RtpSenderTest, OnSendPacketNotUpdatedForRetransmits) {
SendGenericPayload(); // Packet passed to pacer.
const bool kIsRetransmit = true;
rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(),
kIsRetransmit);
kIsRetransmit, PacketInfo::kNotAProbe);
EXPECT_EQ(1, transport_.packets_sent_);
}
@ -1022,7 +1027,7 @@ TEST_F(RtpSenderTest, OnSendPacketNotUpdatedWithoutSeqNumAllocator) {
SendGenericPayload(); // Packet passed to pacer.
const bool kIsRetransmit = false;
rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(),
kIsRetransmit);
kIsRetransmit, PacketInfo::kNotAProbe);
EXPECT_EQ(1, transport_.packets_sent_);
}
@ -1072,7 +1077,8 @@ TEST_F(RtpSenderTest, SendRedundantPayloads) {
int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
EXPECT_CALL(transport, SendRtp(_, _, _)).WillOnce(testing::Return(true));
SendPacket(capture_time_ms, kPayloadSizes[i]);
rtp_sender_->TimeToSendPacket(seq_num++, capture_time_ms, false);
rtp_sender_->TimeToSendPacket(seq_num++, capture_time_ms, false,
PacketInfo::kNotAProbe);
fake_clock_.AdvanceTimeMilliseconds(33);
}
@ -1083,12 +1089,14 @@ TEST_F(RtpSenderTest, SendRedundantPayloads) {
// The amount of padding to send it too small to send a payload packet.
EXPECT_CALL(transport, SendRtp(_, kMaxPaddingSize + rtp_header_len, _))
.WillOnce(testing::Return(true));
EXPECT_EQ(kMaxPaddingSize, rtp_sender_->TimeToSendPadding(49));
EXPECT_EQ(kMaxPaddingSize,
rtp_sender_->TimeToSendPadding(49, PacketInfo::kNotAProbe));
EXPECT_CALL(transport,
SendRtp(_, kPayloadSizes[0] + rtp_header_len + kRtxHeaderSize, _))
.WillOnce(testing::Return(true));
EXPECT_EQ(kPayloadSizes[0], rtp_sender_->TimeToSendPadding(500));
EXPECT_EQ(kPayloadSizes[0],
rtp_sender_->TimeToSendPadding(500, PacketInfo::kNotAProbe));
EXPECT_CALL(transport, SendRtp(_, kPayloadSizes[kNumPayloadSizes - 1] +
rtp_header_len + kRtxHeaderSize,
@ -1097,7 +1105,7 @@ TEST_F(RtpSenderTest, SendRedundantPayloads) {
EXPECT_CALL(transport, SendRtp(_, kMaxPaddingSize + rtp_header_len, _))
.WillOnce(testing::Return(true));
EXPECT_EQ(kPayloadSizes[kNumPayloadSizes - 1] + kMaxPaddingSize,
rtp_sender_->TimeToSendPadding(999));
rtp_sender_->TimeToSendPadding(999, PacketInfo::kNotAProbe));
}
TEST_F(RtpSenderTestWithoutPacer, SendGenericVideo) {
@ -1360,7 +1368,7 @@ TEST_F(RtpSenderTestWithoutPacer, StreamDataCountersCallbacks) {
callback.Matches(ssrc, expected);
// Send padding.
rtp_sender_->TimeToSendPadding(kMaxPaddingSize);
rtp_sender_->TimeToSendPadding(kMaxPaddingSize, PacketInfo::kNotAProbe);
expected.transmitted.payload_bytes = 12;
expected.transmitted.header_bytes = 36;
expected.transmitted.padding_bytes = kMaxPaddingSize;
@ -1517,8 +1525,8 @@ TEST_F(RtpSenderTestWithoutPacer, BytesReportedCorrectly) {
payload, sizeof(payload), 0));
// Will send 2 full-size padding packets.
rtp_sender_->TimeToSendPadding(1);
rtp_sender_->TimeToSendPadding(1);
rtp_sender_->TimeToSendPadding(1, PacketInfo::kNotAProbe);
rtp_sender_->TimeToSendPadding(1, PacketInfo::kNotAProbe);
StreamDataCounters rtp_stats;
StreamDataCounters rtx_stats;