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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 public NotifierInterface { | 80 public NotifierInterface { |
81 public: | 81 public: |
82 enum TrackState { | 82 enum TrackState { |
83 kLive, | 83 kLive, |
84 kEnded, | 84 kEnded, |
85 }; | 85 }; |
86 | 86 |
87 static const char kAudioKind[]; | 87 static const char kAudioKind[]; |
88 static const char kVideoKind[]; | 88 static const char kVideoKind[]; |
89 | 89 |
| 90 // The kind() method must return kAudioKind only if the object is a |
| 91 // subclass of AudioTrackInterface, and kVideoKind only if the |
| 92 // object is a subclass of VideoTrackInterface. It is typically used |
| 93 // to protect a static_cast<> to the corresponding subclass. |
90 virtual std::string kind() const = 0; | 94 virtual std::string kind() const = 0; |
91 virtual std::string id() const = 0; | 95 virtual std::string id() const = 0; |
92 virtual bool enabled() const = 0; | 96 virtual bool enabled() const = 0; |
93 virtual TrackState state() const = 0; | 97 virtual TrackState state() const = 0; |
94 virtual bool set_enabled(bool enable) = 0; | 98 virtual bool set_enabled(bool enable) = 0; |
95 // TODO(perkj): Remove when Chrome tests doesn't rely on this method. | 99 // TODO(perkj): Remove when Chrome tests doesn't rely on this method. |
96 virtual bool set_state(TrackState state) { return true;} | 100 virtual bool set_state(TrackState state) { return true;} |
97 | 101 |
98 protected: | 102 protected: |
99 virtual ~MediaStreamTrackInterface() {} | 103 virtual ~MediaStreamTrackInterface() {} |
100 }; | 104 }; |
101 | 105 |
102 // VideoTrackSourceInterface is a reference counted source used for VideoTracks. | 106 // VideoTrackSourceInterface is a reference counted source used for VideoTracks. |
103 // The same source can be used in multiple VideoTracks. | 107 // The same source can be used in multiple VideoTracks. |
104 class VideoTrackSourceInterface | 108 class VideoTrackSourceInterface |
105 : public MediaSourceInterface, | 109 : public MediaSourceInterface, |
106 public rtc::VideoSourceInterface<cricket::VideoFrame> { | 110 public rtc::VideoSourceInterface<cricket::VideoFrame> { |
107 public: | 111 public: |
| 112 struct Stats { |
| 113 // Original size of captured frame, before video adaptation. |
| 114 int input_width; |
| 115 int input_height; |
| 116 }; |
108 // Get access to the source implementation of cricket::VideoCapturer. | 117 // Get access to the source implementation of cricket::VideoCapturer. |
109 // This can be used for receiving frames and state notifications. | 118 // This can be used for receiving frames and state notifications. |
110 // But it should not be used for starting or stopping capturing. | 119 // But it should not be used for starting or stopping capturing. |
111 // TODO(perkj): We are currently trying to replace all internal use of | 120 // TODO(perkj): We are currently trying to replace all internal use of |
112 // cricket::VideoCapturer with rtc::VideoSourceInterface. Once that | 121 // cricket::VideoCapturer with rtc::VideoSourceInterface. Once that |
113 // refactoring is done, | 122 // refactoring is done, |
114 // remove this method. | 123 // remove this method. |
115 virtual cricket::VideoCapturer* GetVideoCapturer() = 0; | 124 virtual cricket::VideoCapturer* GetVideoCapturer() = 0; |
116 | 125 |
117 virtual void Stop() = 0; | 126 virtual void Stop() = 0; |
118 virtual void Restart() = 0; | 127 virtual void Restart() = 0; |
119 | 128 |
120 // Indicates that parameters suitable for screencasts should be automatically | 129 // Indicates that parameters suitable for screencasts should be automatically |
121 // applied to RtpSenders. | 130 // applied to RtpSenders. |
122 // TODO(perkj): Remove these once all known applications have moved to | 131 // TODO(perkj): Remove these once all known applications have moved to |
123 // explicitly setting suitable parameters for screencasts and dont' need this | 132 // explicitly setting suitable parameters for screencasts and dont' need this |
124 // implicit behavior. | 133 // implicit behavior. |
125 virtual bool is_screencast() const = 0; | 134 virtual bool is_screencast() const = 0; |
126 | 135 |
127 // Indicates that the encoder should denoise the video before encoding it. | 136 // Indicates that the encoder should denoise the video before encoding it. |
128 // TODO(perkj): Remove this once denoising is done by the source, and not by | 137 // TODO(perkj): Remove this once denoising is done by the source, and not by |
129 // the encoder. | 138 // the encoder. |
130 virtual bool needs_denoising() const = 0; | 139 virtual bool needs_denoising() const = 0; |
131 | 140 |
| 141 // Returns false if no stats are available, e.g, for a remote |
| 142 // source, or a source which has not seen its first frame yet. |
| 143 virtual bool GetStats(Stats* stats) = 0; |
| 144 |
132 protected: | 145 protected: |
133 virtual ~VideoTrackSourceInterface() {} | 146 virtual ~VideoTrackSourceInterface() {} |
134 }; | 147 }; |
135 | 148 |
136 class VideoTrackInterface | 149 class VideoTrackInterface |
137 : public MediaStreamTrackInterface, | 150 : public MediaStreamTrackInterface, |
138 public rtc::VideoSourceInterface<cricket::VideoFrame> { | 151 public rtc::VideoSourceInterface<cricket::VideoFrame> { |
139 public: | 152 public: |
140 // Register a video sink for this track. | 153 // Register a video sink for this track. |
141 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 154 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; | 278 virtual bool RemoveTrack(AudioTrackInterface* track) = 0; |
266 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; | 279 virtual bool RemoveTrack(VideoTrackInterface* track) = 0; |
267 | 280 |
268 protected: | 281 protected: |
269 virtual ~MediaStreamInterface() {} | 282 virtual ~MediaStreamInterface() {} |
270 }; | 283 }; |
271 | 284 |
272 } // namespace webrtc | 285 } // namespace webrtc |
273 | 286 |
274 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ | 287 #endif // WEBRTC_API_MEDIASTREAMINTERFACE_H_ |
OLD | NEW |