Move congestion controller to a separate module.

This allows other projects to more easily depend on this.

The plan is to move remote_bitrate_estimator and bitrate_controller into this module and reduce the exposed interface to only a simplified version of congestion_controller.h.

No functional changes in this CL.

R=mflodman@webrtc.org, pbos@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#11718}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 011e3af..e206e40 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -21,6 +21,7 @@
   'webrtc/common_video',
   'webrtc/examples',
   'webrtc/modules/bitrate_controller',
+  'webrtc/modules/congestion_controller',
   'webrtc/modules/pacing',
   'webrtc/modules/remote_bitrate_estimator',
   'webrtc/modules/rtp_rtcp',
@@ -61,6 +62,7 @@
   'webrtc/modules/audio_device/include',
   'webrtc/modules/audio_processing/include',
   'webrtc/modules/bitrate_controller/include',
+  'webrtc/modules/congestion_controller/include',
   'webrtc/modules/include',
   'webrtc/modules/remote_bitrate_estimator/include',
   'webrtc/modules/rtp_rtcp/include',
diff --git a/webrtc/audio/audio_receive_stream.cc b/webrtc/audio/audio_receive_stream.cc
index 9f19b32..7ff5ff3 100644
--- a/webrtc/audio/audio_receive_stream.cc
+++ b/webrtc/audio/audio_receive_stream.cc
@@ -18,7 +18,7 @@
 #include "webrtc/audio/conversion.h"
 #include "webrtc/base/checks.h"
 #include "webrtc/base/logging.h"
-#include "webrtc/call/congestion_controller.h"
+#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
 #include "webrtc/system_wrappers/include/tick_util.h"
 #include "webrtc/voice_engine/channel_proxy.h"
diff --git a/webrtc/audio/audio_receive_stream_unittest.cc b/webrtc/audio/audio_receive_stream_unittest.cc
index e8cc281..8703d6e 100644
--- a/webrtc/audio/audio_receive_stream_unittest.cc
+++ b/webrtc/audio/audio_receive_stream_unittest.cc
@@ -15,8 +15,8 @@
 
 #include "webrtc/audio/audio_receive_stream.h"
 #include "webrtc/audio/conversion.h"
-#include "webrtc/call/mock/mock_congestion_controller.h"
 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
+#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
 #include "webrtc/modules/pacing/packet_router.h"
 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h"
 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
diff --git a/webrtc/audio/audio_send_stream.cc b/webrtc/audio/audio_send_stream.cc
index f369639..49d867b 100644
--- a/webrtc/audio/audio_send_stream.cc
+++ b/webrtc/audio/audio_send_stream.cc
@@ -17,7 +17,7 @@
 #include "webrtc/audio/scoped_voe_interface.h"
 #include "webrtc/base/checks.h"
 #include "webrtc/base/logging.h"
-#include "webrtc/call/congestion_controller.h"
+#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 #include "webrtc/modules/pacing/paced_sender.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
 #include "webrtc/voice_engine/channel_proxy.h"
diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc
index d8ad82d..6788699 100644
--- a/webrtc/audio/audio_send_stream_unittest.cc
+++ b/webrtc/audio/audio_send_stream_unittest.cc
@@ -16,8 +16,8 @@
 #include "webrtc/audio/audio_send_stream.h"
 #include "webrtc/audio/audio_state.h"
 #include "webrtc/audio/conversion.h"
-#include "webrtc/call/congestion_controller.h"
 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
+#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 #include "webrtc/modules/pacing/paced_sender.h"
 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h"
 #include "webrtc/test/mock_voe_channel_proxy.h"
diff --git a/webrtc/call/BUILD.gn b/webrtc/call/BUILD.gn
index 498c724..c044e69 100644
--- a/webrtc/call/BUILD.gn
+++ b/webrtc/call/BUILD.gn
@@ -12,7 +12,6 @@
   sources = [
     "bitrate_allocator.cc",
     "call.cc",
-    "congestion_controller.cc",
     "transport_adapter.cc",
     "transport_adapter.h",
   ]
@@ -29,6 +28,7 @@
   deps = [
     "..:rtc_event_log",
     "..:webrtc_common",
+    "../modules/congestion_controller",
     "../modules/rtp_rtcp",
     "../system_wrappers",
   ]
diff --git a/webrtc/call/call.cc b/webrtc/call/call.cc
index eba0c96..d538761 100644
--- a/webrtc/call/call.cc
+++ b/webrtc/call/call.cc
@@ -25,10 +25,10 @@
 #include "webrtc/base/trace_event.h"
 #include "webrtc/call.h"
 #include "webrtc/call/bitrate_allocator.h"
-#include "webrtc/call/congestion_controller.h"
 #include "webrtc/call/rtc_event_log.h"
 #include "webrtc/config.h"
 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
+#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 #include "webrtc/modules/pacing/paced_sender.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
diff --git a/webrtc/call/webrtc_call.gypi b/webrtc/call/webrtc_call.gypi
index 0c3efff..455a11a 100644
--- a/webrtc/call/webrtc_call.gypi
+++ b/webrtc/call/webrtc_call.gypi
@@ -9,6 +9,7 @@
   'variables': {
     'webrtc_call_dependencies': [
       '<(webrtc_root)/common.gyp:webrtc_common',
+      '<(webrtc_root)/modules/modules.gyp:congestion_controller',
       '<(webrtc_root)/modules/modules.gyp:rtp_rtcp',
       '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
       '<(webrtc_root)/webrtc.gyp:rtc_event_log',
@@ -16,7 +17,6 @@
     'webrtc_call_sources': [
       'call/bitrate_allocator.cc',
       'call/call.cc',
-      'call/congestion_controller.cc',
       'call/transport_adapter.cc',
       'call/transport_adapter.h',
     ],
diff --git a/webrtc/modules/congestion_controller/BUILD.gn b/webrtc/modules/congestion_controller/BUILD.gn
new file mode 100644
index 0000000..8723fe4
--- /dev/null
+++ b/webrtc/modules/congestion_controller/BUILD.gn
@@ -0,0 +1,38 @@
+# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS.  All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../build/webrtc.gni")
+
+source_set("congestion_controller") {
+  sources = [
+    "congestion_controller.cc",
+    "include/congestion_controller.h",
+  ]
+
+  if (is_win) {
+    cflags = [
+      # TODO(jschuh): Bug 1348: fix this warning.
+      "/wd4267",  # size_t to int truncations
+    ]
+  }
+
+  configs += [ "../..:common_config" ]
+  public_configs = [ "../..:common_inherited_config" ]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+
+  deps = [
+    "../bitrate_controller",
+    "../pacing",
+    "../remote_bitrate_estimator",
+  ]
+}
diff --git a/webrtc/call/congestion_controller.cc b/webrtc/modules/congestion_controller/congestion_controller.cc
similarity index 98%
rename from webrtc/call/congestion_controller.cc
rename to webrtc/modules/congestion_controller/congestion_controller.cc
index e2b9c23..0282e81 100644
--- a/webrtc/call/congestion_controller.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "webrtc/call/congestion_controller.h"
+#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 
 #include <algorithm>
 #include <vector>
diff --git a/webrtc/modules/congestion_controller/congestion_controller.gypi b/webrtc/modules/congestion_controller/congestion_controller.gypi
new file mode 100644
index 0000000..c2531ab
--- /dev/null
+++ b/webrtc/modules/congestion_controller/congestion_controller.gypi
@@ -0,0 +1,27 @@
+# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS.  All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+{
+  'targets': [
+    {
+      'target_name': 'congestion_controller',
+      'type': 'static_library',
+      'dependencies': [
+        '<(webrtc_root)/modules/modules.gyp:bitrate_controller',
+        '<(webrtc_root)/modules/modules.gyp:paced_sender',
+        '<(webrtc_root)/modules/modules.gyp:remote_bitrate_estimator',
+      ],
+      'sources': [
+        'congestion_controller.cc',
+        'include/congestion_controller.h',
+      ],
+      # TODO(jschuh): Bug 1348: fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
+    },
+  ], # targets
+}
diff --git a/webrtc/call/congestion_controller.h b/webrtc/modules/congestion_controller/include/congestion_controller.h
similarity index 92%
rename from webrtc/call/congestion_controller.h
rename to webrtc/modules/congestion_controller/include/congestion_controller.h
index ddc7abb..8c8972d 100644
--- a/webrtc/call/congestion_controller.h
+++ b/webrtc/modules/congestion_controller/include/congestion_controller.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_CALL_CONGESTION_CONTROLLER_H_
-#define WEBRTC_CALL_CONGESTION_CONTROLLER_H_
+#ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_
+#define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_
 
 #include "webrtc/base/scoped_ptr.h"
 #include "webrtc/base/thread_checker.h"
@@ -84,4 +84,4 @@
 
 }  // namespace webrtc
 
-#endif  // WEBRTC_CALL_CONGESTION_CONTROLLER_H_
+#endif  // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_CONGESTION_CONTROLLER_H_
diff --git a/webrtc/call/mock/mock_congestion_controller.h b/webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h
similarity index 84%
rename from webrtc/call/mock/mock_congestion_controller.h
rename to webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h
index 08b12a4..0813c3d 100644
--- a/webrtc/call/mock/mock_congestion_controller.h
+++ b/webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h
@@ -8,12 +8,12 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_CALL_MOCK_MOCK_CONGESTION_CONTROLLER_H_
-#define WEBRTC_CALL_MOCK_MOCK_CONGESTION_CONTROLLER_H_
+#ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_CONTROLLER_H_
+#define WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_CONTROLLER_H_
 
 #include "testing/gmock/include/gmock/gmock.h"
 #include "webrtc/base/socket.h"
-#include "webrtc/call/congestion_controller.h"
+#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 
 namespace webrtc {
 namespace test {
@@ -48,4 +48,4 @@
 };
 }  // namespace test
 }  // namespace webrtc
-#endif  // WEBRTC_CALL_MOCK_MOCK_CONGESTION_CONTROLLER_H_
+#endif  // WEBRTC_MODULES_CONGESTION_CONTROLLER_INCLUDE_MOCK_MOCK_CONGESTION_CONTROLLER_H_
diff --git a/webrtc/modules/modules.gyp b/webrtc/modules/modules.gyp
index 683b355..d520156 100644
--- a/webrtc/modules/modules.gyp
+++ b/webrtc/modules/modules.gyp
@@ -14,6 +14,7 @@
     'audio_device/audio_device.gypi',
     'audio_processing/audio_processing.gypi',
     'bitrate_controller/bitrate_controller.gypi',
+    'congestion_controller/congestion_controller.gypi',
     'desktop_capture/desktop_capture.gypi',
     'media_file/media_file.gypi',
     'pacing/pacing.gypi',
diff --git a/webrtc/video/video_receive_stream.cc b/webrtc/video/video_receive_stream.cc
index 4cfce34..f3bab1c 100644
--- a/webrtc/video/video_receive_stream.cc
+++ b/webrtc/video/video_receive_stream.cc
@@ -17,8 +17,8 @@
 
 #include "webrtc/base/checks.h"
 #include "webrtc/base/logging.h"
-#include "webrtc/call/congestion_controller.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
+#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 #include "webrtc/modules/utility/include/process_thread.h"
 #include "webrtc/system_wrappers/include/clock.h"
 #include "webrtc/video/call_stats.h"
diff --git a/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc
index d3dde5a..b2ed30e 100644
--- a/webrtc/video/video_send_stream.cc
+++ b/webrtc/video/video_send_stream.cc
@@ -18,9 +18,9 @@
 #include "webrtc/base/checks.h"
 #include "webrtc/base/logging.h"
 #include "webrtc/base/trace_event.h"
-#include "webrtc/call/congestion_controller.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
+#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
 #include "webrtc/modules/pacing/packet_router.h"
 #include "webrtc/modules/utility/include/process_thread.h"
 #include "webrtc/video/call_stats.h"