Index: webrtc/modules/pacing/paced_sender.cc |
diff --git a/webrtc/modules/pacing/paced_sender.cc b/webrtc/modules/pacing/paced_sender.cc |
index efbf969ac1c871d34d709adf665c757f1208bf64..b724e3dff7cfd31798947ac67baad90ee7bebb1a 100644 |
--- a/webrtc/modules/pacing/paced_sender.cc |
+++ b/webrtc/modules/pacing/paced_sender.cc |
@@ -245,8 +245,7 @@ class IntervalBudget { |
const int64_t PacedSender::kMaxQueueLengthMs = 2000; |
const float PacedSender::kDefaultPaceMultiplier = 2.5f; |
-PacedSender::PacedSender(Clock* clock, |
- PacketSender* packet_sender) |
+PacedSender::PacedSender(Clock* clock, PacketSender* packet_sender) |
: clock_(clock), |
packet_sender_(packet_sender), |
critsect_(CriticalSectionWrapper::CreateCriticalSection()), |
@@ -257,6 +256,7 @@ PacedSender::PacedSender(Clock* clock, |
prober_(new BitrateProber()), |
estimated_bitrate_bps_(0), |
min_send_bitrate_kbps_(0u), |
+ max_padding_bitrate_kbps_(0u), |
pacing_bitrate_kbps_(0), |
time_last_update_us_(clock->TimeInMicroseconds()), |
packets_(new paced_sender::PacketQueue(clock)), |
@@ -296,7 +296,7 @@ void PacedSender::SetAllocatedSendBitrate(int allocated_bitrate, |
pacing_bitrate_kbps_ = |
std::max(min_send_bitrate_kbps_, estimated_bitrate_bps_ / 1000) * |
kDefaultPaceMultiplier; |
- padding_budget_->set_target_rate_kbps(padding_bitrate / 1000); |
+ max_padding_bitrate_kbps_ = padding_bitrate / 1000; |
} |
void PacedSender::InsertPacket(RtpPacketSender::Priority priority, |
@@ -368,6 +368,8 @@ void PacedSender::Process() { |
int64_t elapsed_time_ms = (now_us - time_last_update_us_ + 500) / 1000; |
time_last_update_us_ = now_us; |
int target_bitrate_kbps = pacing_bitrate_kbps_; |
+ padding_budget_->set_target_rate_kbps( |
+ std::min(estimated_bitrate_bps_ / 1000, max_padding_bitrate_kbps_)); |
stefan-webrtc
2016/06/08 09:25:13
Why was this change needed? Seems like we're setti
perkj_webrtc
2016/06/08 15:35:27
Done.
|
// TODO(holmer): Remove the !paused_ check when issue 5307 has been fixed. |
if (!paused_ && elapsed_time_ms > 0) { |
size_t queue_size_bytes = packets_->SizeInBytes(); |
@@ -418,15 +420,16 @@ void PacedSender::Process() { |
if (paused_ || !packets_->Empty()) |
return; |
- size_t padding_needed; |
- if (is_probing) { |
- padding_needed = prober_->RecommendedPacketSize(); |
- } else { |
- padding_needed = padding_budget_->bytes_remaining(); |
- } |
+ // We can not send padding unless a normal packet has first been sent. If we |
+ // do, time stamps gets messed up. |
stefan-webrtc
2016/06/08 09:25:13
"timestamps get messsed up"
perkj_webrtc
2016/06/08 15:35:27
Done.
stefan-webrtc
2016/06/10 13:54:13
I was referring to that "gets" should be "get" :)
perkj_webrtc
2016/06/14 10:58:02
oops
|
+ if (packet_counter_ > 0) { |
+ size_t padding_needed = is_probing |
+ ? prober_->RecommendedPacketSize() |
+ : padding_budget_->bytes_remaining(); |
- if (padding_needed > 0) |
- SendPadding(padding_needed, probe_cluster_id); |
+ if (padding_needed > 0) |
+ SendPadding(padding_needed, probe_cluster_id); |
+ } |
} |
bool PacedSender::SendPacket(const paced_sender::Packet& packet, |