Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: webrtc/config.h

Issue 2351633002: Let ViEEncoder handle resolution changes. (Closed)
Patch Set: fix line ending. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // TODO(pbos): Move Config from common.h to here. 11 // TODO(pbos): Move Config from common.h to here.
12 12
13 #ifndef WEBRTC_CONFIG_H_ 13 #ifndef WEBRTC_CONFIG_H_
14 #define WEBRTC_CONFIG_H_ 14 #define WEBRTC_CONFIG_H_
15 15
16 #include <string> 16 #include <string>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/base/optional.h" 19 #include "webrtc/base/optional.h"
20 #include "webrtc/base/refcount.h"
21 #include "webrtc/base/scoped_ref_ptr.h"
20 #include "webrtc/common_types.h" 22 #include "webrtc/common_types.h"
21 #include "webrtc/typedefs.h" 23 #include "webrtc/typedefs.h"
22 24
23 namespace webrtc { 25 namespace webrtc {
24 26
25 // Settings for NACK, see RFC 4585 for details. 27 // Settings for NACK, see RFC 4585 for details.
26 struct NackConfig { 28 struct NackConfig {
27 NackConfig() : rtp_history_ms(0) {} 29 NackConfig() : rtp_history_ms(0) {}
28 std::string ToString() const; 30 std::string ToString() const;
29 // Send side: the time RTP packets are stored for retransmissions. 31 // Send side: the time RTP packets are stored for retransmissions.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // three, and so on. 118 // three, and so on.
117 // The VideoEncoder may redistribute bitrates over the temporal layers so a 119 // The VideoEncoder may redistribute bitrates over the temporal layers so a
118 // bitrate threshold of 100k and an estimate of 105k does not imply that we 120 // bitrate threshold of 100k and an estimate of 105k does not imply that we
119 // get 100k in one temporal layer and 5k in the other, just that the bitrate 121 // get 100k in one temporal layer and 5k in the other, just that the bitrate
120 // in the first temporal layer should not exceed 100k. 122 // in the first temporal layer should not exceed 100k.
121 // TODO(pbos): Apart from a special case for two-layer screencast these 123 // TODO(pbos): Apart from a special case for two-layer screencast these
122 // thresholds are not propagated to the VideoEncoder. To be implemented. 124 // thresholds are not propagated to the VideoEncoder. To be implemented.
123 std::vector<int> temporal_layer_thresholds_bps; 125 std::vector<int> temporal_layer_thresholds_bps;
124 }; 126 };
125 127
126 struct VideoEncoderConfig { 128 struct VideoEncoderConfig {
mflodman 2016/09/27 11:28:00 Seems like this should be a class instead of a str
perkj_webrtc 2016/09/27 13:45:17 Done.
127 public: 129 public:
128 enum class ContentType { 130 enum class ContentType {
129 kRealtimeVideo, 131 kRealtimeVideo,
130 kScreen, 132 kScreen,
131 }; 133 };
132 134
135 class VideoStreamFactoryInterface : public rtc::RefCountInterface {
136 public:
137 // An implementation should return a std::vector<VideoStream> with the
138 // wanted VideoStream settings for the given video resolution.
139 // The size of the vector may not be larger than
140 // |encoder_config.number_of_streams|.
141 virtual std::vector<VideoStream> CreateEncoderStreams(
142 int width,
143 int height,
144 const VideoEncoderConfig& encoder_config) = 0;
145
146 protected:
147 virtual ~VideoStreamFactoryInterface() {}
148 };
149
133 VideoEncoderConfig& operator=(VideoEncoderConfig&&) = default; 150 VideoEncoderConfig& operator=(VideoEncoderConfig&&) = default;
134 VideoEncoderConfig& operator=(const VideoEncoderConfig&) = delete; 151 VideoEncoderConfig& operator=(const VideoEncoderConfig&) = delete;
135 152
136 // Mostly used by tests. Avoid creating copies if you can. 153 // Mostly used by tests. Avoid creating copies if you can.
137 VideoEncoderConfig Copy() const { return VideoEncoderConfig(*this); } 154 VideoEncoderConfig Copy() const { return VideoEncoderConfig(*this); }
138 155
139 VideoEncoderConfig(); 156 VideoEncoderConfig();
140 VideoEncoderConfig(VideoEncoderConfig&&) = default; 157 VideoEncoderConfig(VideoEncoderConfig&&) = default;
141 ~VideoEncoderConfig(); 158 ~VideoEncoderConfig();
142 std::string ToString() const; 159 std::string ToString() const;
143 160
144 std::vector<VideoStream> streams; 161 rtc::scoped_refptr<VideoStreamFactoryInterface> encoder_stream_factory;
perkj_webrtc 2016/09/27 13:45:17 renamed video_stream_factory.
145 std::vector<SpatialLayer> spatial_layers; 162 std::vector<SpatialLayer> spatial_layers;
146 ContentType content_type; 163 ContentType content_type;
147 void* encoder_specific_settings; 164 void* encoder_specific_settings;
148 165
149 // Padding will be used up to this bitrate regardless of the bitrate produced 166 // Padding will be used up to this bitrate regardless of the bitrate produced
150 // by the encoder. Padding above what's actually produced by the encoder helps 167 // by the encoder. Padding above what's actually produced by the encoder helps
151 // maintaining a higher bitrate estimate. Padding will however not be sent 168 // maintaining a higher bitrate estimate. Padding will however not be sent
152 // unless the estimated bandwidth indicates that the link can handle it. 169 // unless the estimated bandwidth indicates that the link can handle it.
153 int min_transmit_bitrate_bps; 170 int min_transmit_bitrate_bps;
154 bool expect_encode_from_texture; 171 int max_bitrate_bps;
172
173 // Max number of encoded VideoStreams to produce.
174 size_t number_of_streams;
155 175
156 private: 176 private:
157 // Access to the copy constructor is private to force use of the Copy() 177 // Access to the copy constructor is private to force use of the Copy()
158 // method for those exceptional cases where we do use it. 178 // method for those exceptional cases where we do use it.
159 VideoEncoderConfig(const VideoEncoderConfig&) = default; 179 VideoEncoderConfig(const VideoEncoderConfig&) = default;
160 }; 180 };
161 181
162 struct VideoDecoderH264Settings { 182 struct VideoDecoderH264Settings {
163 std::string sprop_parameter_sets; 183 std::string sprop_parameter_sets;
164 }; 184 };
165 185
166 class DecoderSpecificSettings { 186 class DecoderSpecificSettings {
167 public: 187 public:
168 virtual ~DecoderSpecificSettings() {} 188 virtual ~DecoderSpecificSettings() {}
169 rtc::Optional<VideoDecoderH264Settings> h264_extra_settings; 189 rtc::Optional<VideoDecoderH264Settings> h264_extra_settings;
170 }; 190 };
171 191
172 } // namespace webrtc 192 } // namespace webrtc
173 193
174 #endif // WEBRTC_CONFIG_H_ 194 #endif // WEBRTC_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698