Fix BWE simulations so that it uses the delay based BWE.

Rename kFullSendSideEstimator -> kSendSideEstimator and add new class SendSideBweSender (controlled by kSendSideEstimator) that actually uses the send side BWE.

Move the mock to logging/rtc_event_log/mock.
Allow congestion_controller, remote_bitrate_estimator and audio to depend on loggging/rtc_event_log

BUG=webrtc:6526
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2431093003
Cr-Commit-Position: refs/heads/master@{#14772}
diff --git a/webrtc/audio/DEPS b/webrtc/audio/DEPS
index 5e43c34..66f66f4 100644
--- a/webrtc/audio/DEPS
+++ b/webrtc/audio/DEPS
@@ -3,6 +3,7 @@
   "+webrtc/voice_engine",
   "+webrtc/modules/audio_coding/codecs/mock",
   "+webrtc/call",
+  "+webrtc/logging/rtc_event_log",
   "+webrtc/modules/bitrate_controller",
   "+webrtc/modules/congestion_controller",
   "+webrtc/modules/pacing",
@@ -11,12 +12,3 @@
   "+webrtc/system_wrappers",
   "+webrtc/voice_engine",
 ]
-
-specific_include_rules = {
-  "audio_receive_stream_unittest\.cc": [
-    "+webrtc/call/mock",
-  ],
-  "audio_send_stream_unittest\.cc": [
-    "+webrtc/call/mock",
-  ],
-}
diff --git a/webrtc/audio/audio_receive_stream_unittest.cc b/webrtc/audio/audio_receive_stream_unittest.cc
index d30eb11..b11d04b 100644
--- a/webrtc/audio/audio_receive_stream_unittest.cc
+++ b/webrtc/audio/audio_receive_stream_unittest.cc
@@ -13,7 +13,7 @@
 
 #include "webrtc/audio/audio_receive_stream.h"
 #include "webrtc/audio/conversion.h"
-#include "webrtc/call/mock/mock_rtc_event_log.h"
+#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc
index e6356c0..a2832de 100644
--- a/webrtc/audio/audio_send_stream_unittest.cc
+++ b/webrtc/audio/audio_send_stream_unittest.cc
@@ -15,7 +15,7 @@
 #include "webrtc/audio/audio_state.h"
 #include "webrtc/audio/conversion.h"
 #include "webrtc/base/task_queue.h"
-#include "webrtc/call/mock/mock_rtc_event_log.h"
+#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
 #include "webrtc/modules/pacing/paced_sender.h"
diff --git a/webrtc/call/mock/mock_rtc_event_log.h b/webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h
similarity index 90%
rename from webrtc/call/mock/mock_rtc_event_log.h
rename to webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h
index 637389f..315967b 100644
--- a/webrtc/call/mock/mock_rtc_event_log.h
+++ b/webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_CALL_MOCK_MOCK_RTC_EVENT_LOG_H_
-#define WEBRTC_CALL_MOCK_MOCK_RTC_EVENT_LOG_H_
+#ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_MOCK_MOCK_RTC_EVENT_LOG_H_
+#define WEBRTC_LOGGING_RTC_EVENT_LOG_MOCK_MOCK_RTC_EVENT_LOG_H_
 
 #include <string>
 
@@ -62,4 +62,4 @@
 
 }  // namespace webrtc
 
-#endif  // WEBRTC_CALL_MOCK_MOCK_RTC_EVENT_LOG_H_
+#endif  // WEBRTC_LOGGING_RTC_EVENT_LOG_MOCK_MOCK_RTC_EVENT_LOG_H_
diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc b/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
index 0e080ee..56bb41e 100644
--- a/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
+++ b/webrtc/modules/bitrate_controller/bitrate_controller_unittest.cc
@@ -11,7 +11,7 @@
 #include <algorithm>
 #include <vector>
 
-#include "webrtc/call/mock/mock_rtc_event_log.h"
+#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
 #include "webrtc/modules/pacing/mock/mock_paced_sender.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
diff --git a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation_unittest.cc b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation_unittest.cc
index da618c7..7841f5f 100644
--- a/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation_unittest.cc
+++ b/webrtc/modules/bitrate_controller/send_side_bandwidth_estimation_unittest.cc
@@ -11,7 +11,7 @@
 #include <algorithm>
 #include <vector>
 
-#include "webrtc/call/mock/mock_rtc_event_log.h"
+#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
 #include "webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h"
 #include "webrtc/test/gtest.h"
 
diff --git a/webrtc/modules/congestion_controller/DEPS b/webrtc/modules/congestion_controller/DEPS
index 675f103..30984ed 100644
--- a/webrtc/modules/congestion_controller/DEPS
+++ b/webrtc/modules/congestion_controller/DEPS
@@ -1,6 +1,6 @@
 include_rules = [
   "+webrtc/base",
-  "+webrtc/call/mock",
+  "+webrtc/logging/rtc_event_log",
   "+webrtc/system_wrappers",
   "+webrtc/video",
 ]
diff --git a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
index e840294..91508df 100644
--- a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "webrtc/call/mock/mock_rtc_event_log.h"
+#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
diff --git a/webrtc/modules/remote_bitrate_estimator/DEPS b/webrtc/modules/remote_bitrate_estimator/DEPS
index fc31fa7..d061d57 100644
--- a/webrtc/modules/remote_bitrate_estimator/DEPS
+++ b/webrtc/modules/remote_bitrate_estimator/DEPS
@@ -1,5 +1,6 @@
 include_rules = [
   "+webrtc/base",
+  "+webrtc/logging/rtc_event_log",
   "+webrtc/system_wrappers",
 ]
 
@@ -7,10 +8,4 @@
   "nada\.h": [
     "+webrtc/voice_engine",
   ],
-  "remb\.h": [
-    "+webrtc/call/mock",
-  ],
-  "send_side\.h": [
-    "+webrtc/call/mock",
-  ],
 }
diff --git a/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc b/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc
index c953bd8..f13a1d5 100644
--- a/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc
+++ b/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc
@@ -47,7 +47,7 @@
 INSTANTIATE_TEST_CASE_P(VideoSendersTest,
                         BweSimulation,
                         ::testing::Values(kRembEstimator,
-                                          kFullSendSideEstimator,
+                                          kSendSideEstimator,
                                           kNadaEstimator));
 
 TEST_P(BweSimulation, SprintUplinkTest) {
@@ -332,7 +332,7 @@
   RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000, 50, 0, offset_ms);
 }
 
-// The following test cases begin with "Evaluation" as a referrence to the
+// The following test cases begin with "Evaluation" as a reference to the
 // Internet draft https://tools.ietf.org/html/draft-ietf-rmcat-eval-test-01.
 
 TEST_P(BweSimulation, Evaluation1) {
@@ -380,20 +380,20 @@
 TEST_P(BweSimulation, GccComparison1) {
   RunVariableCapacity1SingleFlow(GetParam());
   BweTest gcc_test(false);
-  gcc_test.RunVariableCapacity1SingleFlow(kFullSendSideEstimator);
+  gcc_test.RunVariableCapacity1SingleFlow(kSendSideEstimator);
 }
 
 TEST_P(BweSimulation, GccComparison2) {
   const size_t kNumFlows = 2;
   RunVariableCapacity2MultipleFlows(GetParam(), kNumFlows);
   BweTest gcc_test(false);
-  gcc_test.RunVariableCapacity2MultipleFlows(kFullSendSideEstimator, kNumFlows);
+  gcc_test.RunVariableCapacity2MultipleFlows(kSendSideEstimator, kNumFlows);
 }
 
 TEST_P(BweSimulation, GccComparison3) {
   RunBidirectionalFlow(GetParam());
   BweTest gcc_test(false);
-  gcc_test.RunBidirectionalFlow(kFullSendSideEstimator);
+  gcc_test.RunBidirectionalFlow(kSendSideEstimator);
 }
 
 TEST_P(BweSimulation, GccComparison4) {
@@ -405,13 +405,13 @@
 TEST_P(BweSimulation, GccComparison5) {
   RunRoundTripTimeFairness(GetParam());
   BweTest gcc_test(false);
-  gcc_test.RunRoundTripTimeFairness(kFullSendSideEstimator);
+  gcc_test.RunRoundTripTimeFairness(kSendSideEstimator);
 }
 
 TEST_P(BweSimulation, GccComparison6) {
   RunLongTcpFairness(GetParam());
   BweTest gcc_test(false);
-  gcc_test.RunLongTcpFairness(kFullSendSideEstimator);
+  gcc_test.RunLongTcpFairness(kSendSideEstimator);
 }
 
 TEST_P(BweSimulation, GccComparison7) {
@@ -426,14 +426,14 @@
                               tcp_starting_times_ms);
 
   BweTest gcc_test(false);
-  gcc_test.RunMultipleShortTcpFairness(
-      kFullSendSideEstimator, tcp_file_sizes_bytes, tcp_starting_times_ms);
+  gcc_test.RunMultipleShortTcpFairness(kSendSideEstimator, tcp_file_sizes_bytes,
+                                       tcp_starting_times_ms);
 }
 
 TEST_P(BweSimulation, GccComparison8) {
   RunPauseResumeFlows(GetParam());
   BweTest gcc_test(false);
-  gcc_test.RunPauseResumeFlows(kFullSendSideEstimator);
+  gcc_test.RunPauseResumeFlows(kSendSideEstimator);
 }
 
 TEST_P(BweSimulation, GccComparisonChoke) {
@@ -442,7 +442,7 @@
   RunChoke(GetParam(), capacities_kbps);
 
   BweTest gcc_test(false);
-  gcc_test.RunChoke(kFullSendSideEstimator, capacities_kbps);
+  gcc_test.RunChoke(kSendSideEstimator, capacities_kbps);
 }
 
 }  // namespace bwe
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc
index e307242..a486bce 100644
--- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc
+++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc
@@ -57,8 +57,7 @@
 
 INSTANTIATE_TEST_CASE_P(VideoSendersTest,
                         BweFeedbackTest,
-                        ::testing::Values(kRembEstimator,
-                                          kFullSendSideEstimator));
+                        ::testing::Values(kRembEstimator, kSendSideEstimator));
 
 TEST_P(BweFeedbackTest, ConstantCapacity) {
   AdaptiveVideoSource source(0, 30, 300, 0, 0);
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe.cc
index b21a269..7e339fb 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe.cc
@@ -90,8 +90,8 @@
   switch (estimator) {
     case kRembEstimator:
       return new RembBweSender(kbps, observer, clock);
-    case kFullSendSideEstimator:
-      return new FullBweSender(kbps, observer, clock);
+    case kSendSideEstimator:
+      return new SendSideBweSender(kbps, observer, clock);
     case kNadaEstimator:
       return new NadaBweSender(kbps, observer, clock);
     case kTcpEstimator:
@@ -109,7 +109,7 @@
   switch (type) {
     case kRembEstimator:
       return new RembReceiver(flow_id, plot);
-    case kFullSendSideEstimator:
+    case kSendSideEstimator:
       return new SendSideBweReceiver(flow_id);
     case kNadaEstimator:
       return new NadaBweReceiver(flow_id);
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe.h b/webrtc/modules/remote_bitrate_estimator/test/bwe.h
index b811773..0d101fc 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe.h
@@ -176,7 +176,7 @@
   kNullEstimator,
   kNadaEstimator,
   kRembEstimator,
-  kFullSendSideEstimator,
+  kSendSideEstimator,
   kTcpEstimator
 };
 
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h b/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h
index 6bf5721..cb9af9a 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h
@@ -16,7 +16,7 @@
 #include <vector>
 
 #include "webrtc/base/constructormagic.h"
-#include "webrtc/call/mock/mock_rtc_event_log.h"
+#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
 
 namespace webrtc {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc
index 0b93128..0203a91 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc
@@ -13,7 +13,7 @@
 #include <algorithm>
 
 #include "webrtc/base/logging.h"
-#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h"
+#include "webrtc/modules/congestion_controller/delay_based_bwe.h"
 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
 
 namespace webrtc {
@@ -22,12 +22,14 @@
 
 const int kFeedbackIntervalMs = 50;
 
-FullBweSender::FullBweSender(int kbps, BitrateObserver* observer, Clock* clock)
+SendSideBweSender::SendSideBweSender(int kbps,
+                                     BitrateObserver* observer,
+                                     Clock* clock)
     : bitrate_controller_(
           BitrateController::CreateBitrateController(clock,
                                                      observer,
                                                      &event_log_)),
-      rbe_(new RemoteBitrateEstimatorAbsSendTime(this, clock)),
+      bwe_(new DelayBasedBwe(clock)),
       feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()),
       clock_(clock),
       send_time_history_(clock_, 10000),
@@ -39,17 +41,16 @@
   bitrate_controller_->SetStartBitrate(1000 * kbps);
   bitrate_controller_->SetMinMaxBitrate(1000 * kMinBitrateKbps,
                                         1000 * kMaxBitrateKbps);
-  rbe_->SetMinBitrate(1000 * kMinBitrateKbps);
+  bwe_->SetMinBitrate(1000 * kMinBitrateKbps);
 }
 
-FullBweSender::~FullBweSender() {
-}
+SendSideBweSender::~SendSideBweSender() {}
 
-int FullBweSender::GetFeedbackIntervalMs() const {
+int SendSideBweSender::GetFeedbackIntervalMs() const {
   return kFeedbackIntervalMs;
 }
 
-void FullBweSender::GiveFeedback(const FeedbackPacket& feedback) {
+void SendSideBweSender::GiveFeedback(const FeedbackPacket& feedback) {
   const SendSideBweFeedback& fb =
       static_cast<const SendSideBweFeedback&>(feedback);
   if (fb.packet_feedback_vector().empty())
@@ -67,10 +68,14 @@
 
   int64_t rtt_ms =
       clock_->TimeInMilliseconds() - feedback.latest_send_time_ms();
-  rbe_->OnRttUpdate(rtt_ms, rtt_ms);
+  bwe_->OnRttUpdate(rtt_ms, rtt_ms);
   BWE_TEST_LOGGING_PLOT(1, "RTT", clock_->TimeInMilliseconds(), rtt_ms);
 
-  rbe_->IncomingPacketFeedbackVector(packet_feedback_vector);
+  DelayBasedBwe::Result result =
+      bwe_->IncomingPacketFeedbackVector(packet_feedback_vector);
+  if (result.updated)
+    bitrate_controller_->OnDelayBasedBweResult(result);
+
   if (has_received_ack_) {
     int expected_packets = fb.packet_feedback_vector().back().sequence_number -
                            last_acked_seq_num_;
@@ -99,7 +104,7 @@
   }
 }
 
-void FullBweSender::OnPacketsSent(const Packets& packets) {
+void SendSideBweSender::OnPacketsSent(const Packets& packets) {
   for (Packet* packet : packets) {
     if (packet->GetPacketType() == Packet::kMedia) {
       MediaPacket* media_packet = static_cast<MediaPacket*>(packet);
@@ -114,17 +119,17 @@
   }
 }
 
-void FullBweSender::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs,
-                                            uint32_t bitrate) {
+void SendSideBweSender::OnReceiveBitrateChanged(
+    const std::vector<uint32_t>& ssrcs,
+    uint32_t bitrate) {
   feedback_observer_->OnReceivedEstimatedBitrate(bitrate);
 }
 
-int64_t FullBweSender::TimeUntilNextProcess() {
+int64_t SendSideBweSender::TimeUntilNextProcess() {
   return bitrate_controller_->TimeUntilNextProcess();
 }
 
-void FullBweSender::Process() {
-  rbe_->Process();
+void SendSideBweSender::Process() {
   bitrate_controller_->Process();
 }
 
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h b/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h
index aa7914e..90ec50f 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h
@@ -14,7 +14,7 @@
 #include <memory>
 #include <vector>
 
-#include "webrtc/call/mock/mock_rtc_event_log.h"
+#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h"
 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
 
@@ -22,10 +22,10 @@
 namespace testing {
 namespace bwe {
 
-class FullBweSender : public BweSender, public RemoteBitrateObserver {
+class SendSideBweSender : public BweSender, public RemoteBitrateObserver {
  public:
-  FullBweSender(int kbps, BitrateObserver* observer, Clock* clock);
-  virtual ~FullBweSender();
+  SendSideBweSender(int kbps, BitrateObserver* observer, Clock* clock);
+  virtual ~SendSideBweSender();
 
   int GetFeedbackIntervalMs() const override;
   void GiveFeedback(const FeedbackPacket& feedback) override;
@@ -37,7 +37,7 @@
 
  protected:
   std::unique_ptr<BitrateController> bitrate_controller_;
-  std::unique_ptr<RemoteBitrateEstimator> rbe_;
+  std::unique_ptr<DelayBasedBwe> bwe_;
   std::unique_ptr<RtcpBandwidthObserver> feedback_observer_;
 
  private:
@@ -50,7 +50,7 @@
   SequenceNumberUnwrapper seq_num_unwrapper_;
   ::testing::NiceMock<MockRtcEventLog> event_log_;
 
-  RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FullBweSender);
+  RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendSideBweSender);
 };
 
 class SendSideBweReceiver : public BweReceiver {
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index 2f664d7..c050d18 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -13,7 +13,7 @@
 
 #include "webrtc/base/buffer.h"
 #include "webrtc/base/rate_limiter.h"
-#include "webrtc/call/mock/mock_rtc_event_log.h"
+#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"