Removed Reset from BitrateProber.

Bug: webrtc:8415
Change-Id: Ied9843a64d1a83992429e2660802e8489838a9bb
Reviewed-on: https://webrtc-review.googlesource.com/30681
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21469}
This commit is contained in:
srte 2017-12-07 11:27:03 +01:00 committed by Commit Bot
parent 8906187c86
commit adf4c169bd
3 changed files with 6 additions and 31 deletions

View File

@ -36,9 +36,6 @@ constexpr int kMinProbeDurationMs = 15;
// retried from the start when this limit is reached.
constexpr int kMaxProbeDelayMs = 3;
// Number of times probing is retried before the cluster is dropped.
constexpr int kMaxRetryAttempts = 3;
// The min probe packet size is scaled with the bitrate we're probing at.
// This defines the max min probe packet size, meaning that on high bitrates
// we have a min probe packet size of 200 bytes.
@ -118,23 +115,6 @@ void BitrateProber::CreateProbeCluster(int bitrate_bps, int64_t now_ms) {
probing_state_ = ProbingState::kInactive;
}
void BitrateProber::ResetState(int64_t now_ms) {
RTC_DCHECK(probing_state_ == ProbingState::kActive);
// Recreate all probing clusters.
std::queue<ProbeCluster> clusters;
clusters.swap(clusters_);
while (!clusters.empty()) {
if (clusters.front().retries < kMaxRetryAttempts) {
CreateProbeCluster(clusters.front().pace_info.send_bitrate_bps, now_ms);
clusters_.back().retries = clusters.front().retries + 1;
}
clusters.pop();
}
probing_state_ = ProbingState::kInactive;
}
int BitrateProber::TimeUntilNextProbe(int64_t now_ms) {
// Probing is not active or probing is already complete.
if (probing_state_ != ProbingState::kActive || clusters_.empty())
@ -144,7 +124,9 @@ int BitrateProber::TimeUntilNextProbe(int64_t now_ms) {
if (next_probe_time_ms_ >= 0) {
time_until_probe_ms = next_probe_time_ms_ - now_ms;
if (time_until_probe_ms < -kMaxProbeDelayMs) {
ResetState(now_ms);
RTC_LOG(LS_WARNING)<<"Probe delay too high"<<
" (next_ms:"<<next_probe_time_ms_<<
", now_ms: "<<now_ms<<")";
return -1;
}
}

View File

@ -86,9 +86,6 @@ class BitrateProber {
int retries = 0;
};
// Resets the state of the prober and clears any cluster/timing data tracked.
void ResetState(int64_t now_ms);
int64_t GetNextProbeTime(const ProbeCluster& cluster);
ProbingState probing_state_;

View File

@ -88,14 +88,10 @@ TEST(BitrateProberTest, DoesntProbeWithoutRecentPackets) {
// Let time pass, no large enough packets put into prober.
now_ms += 6000;
EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms));
// Insert a large-enough packet after downtime while probing should reset to
// perform a new probe since the requested one didn't finish.
// Check that legacy behaviour where prober is reset in TimeUntilNextProbe is
// no longer there. Probes are no longer retried if they are timed out.
prober.OnIncomingPacket(1000);
EXPECT_EQ(0, prober.TimeUntilNextProbe(now_ms));
prober.ProbeSent(now_ms, 1000);
// Next packet should be part of new probe and be sent with non-zero delay.
prober.OnIncomingPacket(1000);
EXPECT_GT(prober.TimeUntilNextProbe(now_ms), 0);
EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms));
}
TEST(BitrateProberTest, DoesntInitializeProbingForSmallPackets) {