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