Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: webrtc/media/base/videosourceinterface.h

Issue 1655793003: Make cricket::VideoCapturer implement VideoSourceInterface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Removed AddSink Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/base/videosourceinterface.h
diff --git a/webrtc/media/base/videosourceinterface.h b/webrtc/media/base/videosourceinterface.h
new file mode 100644
index 0000000000000000000000000000000000000000..28c6ab9ef0f16c90b49aa87fa30af29fab3d3e76
--- /dev/null
+++ b/webrtc/media/base/videosourceinterface.h
@@ -0,0 +1,46 @@
+/*
+ * 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 WEBRTC_MEDIA_BASE_VIDEOSOURCEINTERFACE_H_
+#define WEBRTC_MEDIA_BASE_VIDEOSOURCEINTERFACE_H_
+
+#include "webrtc/media/base/videosinkinterface.h"
+#include "webrtc/base/callback.h"
+
+namespace rtc {
+
+// VideoWants is a used for notifying the source of properties a video frame
+// should have when it is delivered to a certain sink.
+struct VideoWants {
+ bool operator==(const VideoWants& rh) const {
+ return rotation_applied == rh.rotation_applied;
+ }
+ bool operator!=(const VideoWants& rh) const { return !operator==(rh); }
+
+ // Tells the source whether the sink wants frames with rotation applied.
+ // By default, the rotation is applied by the source.
+ bool rotation_applied = true;
+};
+
+template <typename VideoFrameT>
+class VideoSourceInterface {
+ public:
+ virtual void AddOrUpdateSink(VideoSinkInterface<VideoFrameT>* sink,
nisse-webrtc 2016/02/09 14:10:54 I don't insist on this, but I think it will be pre
pthatcher1 2016/02/09 17:13:41 It would be prettier. The tradeoff is when you se
perkj_webrtc 2016/02/10 10:54:36 I vote on AddOrUpdate... Guess what - we are mor
pthatcher1 2016/02/10 19:29:19 Yeah, I realized that, too. I guess you convinced
+ const VideoWants& 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 // WEBRTC_MEDIA_BASE_VIDEOSOURCEINTERFACE_H_

Powered by Google App Engine
This is Rietveld 408576698