| 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 <utility> | 16 #include <utility> |
| 17 #include <vector> | 17 #include <vector> |
| 18 #include <utility> | 18 #include <utility> |
| 19 | 19 |
| 20 #include "webrtc/base/platform_file.h" | 20 #include "webrtc/base/platform_file.h" |
| 21 #include "webrtc/common_types.h" | 21 #include "webrtc/common_types.h" |
| 22 #include "webrtc/common_video/include/frame_callback.h" | 22 #include "webrtc/common_video/include/frame_callback.h" |
| 23 #include "webrtc/config.h" | 23 #include "webrtc/config.h" |
| 24 #include "webrtc/media/base/videosinkinterface.h" | 24 #include "webrtc/media/base/videosinkinterface.h" |
| 25 #include "webrtc/media/base/videosourceinterface.h" | 25 #include "webrtc/media/base/videosourceinterface.h" |
| 26 #include "webrtc/transport.h" | 26 #include "webrtc/transport.h" |
| 27 | 27 |
| 28 namespace webrtc { | 28 namespace webrtc { |
| 29 | 29 |
| 30 class LoadObserver; | |
| 31 class VideoEncoder; | 30 class VideoEncoder; |
| 32 | 31 |
| 33 class VideoSendStream { | 32 class VideoSendStream { |
| 34 public: | 33 public: |
| 35 struct StreamStats { | 34 struct StreamStats { |
| 36 std::string ToString() const; | 35 std::string ToString() const; |
| 37 | 36 |
| 38 FrameCounts frame_counts; | 37 FrameCounts frame_counts; |
| 39 bool is_rtx = false; | 38 bool is_rtx = false; |
| 40 int width = 0; | 39 int width = 0; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 59 // Bitrate the encoder is currently configured to use due to bandwidth | 58 // Bitrate the encoder is currently configured to use due to bandwidth |
| 60 // limitations. | 59 // limitations. |
| 61 int target_media_bitrate_bps = 0; | 60 int target_media_bitrate_bps = 0; |
| 62 // Bitrate the encoder is actually producing. | 61 // Bitrate the encoder is actually producing. |
| 63 int media_bitrate_bps = 0; | 62 int media_bitrate_bps = 0; |
| 64 // Media bitrate this VideoSendStream is configured to prefer if there are | 63 // Media bitrate this VideoSendStream is configured to prefer if there are |
| 65 // no bandwidth limitations. | 64 // no bandwidth limitations. |
| 66 int preferred_media_bitrate_bps = 0; | 65 int preferred_media_bitrate_bps = 0; |
| 67 bool suspended = false; | 66 bool suspended = false; |
| 68 bool bw_limited_resolution = false; | 67 bool bw_limited_resolution = false; |
| 68 bool cpu_limited_resolution = false; |
| 69 // Total number of times resolution as been requested to be changed due to |
| 70 // CPU adaptation. |
| 71 int number_of_cpu_adapt_changes = 0; |
| 69 std::map<uint32_t, StreamStats> substreams; | 72 std::map<uint32_t, StreamStats> substreams; |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 struct Config { | 75 struct Config { |
| 73 public: | 76 public: |
| 74 Config() = delete; | 77 Config() = delete; |
| 75 Config(Config&&) = default; | 78 Config(Config&&) = default; |
| 76 explicit Config(Transport* send_transport) | 79 explicit Config(Transport* send_transport) |
| 77 : send_transport(send_transport) {} | 80 : send_transport(send_transport) {} |
| 78 | 81 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 int payload_type = -1; | 146 int payload_type = -1; |
| 144 } rtx; | 147 } rtx; |
| 145 | 148 |
| 146 // RTCP CNAME, see RFC 3550. | 149 // RTCP CNAME, see RFC 3550. |
| 147 std::string c_name; | 150 std::string c_name; |
| 148 } rtp; | 151 } rtp; |
| 149 | 152 |
| 150 // Transport for outgoing packets. | 153 // Transport for outgoing packets. |
| 151 Transport* send_transport = nullptr; | 154 Transport* send_transport = nullptr; |
| 152 | 155 |
| 153 // Callback for overuse and normal usage based on the jitter of incoming | |
| 154 // captured frames. 'nullptr' disables the callback. | |
| 155 LoadObserver* overuse_callback = nullptr; | |
| 156 | |
| 157 // Called for each I420 frame before encoding the frame. Can be used for | 156 // Called for each I420 frame before encoding the frame. Can be used for |
| 158 // effects, snapshots etc. 'nullptr' disables the callback. | 157 // effects, snapshots etc. 'nullptr' disables the callback. |
| 159 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback = nullptr; | 158 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback = nullptr; |
| 160 | 159 |
| 161 // Called for each encoded frame, e.g. used for file storage. 'nullptr' | 160 // Called for each encoded frame, e.g. used for file storage. 'nullptr' |
| 162 // disables the callback. Also measures timing and passes the time | 161 // disables the callback. Also measures timing and passes the time |
| 163 // spent on encoding. This timing will not fire if encoding takes longer | 162 // spent on encoding. This timing will not fire if encoding takes longer |
| 164 // than the measuring window, since the sample data will have been dropped. | 163 // than the measuring window, since the sample data will have been dropped. |
| 165 EncodedFrameObserver* post_encode_callback = nullptr; | 164 EncodedFrameObserver* post_encode_callback = nullptr; |
| 166 | 165 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 184 Config(const Config&) = default; | 183 Config(const Config&) = default; |
| 185 }; | 184 }; |
| 186 | 185 |
| 187 // Starts stream activity. | 186 // Starts stream activity. |
| 188 // When a stream is active, it can receive, process and deliver packets. | 187 // When a stream is active, it can receive, process and deliver packets. |
| 189 virtual void Start() = 0; | 188 virtual void Start() = 0; |
| 190 // Stops stream activity. | 189 // Stops stream activity. |
| 191 // When a stream is stopped, it can't receive, process or deliver packets. | 190 // When a stream is stopped, it can't receive, process or deliver packets. |
| 192 virtual void Stop() = 0; | 191 virtual void Stop() = 0; |
| 193 | 192 |
| 194 virtual void SetSource( | 193 virtual void SetSource(rtc::VideoSourceInterface<webrtc::VideoFrame>* source, |
| 195 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) = 0; | 194 bool disable_resolution_scaling) = 0; |
| 196 | 195 |
| 197 // Set which streams to send. Must have at least as many SSRCs as configured | 196 // Set which streams to send. Must have at least as many SSRCs as configured |
| 198 // in the config. Encoder settings are passed on to the encoder instance along | 197 // in the config. Encoder settings are passed on to the encoder instance along |
| 199 // with the VideoStream settings. | 198 // with the VideoStream settings. |
| 200 virtual void ReconfigureVideoEncoder(VideoEncoderConfig config) = 0; | 199 virtual void ReconfigureVideoEncoder(VideoEncoderConfig config) = 0; |
| 201 | 200 |
| 202 virtual Stats GetStats() = 0; | 201 virtual Stats GetStats() = 0; |
| 203 | 202 |
| 204 // Takes ownership of each file, is responsible for closing them later. | 203 // Takes ownership of each file, is responsible for closing them later. |
| 205 // Calling this method will close and finalize any current logs. | 204 // Calling this method will close and finalize any current logs. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 217 EnableEncodedFrameRecording(std::vector<rtc::PlatformFile>(), 0); | 216 EnableEncodedFrameRecording(std::vector<rtc::PlatformFile>(), 0); |
| 218 } | 217 } |
| 219 | 218 |
| 220 protected: | 219 protected: |
| 221 virtual ~VideoSendStream() {} | 220 virtual ~VideoSendStream() {} |
| 222 }; | 221 }; |
| 223 | 222 |
| 224 } // namespace webrtc | 223 } // namespace webrtc |
| 225 | 224 |
| 226 #endif // WEBRTC_VIDEO_SEND_STREAM_H_ | 225 #endif // WEBRTC_VIDEO_SEND_STREAM_H_ |
| OLD | NEW |