Index: webrtc/modules/pacing/bitrate_prober.cc |
diff --git a/webrtc/modules/pacing/bitrate_prober.cc b/webrtc/modules/pacing/bitrate_prober.cc |
index 41ad5fa11a6d90fe612fcde9f42f18d69dcb793b..373cf77928a9a0ace2fa1da97b42eb3a0b0dbecc 100644 |
--- a/webrtc/modules/pacing/bitrate_prober.cc |
+++ b/webrtc/modules/pacing/bitrate_prober.cc |
@@ -74,6 +74,8 @@ void BitrateProber::MaybeInitializeProbe(int bitrate_bps) { |
} |
bitrate_log << ", num packets: " << probe_bitrates_.size(); |
LOG(LS_INFO) << bitrate_log.str().c_str(); |
+ // Set last send time to non-(-1) so TimeUntilNextProbe doesn't short circuit. |
+ time_last_send_ms_ = 0; |
probing_state_ = kProbing; |
} |
@@ -81,16 +83,23 @@ int BitrateProber::TimeUntilNextProbe(int64_t now_ms) { |
if (probing_state_ != kDisabled && probe_bitrates_.empty()) { |
probing_state_ = kWait; |
} |
- if (probe_bitrates_.empty()) { |
+ if (probe_bitrates_.empty() || time_last_send_ms_ == -1) { |
// No probe started, or waiting for next probe. |
stefan-webrtc
2016/02/10 10:56:19
Given line 78, is this comment still correct?
pbos-webrtc
2016/02/10 13:19:08
Done.
|
return -1; |
} |
int64_t elapsed_time_ms = now_ms - time_last_send_ms_; |
+ // If no packets have been sent for n milliseconds, inactivate to not keep |
stefan-webrtc
2016/02/10 10:56:19
deactivate
pbos-webrtc
2016/02/10 13:19:08
Done.
|
+ // spinning. |
+ static const int kSendDeltaUntilConsideredInactiveMs = 5000; |
+ if (elapsed_time_ms > kSendDeltaUntilConsideredInactiveMs) { |
+ time_last_send_ms_ = -1; |
+ packet_size_last_send_ = 0; |
+ return -1; |
+ } |
stefan-webrtc
2016/02/10 10:56:19
Shouldn't we change the state to say we're no long
pbos-webrtc
2016/02/10 13:19:08
Changed state to allow a fresh probe.
|
// We will send the first probe packet immediately if no packet has been |
// sent before. |
int time_until_probe_ms = 0; |
- if (packet_size_last_send_ > PacedSender::kMinProbePacketSize && |
- probing_state_ == kProbing) { |
+ if (packet_size_last_send_ != 0 && probing_state_ == kProbing) { |
int next_delta_ms = ComputeDeltaFromBitrate(packet_size_last_send_, |
probe_bitrates_.front()); |
time_until_probe_ms = next_delta_ms - elapsed_time_ms; |
@@ -119,6 +128,8 @@ size_t BitrateProber::RecommendedPacketSize() const { |
void BitrateProber::PacketSent(int64_t now_ms, size_t packet_size) { |
assert(packet_size > 0); |
+ if (packet_size < PacedSender::kMinProbePacketSize) |
+ return; |
packet_size_last_send_ = packet_size; |
time_last_send_ms_ = now_ms; |
if (probing_state_ != kProbing) |