OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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_VIDEO_SEND_STREAM_H_ | 11 #ifndef WEBRTC_VIDEO_SEND_STREAM_H_ |
12 #define WEBRTC_VIDEO_SEND_STREAM_H_ | 12 #define WEBRTC_VIDEO_SEND_STREAM_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
19 #include "webrtc/common_video/include/frame_callback.h" | 19 #include "webrtc/common_video/include/frame_callback.h" |
20 #include "webrtc/config.h" | 20 #include "webrtc/config.h" |
21 #include "webrtc/media/base/videosinkinterface.h" | 21 #include "webrtc/media/base/videosinkinterface.h" |
22 #include "webrtc/media/base/videosourceinterface.h" | |
23 #include "webrtc/transport.h" | 22 #include "webrtc/transport.h" |
24 | 23 |
25 namespace webrtc { | 24 namespace webrtc { |
26 | 25 |
27 class LoadObserver; | 26 class LoadObserver; |
28 class VideoEncoder; | 27 class VideoEncoder; |
29 | 28 |
| 29 // Class to deliver captured frame to the video send stream. |
| 30 class VideoCaptureInput { |
| 31 public: |
| 32 // These methods do not lock internally and must be called sequentially. |
| 33 // If your application switches input sources synchronization must be done |
| 34 // externally to make sure that any old frames are not delivered concurrently. |
| 35 virtual void IncomingCapturedFrame(const VideoFrame& video_frame) = 0; |
| 36 |
| 37 protected: |
| 38 virtual ~VideoCaptureInput() {} |
| 39 }; |
| 40 |
30 class VideoSendStream { | 41 class VideoSendStream { |
31 public: | 42 public: |
32 struct StreamStats { | 43 struct StreamStats { |
33 std::string ToString() const; | 44 std::string ToString() const; |
34 | 45 |
35 FrameCounts frame_counts; | 46 FrameCounts frame_counts; |
36 bool is_rtx = false; | 47 bool is_rtx = false; |
37 int width = 0; | 48 int width = 0; |
38 int height = 0; | 49 int height = 0; |
39 // TODO(holmer): Move bitrate_bps out to the webrtc::Call layer. | 50 // TODO(holmer): Move bitrate_bps out to the webrtc::Call layer. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 Config(const Config&) = default; | 186 Config(const Config&) = default; |
176 }; | 187 }; |
177 | 188 |
178 // Starts stream activity. | 189 // Starts stream activity. |
179 // When a stream is active, it can receive, process and deliver packets. | 190 // When a stream is active, it can receive, process and deliver packets. |
180 virtual void Start() = 0; | 191 virtual void Start() = 0; |
181 // Stops stream activity. | 192 // Stops stream activity. |
182 // When a stream is stopped, it can't receive, process or deliver packets. | 193 // When a stream is stopped, it can't receive, process or deliver packets. |
183 virtual void Stop() = 0; | 194 virtual void Stop() = 0; |
184 | 195 |
185 virtual void SetSource( | 196 // Gets interface used to insert captured frames. Valid as long as the |
186 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) = 0; | 197 // VideoSendStream is valid. |
| 198 virtual VideoCaptureInput* Input() = 0; |
187 | 199 |
188 // Set which streams to send. Must have at least as many SSRCs as configured | 200 // Set which streams to send. Must have at least as many SSRCs as configured |
189 // in the config. Encoder settings are passed on to the encoder instance along | 201 // in the config. Encoder settings are passed on to the encoder instance along |
190 // with the VideoStream settings. | 202 // with the VideoStream settings. |
191 virtual void ReconfigureVideoEncoder(VideoEncoderConfig config) = 0; | 203 virtual void ReconfigureVideoEncoder(VideoEncoderConfig config) = 0; |
192 | 204 |
193 virtual Stats GetStats() = 0; | 205 virtual Stats GetStats() = 0; |
194 | 206 |
195 protected: | 207 protected: |
196 virtual ~VideoSendStream() {} | 208 virtual ~VideoSendStream() {} |
197 }; | 209 }; |
198 | 210 |
199 } // namespace webrtc | 211 } // namespace webrtc |
200 | 212 |
201 #endif // WEBRTC_VIDEO_SEND_STREAM_H_ | 213 #endif // WEBRTC_VIDEO_SEND_STREAM_H_ |
OLD | NEW |