Avoid max bitrate probing when exponential probing in progress

Avoid starting the max probing when there is an exponential probing session in progress.

BUG=webrtc:6332
R=philipel@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2269873002 .

Cr-Commit-Position: refs/heads/master@{#14268}
diff --git a/webrtc/modules/congestion_controller/probe_controller.cc b/webrtc/modules/congestion_controller/probe_controller.cc
index cf7f3e1..e91e06e 100644
--- a/webrtc/modules/congestion_controller/probe_controller.cc
+++ b/webrtc/modules/congestion_controller/probe_controller.cc
@@ -54,11 +54,13 @@
   }
 
   // Only do probing if:
-  //   - we are mid-call, which we consider to be if
-  //     |estimated_bitrate_bps_| != 0, and
-  //   - the current bitrate is lower than the new |max_bitrate_bps|, and
-  //   - we actually want to increase the |max_bitrate_bps_|.
-  if (estimated_bitrate_bps_ != 0 && estimated_bitrate_bps_ < max_bitrate_bps &&
+  //   we are mid-call, which we consider to be if
+  //     exponential probing is not active and
+  //     |estimated_bitrate_bps_| is valid (> 0) and
+  //     the current bitrate is lower than the new |max_bitrate_bps|, and
+  //     we actually want to increase the |max_bitrate_bps_|.
+  if (state_ != State::kWaitingForProbingResult &&
+      estimated_bitrate_bps_ != 0 && estimated_bitrate_bps_ < max_bitrate_bps &&
       max_bitrate_bps > max_bitrate_bps_) {
     InitiateProbing({max_bitrate_bps}, kExponentialProbingDisabled);
   }
diff --git a/webrtc/modules/congestion_controller/probe_controller_unittest.cc b/webrtc/modules/congestion_controller/probe_controller_unittest.cc
index 6932775..9e01660 100644
--- a/webrtc/modules/congestion_controller/probe_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/probe_controller_unittest.cc
@@ -29,6 +29,8 @@
 constexpr int kStartBitrateBps = 300;
 constexpr int kMaxBitrateBps = 1000;
 
+constexpr int kExponentialProbingTimeoutMs = 5000;
+
 }  // namespace
 
 class ProbeControllerTest : public ::testing::Test {
@@ -53,9 +55,10 @@
   EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(AtLeast(2));
   probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
                                  kMaxBitrateBps);
-  clock_.AdvanceTimeMilliseconds(25);
-
+  // Long enough to time out exponential probing.
+  clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs);
   probe_controller_->SetEstimatedBitrate(kStartBitrateBps);
+
   EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100, _));
   probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
                                  kMaxBitrateBps + 100);
@@ -73,7 +76,7 @@
                                  kMaxBitrateBps);
 
   // Advance far enough to cause a time out in waiting for probing result.
-  clock_.AdvanceTimeMilliseconds(5000);
+  clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs);
   EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _)).Times(0);
   probe_controller_->SetEstimatedBitrate(1800);
 }