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

Unified Diff: webrtc/media/base/videobroadcaster.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/videobroadcaster.h
diff --git a/webrtc/media/base/videobroadcaster.h b/webrtc/media/base/videobroadcaster.h
new file mode 100644
index 0000000000000000000000000000000000000000..338a17f2c0a9440c9e879bed1150a1f0657a3eca
--- /dev/null
+++ b/webrtc/media/base/videobroadcaster.h
@@ -0,0 +1,52 @@
+/*
+ * 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_VIDEOBROADCASTER_H_
+#define WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_
+
+#include <utility>
+#include <vector>
+
+#include "webrtc/base/thread_checker.h"
+#include "webrtc/media/base/videoframe.h"
+#include "webrtc/media/base/videosinkinterface.h"
+#include "webrtc/media/base/videosourceinterface.h"
+
+namespace rtc {
+
+class VideoBroadcaster : public VideoSourceInterface<cricket::VideoFrame>,
+ public VideoSinkInterface<cricket::VideoFrame> {
+ public:
+ VideoBroadcaster();
+ void AddOrUpdateSink(VideoSinkInterface<cricket::VideoFrame>* sink,
+ const VideoWants& hints) override;
nisse-webrtc 2016/02/09 14:10:54 nit: Rename also the argument name hints -> wants.
perkj_webrtc 2016/02/10 10:54:36 Done.
+ void RemoveSink(VideoSinkInterface<cricket::VideoFrame>* sink) override;
+
+ // Returns true if the next frame will be delivered to at least one sink.
+ bool frame_wanted() const;
+
+ // Returns VideoWants a source is requested to fulfill. They are aggregated
+ // by all VideoWants from all sinks.
+ VideoWants sink_wants() const;
+
+ void OnFrame(const cricket::VideoFrame& frame) override;
+
+ protected:
+ ThreadChecker thread_checker_;
+
+ VideoWants current_hints_;
pthatcher1 2016/02/09 17:13:41 wants_?
perkj_webrtc 2016/02/10 10:54:36 Done.
+ using SinkPair =
+ std::pair<VideoSinkInterface<cricket::VideoFrame>*, VideoWants>;
pthatcher1 2016/02/09 17:13:41 If you make a simple struct, then you can use .sin
perkj_webrtc 2016/02/10 10:54:36 Done.
+ std::vector<SinkPair> sinks_;
+};
+
+} // namespace rtc
+
+#endif // WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_

Powered by Google App Engine
This is Rietveld 408576698