Move videosourceinterface to api.

VideoSourceInterface is clearly an integral part of
mediastreaminterface.h already, so moving that interface to api makes
sense. This also resolves a circular dependency in call/.

Bug: webrc:6828
Change-Id: Ic1862f118363b0b55a235a9c0c35d9adc647184c
Reviewed-on: https://webrtc-review.googlesource.com/37500
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21498}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 05c0aee..8bbfc26 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -73,6 +73,8 @@
     "umametrics.cc",
     "umametrics.h",
     "videosinkinterface.h",
+    "videosourceinterface.cc",
+    "videosourceinterface.h",
     "videosourceproxy.h",
   ]
 
diff --git a/api/mediastreaminterface.h b/api/mediastreaminterface.h
index 1350b29..3273c6d 100644
--- a/api/mediastreaminterface.h
+++ b/api/mediastreaminterface.h
@@ -28,7 +28,7 @@
 // relying on them; they were previously transitively included by
 // mediachannel.h, which is no longer a dependency of this file.
 #include "api/videosinkinterface.h"
-#include "media/base/videosourceinterface.h"
+#include "api/videosourceinterface.h"
 #include "modules/audio_processing/include/audio_processing_statistics.h"
 #include "rtc_base/ratetracker.h"
 #include "rtc_base/refcount.h"
diff --git a/api/videosourceinterface.cc b/api/videosourceinterface.cc
new file mode 100644
index 0000000..5eda369
--- /dev/null
+++ b/api/videosourceinterface.cc
@@ -0,0 +1,18 @@
+/*
+ *  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.
+ */
+
+#include "api/videosourceinterface.h"
+
+namespace rtc {
+
+VideoSinkWants::VideoSinkWants() = default;
+VideoSinkWants::~VideoSinkWants() = default;
+
+}  // namespace rtc
diff --git a/api/videosourceinterface.h b/api/videosourceinterface.h
new file mode 100644
index 0000000..ffb017a
--- /dev/null
+++ b/api/videosourceinterface.h
@@ -0,0 +1,59 @@
+/*
+ *  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.
+ */
+
+#ifndef API_VIDEOSOURCEINTERFACE_H_
+#define API_VIDEOSOURCEINTERFACE_H_
+
+#include <limits>
+
+#include "api/optional.h"
+#include "api/videosinkinterface.h"
+
+namespace rtc {
+
+// VideoSinkWants is used for notifying the source of properties a video frame
+// should have when it is delivered to a certain sink.
+struct VideoSinkWants {
+  VideoSinkWants();
+  ~VideoSinkWants();
+  // Tells the source whether the sink wants frames with rotation applied.
+  // By default, any rotation must be applied by the sink.
+  bool rotation_applied = false;
+
+  // Tells the source that the sink only wants black frames.
+  bool black_frames = false;
+
+  // Tells the source the maximum number of pixels the sink wants.
+  int max_pixel_count = std::numeric_limits<int>::max();
+  // Tells the source the desired number of pixels the sinks wants. This will
+  // typically be used when stepping the resolution up again when conditions
+  // have improved after an earlier downgrade. The source should select the
+  // closest resolution to this pixel count, but if max_pixel_count is set, it
+  // still sets the absolute upper bound.
+  rtc::Optional<int> target_pixel_count;
+  // Tells the source the maximum framerate the sink wants.
+  int max_framerate_fps = std::numeric_limits<int>::max();
+};
+
+template <typename VideoFrameT>
+class VideoSourceInterface {
+ public:
+  virtual void AddOrUpdateSink(VideoSinkInterface<VideoFrameT>* sink,
+                               const VideoSinkWants& wants) = 0;
+  // RemoveSink must guarantee that at the time the method returns,
+  // there is no current and no future calls to VideoSinkInterface::OnFrame.
+  virtual void RemoveSink(VideoSinkInterface<VideoFrameT>* sink) = 0;
+
+ protected:
+  virtual ~VideoSourceInterface() {}
+};
+
+}  // namespace rtc
+#endif  // API_VIDEOSOURCEINTERFACE_H_