Chromium Code Reviews| 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 | 17 |
| 17 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
| 18 #include "webrtc/common_video/include/frame_callback.h" | 19 #include "webrtc/common_video/include/frame_callback.h" |
| 19 #include "webrtc/config.h" | 20 #include "webrtc/config.h" |
| 20 #include "webrtc/media/base/videosinkinterface.h" | 21 #include "webrtc/media/base/videosinkinterface.h" |
| 21 #include "webrtc/transport.h" | 22 #include "webrtc/transport.h" |
| 22 #include "webrtc/media/base/videosinkinterface.h" | |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 | 25 |
| 26 class LoadObserver; | 26 class LoadObserver; |
| 27 class VideoEncoder; | 27 class VideoEncoder; |
| 28 | 28 |
| 29 // Class to deliver captured frame to the video send stream. | 29 // Class to deliver captured frame to the video send stream. |
| 30 class VideoCaptureInput { | 30 class VideoCaptureInput { |
| 31 public: | 31 public: |
| 32 // These methods do not lock internally and must be called sequentially. | 32 // These methods do not lock internally and must be called sequentially. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 61 int avg_encode_time_ms = 0; | 61 int avg_encode_time_ms = 0; |
| 62 int encode_usage_percent = 0; | 62 int encode_usage_percent = 0; |
| 63 int target_media_bitrate_bps = 0; | 63 int target_media_bitrate_bps = 0; |
| 64 int media_bitrate_bps = 0; | 64 int media_bitrate_bps = 0; |
| 65 bool suspended = false; | 65 bool suspended = false; |
| 66 bool bw_limited_resolution = false; | 66 bool bw_limited_resolution = false; |
| 67 std::map<uint32_t, StreamStats> substreams; | 67 std::map<uint32_t, StreamStats> substreams; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 struct Config { | 70 struct Config { |
| 71 private: | |
| 72 // Access to the copy constructor is private to force use of the Copy() | |
| 73 // method for those exceptional cases where we do use it. | |
| 74 Config(const Config&) = default; | |
|
stefan-webrtc
2016/07/08 15:56:43
Perhaps put this last?
perkj_webrtc
2016/07/11 11:41:08
This currently match with what has been done for V
| |
| 75 | |
| 76 public: | |
| 71 Config() = delete; | 77 Config() = delete; |
| 78 Config(Config&&) = default; | |
| 72 explicit Config(Transport* send_transport) | 79 explicit Config(Transport* send_transport) |
| 73 : send_transport(send_transport) {} | 80 : send_transport(send_transport) {} |
| 74 | 81 |
| 82 Config& operator=(Config&&) = default; | |
| 83 Config& operator=(const Config&) = delete; | |
| 84 | |
| 85 // Mostly used by tests. Avoid creating copies if you can. | |
| 86 Config Copy() const { return Config(*this); } | |
| 87 | |
| 75 std::string ToString() const; | 88 std::string ToString() const; |
| 76 | 89 |
| 77 struct EncoderSettings { | 90 struct EncoderSettings { |
| 78 std::string ToString() const; | 91 std::string ToString() const; |
| 79 | 92 |
| 80 std::string payload_name; | 93 std::string payload_name; |
| 81 int payload_type = -1; | 94 int payload_type = 0; |
|
stefan-webrtc
2016/07/08 15:56:43
Why was this changed?
perkj_webrtc
2016/07/11 11:41:08
good question...
VieKeyRequestTest.CreateAndTrigg
| |
| 82 | 95 |
| 83 // TODO(sophiechang): Delete this field when no one is using internal | 96 // TODO(sophiechang): Delete this field when no one is using internal |
| 84 // sources anymore. | 97 // sources anymore. |
| 85 bool internal_source = false; | 98 bool internal_source = false; |
| 86 | 99 |
| 87 // Allow 100% encoder utilization. Used for HW encoders where CPU isn't | 100 // Allow 100% encoder utilization. Used for HW encoders where CPU isn't |
| 88 // expected to be the limiting factor, but a chip could be running at | 101 // expected to be the limiting factor, but a chip could be running at |
| 89 // 30fps (for example) exactly. | 102 // 30fps (for example) exactly. |
| 90 bool full_overuse_time = false; | 103 bool full_overuse_time = false; |
| 91 | 104 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 // Called for each I420 frame before encoding the frame. Can be used for | 153 // Called for each I420 frame before encoding the frame. Can be used for |
| 141 // effects, snapshots etc. 'nullptr' disables the callback. | 154 // effects, snapshots etc. 'nullptr' disables the callback. |
| 142 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback = nullptr; | 155 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback = nullptr; |
| 143 | 156 |
| 144 // Called for each encoded frame, e.g. used for file storage. 'nullptr' | 157 // Called for each encoded frame, e.g. used for file storage. 'nullptr' |
| 145 // disables the callback. Also measures timing and passes the time | 158 // disables the callback. Also measures timing and passes the time |
| 146 // spent on encoding. This timing will not fire if encoding takes longer | 159 // spent on encoding. This timing will not fire if encoding takes longer |
| 147 // than the measuring window, since the sample data will have been dropped. | 160 // than the measuring window, since the sample data will have been dropped. |
| 148 EncodedFrameObserver* post_encode_callback = nullptr; | 161 EncodedFrameObserver* post_encode_callback = nullptr; |
| 149 | 162 |
| 150 // Renderer for local preview. The local renderer will be called even if | |
| 151 // sending hasn't started. 'nullptr' disables local rendering. | |
| 152 rtc::VideoSinkInterface<VideoFrame>* local_renderer = nullptr; | |
|
stefan-webrtc
2016/07/08 15:56:43
Wouldn't it make sense to do this separately?
perkj_webrtc
2016/07/11 11:41:08
This is part of moving the input directly to ViEEn
| |
| 153 | |
| 154 // Expected delay needed by the renderer, i.e. the frame will be delivered | 163 // Expected delay needed by the renderer, i.e. the frame will be delivered |
| 155 // this many milliseconds, if possible, earlier than expected render time. | 164 // this many milliseconds, if possible, earlier than expected render time. |
| 156 // Only valid if |local_renderer| is set. | 165 // Only valid if |local_renderer| is set. |
| 157 int render_delay_ms = 0; | 166 int render_delay_ms = 0; |
| 158 | 167 |
| 159 // Target delay in milliseconds. A positive value indicates this stream is | 168 // Target delay in milliseconds. A positive value indicates this stream is |
| 160 // used for streaming instead of a real-time call. | 169 // used for streaming instead of a real-time call. |
| 161 int target_delay_ms = 0; | 170 int target_delay_ms = 0; |
| 162 | 171 |
| 163 // True if the stream should be suspended when the available bitrate fall | 172 // True if the stream should be suspended when the available bitrate fall |
| 164 // below the minimum configured bitrate. If this variable is false, the | 173 // below the minimum configured bitrate. If this variable is false, the |
| 165 // stream may send at a rate higher than the estimated available bitrate. | 174 // stream may send at a rate higher than the estimated available bitrate. |
| 166 bool suspend_below_min_bitrate = false; | 175 bool suspend_below_min_bitrate = false; |
| 167 }; | 176 }; |
| 168 | 177 |
| 169 // Starts stream activity. | 178 // Starts stream activity. |
| 170 // When a stream is active, it can receive, process and deliver packets. | 179 // When a stream is active, it can receive, process and deliver packets. |
| 171 virtual void Start() = 0; | 180 virtual void Start() = 0; |
| 172 // Stops stream activity. | 181 // Stops stream activity. |
| 173 // When a stream is stopped, it can't receive, process or deliver packets. | 182 // When a stream is stopped, it can't receive, process or deliver packets. |
| 174 virtual void Stop() = 0; | 183 virtual void Stop() = 0; |
| 175 | 184 |
| 176 // Gets interface used to insert captured frames. Valid as long as the | 185 // Gets interface used to insert captured frames. Valid as long as the |
| 177 // VideoSendStream is valid. | 186 // VideoSendStream is valid. |
| 178 virtual VideoCaptureInput* Input() = 0; | 187 virtual VideoCaptureInput* Input() = 0; |
| 179 | 188 |
| 180 // Set which streams to send. Must have at least as many SSRCs as configured | 189 // Set which streams to send. Must have at least as many SSRCs as configured |
| 181 // in the config. Encoder settings are passed on to the encoder instance along | 190 // in the config. Encoder settings are passed on to the encoder instance along |
| 182 // with the VideoStream settings. | 191 // with the VideoStream settings. |
| 183 virtual void ReconfigureVideoEncoder(const VideoEncoderConfig& config) = 0; | 192 virtual void ReconfigureVideoEncoder(VideoEncoderConfig config) = 0; |
| 184 | 193 |
| 185 virtual Stats GetStats() = 0; | 194 virtual Stats GetStats() = 0; |
| 186 | 195 |
| 187 protected: | 196 protected: |
| 188 virtual ~VideoSendStream() {} | 197 virtual ~VideoSendStream() {} |
| 189 }; | 198 }; |
| 190 | 199 |
| 191 } // namespace webrtc | 200 } // namespace webrtc |
| 192 | 201 |
| 193 #endif // WEBRTC_VIDEO_SEND_STREAM_H_ | 202 #endif // WEBRTC_VIDEO_SEND_STREAM_H_ |
| OLD | NEW |