Deprecate RtpSender::SendPadData with provided timestamps.

Review-Url: https://codereview.webrtc.org/2339363002
Cr-Commit-Position: refs/heads/master@{#14287}
This commit is contained in:
danilchap 2016-09-19 05:37:56 -07:00 committed by Commit bot
parent dd0c7f0ea4
commit 7bfe3a27b6
3 changed files with 27 additions and 19 deletions

View File

@ -533,19 +533,23 @@ size_t RTPSender::TrySendRedundantPayloads(size_t bytes_to_send,
return bytes_to_send - bytes_left;
}
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, int probe_cluster_id) {
return DeprecatedSendPadData(bytes, false, 0, 0, probe_cluster_id);
}
size_t RTPSender::SendPadData(size_t bytes,
bool timestamp_provided,
uint32_t timestamp,
int64_t capture_time_ms,
int probe_cluster_id) {
int64_t capture_time_ms) {
return DeprecatedSendPadData(bytes, timestamp_provided, timestamp,
capture_time_ms, PacketInfo::kNotAProbe);
}
size_t RTPSender::DeprecatedSendPadData(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
@ -872,8 +876,7 @@ size_t RTPSender::TimeToSendPadding(size_t bytes, int probe_cluster_id) {
return 0;
size_t bytes_sent = TrySendRedundantPayloads(bytes, probe_cluster_id);
if (bytes_sent < bytes)
bytes_sent +=
SendPadData(bytes - bytes_sent, false, 0, 0, probe_cluster_id);
bytes_sent += SendPadData(bytes - bytes_sent, probe_cluster_id);
return bytes_sent;
}

View File

@ -18,6 +18,7 @@
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/deprecation.h"
#include "webrtc/base/random.h"
#include "webrtc/base/rate_statistics.h"
#include "webrtc/base/thread_annotations.h"
@ -271,15 +272,11 @@ class RTPSender {
int32_t SetFecParameters(const FecProtectionParams *delta_params,
const FecProtectionParams *key_params);
RTC_DEPRECATED
size_t SendPadData(size_t bytes,
bool timestamp_provided,
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);
@ -302,6 +299,14 @@ class RTPSender {
// time.
typedef std::map<int64_t, int> SendDelayMap;
size_t SendPadData(size_t bytes, int probe_cluster_id);
size_t DeprecatedSendPadData(size_t bytes,
bool timestamp_provided,
uint32_t timestamp,
int64_t capture_time_ms,
int probe_cluster_id);
size_t CreateRtpHeader(uint8_t* header,
int8_t payload_type,
uint32_t ssrc,

View File

@ -440,16 +440,16 @@ TEST_F(RtpSenderTestWithoutPacer, AssignSequenceNumberMayAllowPadding) {
auto packet = rtp_sender_->AllocatePacket();
ASSERT_TRUE(packet);
ASSERT_FALSE(rtp_sender_->SendPadData(kPaddingSize, false, 0, 0, -1));
ASSERT_FALSE(rtp_sender_->TimeToSendPadding(kPaddingSize, -1));
packet->SetMarker(false);
ASSERT_TRUE(rtp_sender_->AssignSequenceNumber(packet.get()));
// Packet without marker bit doesn't allow padding.
EXPECT_FALSE(rtp_sender_->SendPadData(kPaddingSize, false, 0, 0, -1));
EXPECT_FALSE(rtp_sender_->TimeToSendPadding(kPaddingSize, -1));
packet->SetMarker(true);
ASSERT_TRUE(rtp_sender_->AssignSequenceNumber(packet.get()));
// Packet with marker bit allows send padding.
EXPECT_TRUE(rtp_sender_->SendPadData(kPaddingSize, false, 0, 0, -1));
EXPECT_TRUE(rtp_sender_->TimeToSendPadding(kPaddingSize, -1));
}
TEST_F(RtpSenderTestWithoutPacer, AssignSequenceNumberSetPaddingTimestamps) {
@ -460,7 +460,7 @@ TEST_F(RtpSenderTestWithoutPacer, AssignSequenceNumberSetPaddingTimestamps) {
packet->SetTimestamp(kTimestamp);
ASSERT_TRUE(rtp_sender_->AssignSequenceNumber(packet.get()));
ASSERT_TRUE(rtp_sender_->SendPadData(kPaddingSize, false, 0, 0, -1));
ASSERT_TRUE(rtp_sender_->TimeToSendPadding(kPaddingSize, -1));
ASSERT_EQ(1u, transport_.sent_packets_.size());
// Parse the padding packet and verify its timestamp.