Index: webrtc/media/base/videobroadcaster.h |
diff --git a/webrtc/media/base/videobroadcaster.h b/webrtc/media/base/videobroadcaster.h |
index f0009c92ace228f9be10b1c7a3d9a8152e3405ab..63c22730c7f1df7d7316a682dcf2b22990e8eb2d 100644 |
--- a/webrtc/media/base/videobroadcaster.h |
+++ b/webrtc/media/base/videobroadcaster.h |
@@ -11,6 +11,50 @@ |
#ifndef WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_ |
#define WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_ |
-// TODO(perkj): Implement. |
+#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 VideoSinkWants& wants) override; |
+ 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 VideoSinkWants a source is requested to fulfill. They are |
+ // aggregated by all VideoSinkWants from all sinks. |
+ VideoSinkWants wants() const; |
+ |
+ void OnFrame(const cricket::VideoFrame& frame) override; |
+ |
+ protected: |
+ struct SinkPair { |
+ SinkPair(VideoSinkInterface<cricket::VideoFrame>* sink, |
+ VideoSinkWants wants) |
+ : sink(sink), wants(wants) {} |
+ VideoSinkInterface<cricket::VideoFrame>* sink; |
+ VideoSinkWants wants; |
+ }; |
+ SinkPair* FindSinkPair(const VideoSinkInterface<cricket::VideoFrame>* sink); |
+ |
+ ThreadChecker thread_checker_; |
+ |
+ VideoSinkWants current_wants_; |
+ |
+ std::vector<SinkPair> sinks_; |
+}; |
+ |
+} // namespace rtc |
#endif // WEBRTC_MEDIA_BASE_VIDEOBROADCASTER_H_ |