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

Unified Diff: webrtc/api/videotrackrenderers.h

Issue 1610243002: Move talk/app/webrtc to webrtc/api (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updated location for peerconnection_unittests.isolate Created 4 years, 11 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/api/videotrackrenderers.h
diff --git a/webrtc/api/videotrackrenderers.h b/webrtc/api/videotrackrenderers.h
new file mode 100644
index 0000000000000000000000000000000000000000..59cbc88dc69ccafbf0a62f4a6a1d1cb756ebf9f6
--- /dev/null
+++ b/webrtc/api/videotrackrenderers.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012 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_API_VIDEOTRACKRENDERERS_H_
+#define WEBRTC_API_VIDEOTRACKRENDERERS_H_
+
+#include <set>
+
+#include "talk/media/base/videorenderer.h"
+#include "webrtc/api/mediastreaminterface.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/scoped_ptr.h"
+
+namespace webrtc {
+
+// Class used for rendering cricket::VideoFrames to multiple renderers of type
+// VideoRendererInterface.
+// Each VideoTrack owns a VideoTrackRenderers instance.
+// The class is thread safe. Rendering to the added VideoRendererInterfaces is
+// done on the same thread as the cricket::VideoRenderer.
+class VideoTrackRenderers : public cricket::VideoRenderer {
+ public:
+ VideoTrackRenderers();
+ ~VideoTrackRenderers();
+
+ // Implements cricket::VideoRenderer. If the track is disabled,
+ // incoming frames are replaced by black frames.
+ virtual bool RenderFrame(const cricket::VideoFrame* frame);
+
+ void AddRenderer(VideoRendererInterface* renderer);
+ void RemoveRenderer(VideoRendererInterface* renderer);
+ void SetEnabled(bool enable);
+
+ private:
+ // Pass the frame on to to each registered renderer. Requires
+ // critical_section_ already locked.
+ void RenderFrameToRenderers(const cricket::VideoFrame* frame);
+
+ bool enabled_;
+ std::set<VideoRendererInterface*> renderers_;
+
+ rtc::CriticalSection critical_section_; // Protects the above variables
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_API_VIDEOTRACKRENDERERS_H_

Powered by Google App Engine
This is Rietveld 408576698