OLD | NEW |
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 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 // Live or ended. A track will never be live again after becoming ended. | 99 // Live or ended. A track will never be live again after becoming ended. |
100 virtual TrackState state() const = 0; | 100 virtual TrackState state() const = 0; |
101 | 101 |
102 protected: | 102 protected: |
103 virtual ~MediaStreamTrackInterface() {} | 103 virtual ~MediaStreamTrackInterface() {} |
104 }; | 104 }; |
105 | 105 |
106 // VideoTrackSourceInterface is a reference counted source used for | 106 // VideoTrackSourceInterface is a reference counted source used for |
107 // VideoTracks. The same source can be used by multiple VideoTracks. | 107 // VideoTracks. The same source can be used by multiple VideoTracks. |
108 // VideoTrackSourceInterface is designed to be invoked on the signaling thread | |
109 // except for rtc::VideoSourceInterface<VideoFrame> methods that will be invoked | |
110 // on the worker thread via a VideoTrack. A custom implementation of a source | |
111 // can inherit AdaptedVideoTrackSource instead of directly implementing this | |
112 // interface. | |
113 class VideoTrackSourceInterface | 108 class VideoTrackSourceInterface |
114 : public MediaSourceInterface, | 109 : public MediaSourceInterface, |
115 public rtc::VideoSourceInterface<VideoFrame> { | 110 public rtc::VideoSourceInterface<VideoFrame> { |
116 public: | 111 public: |
117 struct Stats { | 112 struct Stats { |
118 // Original size of captured frame, before video adaptation. | 113 // Original size of captured frame, before video adaptation. |
119 int input_width; | 114 int input_width; |
120 int input_height; | 115 int input_height; |
121 }; | 116 }; |
122 | 117 |
(...skipping 14 matching lines...) Expand all Loading... |
137 // Returns false if no stats are available, e.g, for a remote source, or a | 132 // Returns false if no stats are available, e.g, for a remote source, or a |
138 // source which has not seen its first frame yet. | 133 // source which has not seen its first frame yet. |
139 // | 134 // |
140 // Implementation should avoid blocking. | 135 // Implementation should avoid blocking. |
141 virtual bool GetStats(Stats* stats) = 0; | 136 virtual bool GetStats(Stats* stats) = 0; |
142 | 137 |
143 protected: | 138 protected: |
144 virtual ~VideoTrackSourceInterface() {} | 139 virtual ~VideoTrackSourceInterface() {} |
145 }; | 140 }; |
146 | 141 |
147 // VideoTrackInterface is designed to be invoked on the signaling thread except | |
148 // for rtc::VideoSourceInterface<VideoFrame> methods that must be invoked | |
149 // on the worker thread. | |
150 // PeerConnectionFactory::CreateVideoTrack can be used for creating a VideoTrack | |
151 // that ensures thread safety and that all methods are called on the right | |
152 // thread. | |
153 class VideoTrackInterface | 142 class VideoTrackInterface |
154 : public MediaStreamTrackInterface, | 143 : public MediaStreamTrackInterface, |
155 public rtc::VideoSourceInterface<VideoFrame> { | 144 public rtc::VideoSourceInterface<VideoFrame> { |
156 public: | 145 public: |
157 // Video track content hint, used to override the source is_screencast | 146 // Video track content hint, used to override the source is_screencast |
158 // property. | 147 // property. |
159 // See https://crbug.com/653531 and https://github.com/WICG/mst-content-hint. | 148 // See https://crbug.com/653531 and https://github.com/WICG/mst-content-hint. |
160 enum class ContentHint { kNone, kFluid, kDetailed }; | 149 enum class ContentHint { kNone, kFluid, kDetailed }; |
161 | 150 |
| 151 // Register a video sink for this track. Used to connect the track to the |
| 152 // underlying video engine. |
| 153 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 154 const rtc::VideoSinkWants& wants) override {} |
| 155 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override {} |
| 156 |
162 virtual VideoTrackSourceInterface* GetSource() const = 0; | 157 virtual VideoTrackSourceInterface* GetSource() const = 0; |
163 | 158 |
164 virtual ContentHint content_hint() const { return ContentHint::kNone; } | 159 virtual ContentHint content_hint() const { return ContentHint::kNone; } |
165 virtual void set_content_hint(ContentHint hint) {} | 160 virtual void set_content_hint(ContentHint hint) {} |
166 | 161 |
167 protected: | 162 protected: |
168 virtual ~VideoTrackInterface() {} | 163 virtual ~VideoTrackInterface() {} |
169 }; | 164 }; |
170 | 165 |
171 // Interface for receiving audio data from a AudioTrack. | 166 // Interface for receiving audio data from a AudioTrack. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; | 297 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; |
303 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; | 298 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; |
304 | 299 |
305 protected: | 300 protected: |
306 virtual ~MediaStreamInterface() {} | 301 virtual ~MediaStreamInterface() {} |
307 }; | 302 }; |
308 | 303 |
309 } // namespace webrtc | 304 } // namespace webrtc |
310 | 305 |
311 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ | 306 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ |
OLD | NEW |