New targets call:rtp_interfaces, call:rtp_receiver, call:rtp_sender.

BUG=webrtc:7135
TBR=sprang@webrtc.org

Review-Url: https://codereview.webrtc.org/2913143003
Cr-Commit-Position: refs/heads/master@{#18371}
diff --git a/webrtc/audio/BUILD.gn b/webrtc/audio/BUILD.gn
index eba0880..1757e4e 100644
--- a/webrtc/audio/BUILD.gn
+++ b/webrtc/audio/BUILD.gn
@@ -40,6 +40,7 @@
     "../base:rtc_base_approved",
     "../base:rtc_task_queue",
     "../call:call_interfaces",
+    "../call:rtp_interfaces",
     "../common_audio",
     "../modules/audio_coding:cng",
     "../modules/audio_device",
diff --git a/webrtc/audio/audio_receive_stream.h b/webrtc/audio/audio_receive_stream.h
index d0b5a4d..7dcc6d3 100644
--- a/webrtc/audio/audio_receive_stream.h
+++ b/webrtc/audio/audio_receive_stream.h
@@ -19,7 +19,7 @@
 #include "webrtc/base/constructormagic.h"
 #include "webrtc/base/thread_checker.h"
 #include "webrtc/call/audio_receive_stream.h"
-#include "webrtc/call/rtp_demuxer.h"
+#include "webrtc/call/rtp_packet_sink_interface.h"
 #include "webrtc/call/syncable.h"
 
 namespace webrtc {
diff --git a/webrtc/call/BUILD.gn b/webrtc/call/BUILD.gn
index 8360534..7caad96 100644
--- a/webrtc/call/BUILD.gn
+++ b/webrtc/call/BUILD.gn
@@ -16,12 +16,11 @@
     "audio_state.h",
     "call.h",
     "flexfec_receive_stream.h",
-    "rtp_demuxer.h",
-    "rtp_transport_controller_send_interface.h",
     "syncable.cc",
     "syncable.h",
   ]
   deps = [
+    ":rtp_interfaces",
     "..:video_stream_api",
     "..:webrtc_common",
     "../api:audio_mixer_api",
@@ -33,17 +32,47 @@
   ]
 }
 
+# TODO(nisse): These RTP targets should be moved elsewhere
+# when interfaces have stabilized.
+rtc_source_set("rtp_interfaces") {
+  sources = [
+    "rtp_packet_sink_interface.h",
+    "rtp_transport_controller_send_interface.h",
+  ]
+}
+
+rtc_source_set("rtp_receiver") {
+  sources = [
+    "rtp_demuxer.cc",
+    "rtp_demuxer.h",
+    "rtx_receive_stream.cc",
+    "rtx_receive_stream.h",
+  ]
+  deps = [
+    ":rtp_interfaces",
+    "../base:rtc_base_approved",
+    "../modules/rtp_rtcp",
+  ]
+}
+
+rtc_source_set("rtp_sender") {
+  sources = [
+    "rtp_transport_controller_send.cc",
+    "rtp_transport_controller_send.h",
+  ]
+  deps = [
+    ":rtp_interfaces",
+    "../base:rtc_base_approved",
+    "../modules/congestion_controller",
+  ]
+}
+
 rtc_static_library("call") {
   sources = [
     "bitrate_allocator.cc",
     "call.cc",
     "flexfec_receive_stream_impl.cc",
     "flexfec_receive_stream_impl.h",
-    "rtp_demuxer.cc",
-    "rtp_transport_controller_send.cc",
-    "rtp_transport_controller_send.h",
-    "rtx_receive_stream.cc",
-    "rtx_receive_stream.h",
   ]
 
   if (!build_with_chromium && is_clang) {
@@ -58,6 +87,9 @@
 
   deps = [
     ":call_interfaces",
+    ":rtp_interfaces",
+    ":rtp_receiver",
+    ":rtp_sender",
     "..:webrtc_common",
     "../api:transport_api",
     "../audio",
@@ -94,6 +126,9 @@
     ]
     deps = [
       ":call",
+      ":rtp_interfaces",
+      ":rtp_receiver",
+      ":rtp_sender",
       "../api:mock_audio_mixer",
       "../base:rtc_base_approved",
       "../logging:rtc_event_log_api",
diff --git a/webrtc/call/flexfec_receive_stream_impl.h b/webrtc/call/flexfec_receive_stream_impl.h
index 39fcaa7..e4c2294 100644
--- a/webrtc/call/flexfec_receive_stream_impl.h
+++ b/webrtc/call/flexfec_receive_stream_impl.h
@@ -15,7 +15,7 @@
 
 #include "webrtc/base/criticalsection.h"
 #include "webrtc/call/flexfec_receive_stream.h"
-#include "webrtc/call/rtp_demuxer.h"
+#include "webrtc/call/rtp_packet_sink_interface.h"
 
 namespace webrtc {
 
diff --git a/webrtc/call/rtp_demuxer.cc b/webrtc/call/rtp_demuxer.cc
index d7179c0..916e612 100644
--- a/webrtc/call/rtp_demuxer.cc
+++ b/webrtc/call/rtp_demuxer.cc
@@ -10,6 +10,7 @@
 
 #include "webrtc/base/checks.h"
 #include "webrtc/call/rtp_demuxer.h"
+#include "webrtc/call/rtp_packet_sink_interface.h"
 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
 
 namespace webrtc {
diff --git a/webrtc/call/rtp_demuxer.h b/webrtc/call/rtp_demuxer.h
index e1a8160..2c9b725 100644
--- a/webrtc/call/rtp_demuxer.h
+++ b/webrtc/call/rtp_demuxer.h
@@ -15,13 +15,7 @@
 namespace webrtc {
 
 class RtpPacketReceived;
-
-// This class represents a receiver of an already parsed RTP packets.
-class RtpPacketSinkInterface {
- public:
-  virtual ~RtpPacketSinkInterface() {}
-  virtual void OnRtpPacket(const RtpPacketReceived& packet) = 0;
-};
+class RtpPacketSinkInterface;
 
 // This class represents the RTP demuxing, for a single RTP session (i.e., one
 // ssrc space, see RFC 7656). It isn't thread aware, leaving responsibility of
diff --git a/webrtc/call/rtp_demuxer_unittest.cc b/webrtc/call/rtp_demuxer_unittest.cc
index 6aee11e..9b47c41 100644
--- a/webrtc/call/rtp_demuxer_unittest.cc
+++ b/webrtc/call/rtp_demuxer_unittest.cc
@@ -15,6 +15,7 @@
 #include "webrtc/base/arraysize.h"
 #include "webrtc/base/checks.h"
 #include "webrtc/base/ptr_util.h"
+#include "webrtc/call/rtp_packet_sink_interface.h"
 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
 #include "webrtc/test/gmock.h"
 #include "webrtc/test/gtest.h"
diff --git a/webrtc/call/rtp_packet_sink_interface.h b/webrtc/call/rtp_packet_sink_interface.h
new file mode 100644
index 0000000..900ca35
--- /dev/null
+++ b/webrtc/call/rtp_packet_sink_interface.h
@@ -0,0 +1,26 @@
+/*
+ *  Copyright (c) 2017 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.
+ */
+#ifndef WEBRTC_CALL_RTP_PACKET_SINK_INTERFACE_H_
+#define WEBRTC_CALL_RTP_PACKET_SINK_INTERFACE_H_
+
+namespace webrtc {
+
+class RtpPacketReceived;
+
+// This class represents a receiver of an already parsed RTP packets.
+class RtpPacketSinkInterface {
+ public:
+  virtual ~RtpPacketSinkInterface() {}
+  virtual void OnRtpPacket(const RtpPacketReceived& packet) = 0;
+};
+
+}  // namespace webrtc
+
+#endif  // WEBRTC_CALL_RTP_PACKET_SINK_INTERFACE_H_
diff --git a/webrtc/call/rtx_receive_stream.h b/webrtc/call/rtx_receive_stream.h
index 1f57580..2830dd3 100644
--- a/webrtc/call/rtx_receive_stream.h
+++ b/webrtc/call/rtx_receive_stream.h
@@ -13,7 +13,7 @@
 
 #include <map>
 
-#include "webrtc/call/rtp_demuxer.h"
+#include "webrtc/call/rtp_packet_sink_interface.h"
 
 namespace webrtc {
 
diff --git a/webrtc/video/BUILD.gn b/webrtc/video/BUILD.gn
index 19d0e93..cc16269 100644
--- a/webrtc/video/BUILD.gn
+++ b/webrtc/video/BUILD.gn
@@ -62,6 +62,7 @@
     "../base:rtc_numerics",
     "../base:rtc_task_queue",
     "../call:call_interfaces",
+    "../call:rtp_interfaces",
     "../common_video",
     "../logging:rtc_event_log_api",
     "../media:rtc_media_base",
diff --git a/webrtc/video/video_receive_stream.h b/webrtc/video/video_receive_stream.h
index 6656b34..9cf7215 100644
--- a/webrtc/video/video_receive_stream.h
+++ b/webrtc/video/video_receive_stream.h
@@ -15,7 +15,7 @@
 #include <vector>
 
 #include "webrtc/base/thread_checker.h"
-#include "webrtc/call/rtp_demuxer.h"
+#include "webrtc/call/rtp_packet_sink_interface.h"
 #include "webrtc/call/syncable.h"
 #include "webrtc/common_video/include/incoming_video_stream.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
diff --git a/webrtc/voice_engine/BUILD.gn b/webrtc/voice_engine/BUILD.gn
index 429c346..253eacb 100644
--- a/webrtc/voice_engine/BUILD.gn
+++ b/webrtc/voice_engine/BUILD.gn
@@ -144,13 +144,10 @@
     "../audio/utility:audio_frame_operations",
     "../base:rtc_base_approved",
     "../base:rtc_task_queue",
-    "../modules:module_api",
-
-    # TODO(nisse): Delete when declaration of RtpTransportController
-    # and related interfaces move to api/.
-    "../call:call_interfaces",
+    "../call:rtp_interfaces",
     "../common_audio",
     "../logging:rtc_event_log_api",
+    "../modules:module_api",
     "../modules/audio_coding:audio_format_conversion",
     "../modules/audio_coding:rent_a_codec",
     "../modules/audio_conference_mixer",