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

Side by Side Diff: webrtc/api/videotrackrenderers.h

Issue 1779063003: Refactor VideoTracks to forward all sinks to its source (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « webrtc/api/videotrack_unittest.cc ('k') | webrtc/api/videotrackrenderers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_API_VIDEOTRACKRENDERERS_H_ 11 #ifndef WEBRTC_API_VIDEOTRACKRENDERERS_H_
12 #define WEBRTC_API_VIDEOTRACKRENDERERS_H_ 12 #define WEBRTC_API_VIDEOTRACKRENDERERS_H_
13 13
14 #include <set> 14 // TODO(perkj): Remove this file once Chrome builds doesnt depend on it.
15
16 #include "webrtc/api/mediastreaminterface.h"
17 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/media/base/videorenderer.h"
20
21 namespace webrtc {
22
23 // Class used for rendering cricket::VideoFrames to multiple renderers of type
24 // VideoRendererInterface.
25 // Each VideoTrack owns a VideoTrackRenderers instance.
26 // The class is thread safe. Rendering to the added VideoRendererInterfaces is
27 // done on the same thread as the cricket::VideoRenderer.
28 class VideoTrackRenderers
29 : public cricket::VideoRenderer,
30 public rtc::VideoSourceInterface<cricket::VideoFrame> {
31 public:
32 VideoTrackRenderers();
33 ~VideoTrackRenderers();
34
35 // Implements cricket::VideoRenderer. If the track is disabled,
36 // incoming frames are replaced by black frames.
37 virtual bool RenderFrame(const cricket::VideoFrame* frame);
38
39 void AddOrUpdateSink(VideoSinkInterface<cricket::VideoFrame>* sink,
40 const rtc::VideoSinkWants& wants) override;
41 void RemoveSink(VideoSinkInterface<cricket::VideoFrame>* sink) override;
42 void SetEnabled(bool enable);
43
44 private:
45 // Pass the frame on to to each registered renderer. Requires
46 // critical_section_ already locked.
47 void RenderFrameToSinks(const cricket::VideoFrame& frame);
48
49 bool enabled_;
50 std::vector<VideoSinkInterface<cricket::VideoFrame>*> sinks_;
51 rtc::CriticalSection critical_section_; // Protects the above variables
52 };
53
54 } // namespace webrtc
55 15
56 #endif // WEBRTC_API_VIDEOTRACKRENDERERS_H_ 16 #endif // WEBRTC_API_VIDEOTRACKRENDERERS_H_
OLDNEW
« no previous file with comments | « webrtc/api/videotrack_unittest.cc ('k') | webrtc/api/videotrackrenderers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698