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

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

Issue 1684423002: Make VideoTrack and VideoTrackRenderers implement rtc::VideoSourceInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/api/mediastreamtrackproxy.h » ('j') | webrtc/api/mediastreamtrackproxy.h » ('J')
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 // This file contains interfaces for MediaStream, MediaTrack and MediaSource. 11 // This file contains interfaces for MediaStream, MediaTrack and MediaSource.
12 // These interfaces are used for implementing MediaStream and MediaTrack as 12 // These interfaces are used for implementing MediaStream and MediaTrack as
13 // defined in http://dev.w3.org/2011/webrtc/editor/webrtc.html#stream-api. These 13 // defined in http://dev.w3.org/2011/webrtc/editor/webrtc.html#stream-api. These
14 // interfaces must be used only with PeerConnection. PeerConnectionManager 14 // interfaces must be used only with PeerConnection. PeerConnectionManager
15 // interface provides the factory methods to create MediaStream and MediaTracks. 15 // interface provides the factory methods to create MediaStream and MediaTracks.
16 16
17 #ifndef WEBRTC_API_MEDIASTREAMINTERFACE_H_ 17 #ifndef WEBRTC_API_MEDIASTREAMINTERFACE_H_
18 #define WEBRTC_API_MEDIASTREAMINTERFACE_H_ 18 #define WEBRTC_API_MEDIASTREAMINTERFACE_H_
19 19
20 #include <string> 20 #include <string>
21 #include <vector> 21 #include <vector>
22 22
23 #include "webrtc/base/basictypes.h" 23 #include "webrtc/base/basictypes.h"
24 #include "webrtc/base/refcount.h" 24 #include "webrtc/base/refcount.h"
25 #include "webrtc/base/scoped_ref_ptr.h" 25 #include "webrtc/base/scoped_ref_ptr.h"
26 #include "webrtc/media/base/videosinkinterface.h" 26 #include "webrtc/media/base/videosinkinterface.h"
27 #include "webrtc/media/base/videosourceinterface.h"
27 28
28 namespace cricket { 29 namespace cricket {
29 30
30 class AudioRenderer; 31 class AudioRenderer;
31 class VideoCapturer; 32 class VideoCapturer;
32 class VideoRenderer; 33 class VideoRenderer;
33 class VideoFrame; 34 class VideoFrame;
34 35
35 } // namespace cricket 36 } // namespace cricket
36 37
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 115
115 protected: 116 protected:
116 // The destructor is protected to prevent deletion via the interface. 117 // The destructor is protected to prevent deletion via the interface.
117 // This is so that we allow reference counted classes, where the destructor 118 // This is so that we allow reference counted classes, where the destructor
118 // should never be public, to implement the interface. 119 // should never be public, to implement the interface.
119 virtual ~VideoRendererInterface() {} 120 virtual ~VideoRendererInterface() {}
120 }; 121 };
121 122
122 class VideoSourceInterface; 123 class VideoSourceInterface;
123 124
124 class VideoTrackInterface : public MediaStreamTrackInterface { 125 class VideoTrackInterface
126 : public MediaStreamTrackInterface,
127 public rtc::VideoSourceInterface<cricket::VideoFrame> {
125 public: 128 public:
129 // Backwards compatibility functions
126 // Register a renderer that will render all frames received on this track. 130 // Register a renderer that will render all frames received on this track.
127 virtual void AddRenderer(VideoRendererInterface* renderer) = 0; 131 virtual void AddRenderer(VideoRendererInterface* renderer) {
perkj_webrtc 2016/02/11 15:30:43 Comment that these are deprecated and the new meth
nisse-webrtc 2016/02/12 08:36:03 Done.
132 AddOrUpdateSink(renderer, rtc::VideoSinkWants());
133 }
128 // Deregister a renderer. 134 // Deregister a renderer.
129 virtual void RemoveRenderer(VideoRendererInterface* renderer) = 0; 135 virtual void RemoveRenderer(VideoRendererInterface* renderer) {
136 RemoveSink(renderer);
137 }
130 138
131 virtual VideoSourceInterface* GetSource() const = 0; 139 virtual webrtc::VideoSourceInterface* GetSource() const = 0;
132 140
133 // Return the track input sink. I.e., frames sent to this sink are 141 // Return the track input sink. I.e., frames sent to this sink are
134 // propagated to all renderers registered with the track. The 142 // propagated to all renderers registered with the track. The
135 // returned sink must not change between calls. Currently, this 143 // returned sink must not change between calls. Currently, this
136 // method is used for remote tracks (VideoRtpReceiver); further 144 // method is used for remote tracks (VideoRtpReceiver); further
137 // refactoring is planned for this path, it's unclear if this method 145 // refactoring is planned for this path, it's unclear if this method
138 // belongs here long term. 146 // belongs here long term.
139 147
140 // We do this instead of simply implementing the 148 // We do this instead of simply implementing the
141 // VideoSourceInterface directly, because if we did the latter, we'd 149 // VideoSourceInterface directly, because if we did the latter, we'd
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; 278 virtual bool RemoveTrack(AudioTrackInterface* track) = 0;
271 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; 279 virtual bool RemoveTrack(VideoTrackInterface* track) = 0;
272 280
273 protected: 281 protected:
274 virtual ~MediaStreamInterface() {} 282 virtual ~MediaStreamInterface() {}
275 }; 283 };
276 284
277 } // namespace webrtc 285 } // namespace webrtc
278 286
279 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ 287 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/mediastreamtrackproxy.h » ('j') | webrtc/api/mediastreamtrackproxy.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698