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

Side by Side Diff: webrtc/config.h

Issue 2383493005: Revert of Let ViEEncoder handle resolution changes. (Closed)
Patch Set: 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
« no previous file with comments | « webrtc/call/rampup_tests.cc ('k') | webrtc/config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // three, and so on. 118 // three, and so on.
119 // The VideoEncoder may redistribute bitrates over the temporal layers so a 119 // The VideoEncoder may redistribute bitrates over the temporal layers so a
120 // 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
121 // 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
122 // in the first temporal layer should not exceed 100k. 122 // in the first temporal layer should not exceed 100k.
123 // TODO(kthelgason): Apart from a special case for two-layer screencast these 123 // TODO(kthelgason): Apart from a special case for two-layer screencast these
124 // thresholds are not propagated to the VideoEncoder. To be implemented. 124 // thresholds are not propagated to the VideoEncoder. To be implemented.
125 std::vector<int> temporal_layer_thresholds_bps; 125 std::vector<int> temporal_layer_thresholds_bps;
126 }; 126 };
127 127
128 class VideoEncoderConfig { 128 struct VideoEncoderConfig {
129 public: 129 public:
130 // These are reference counted to permit copying VideoEncoderConfig and be 130 // These are reference counted to permit copying VideoEncoderConfig and be
131 // kept alive until all encoder_specific_settings go out of scope. 131 // kept alive until all encoder_specific_settings go out of scope.
132 // TODO(kthelgason): Consider removing the need for copying VideoEncoderConfig 132 // TODO(kthelgason): Consider removing the need for copying VideoEncoderConfig
133 // and use rtc::Optional for encoder_specific_settings instead. 133 // and use rtc::Optional for encoder_specific_settings instead.
134 class EncoderSpecificSettings : public rtc::RefCountInterface { 134 class EncoderSpecificSettings : public rtc::RefCountInterface {
135 public: 135 public:
136 // TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is 136 // TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is
137 // not in use and encoder implementations ask for codec-specific structs 137 // not in use and encoder implementations ask for codec-specific structs
138 // directly. 138 // directly.
139 void FillEncoderSpecificSettings(VideoCodec* codec_struct) const; 139 void FillEncoderSpecificSettings(VideoCodec* codec_struct) const;
140 140
141 virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const; 141 virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const;
142 virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const; 142 virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const;
143 virtual void FillVideoCodecH264(VideoCodecH264* h264_settings) const; 143 virtual void FillVideoCodecH264(VideoCodecH264* h264_settings) const;
144 private: 144 private:
145 virtual ~EncoderSpecificSettings() {} 145 virtual ~EncoderSpecificSettings() {}
146 friend class VideoEncoderConfig; 146 friend struct VideoEncoderConfig;
147 }; 147 };
148 148
149 class H264EncoderSpecificSettings : public EncoderSpecificSettings { 149 class H264EncoderSpecificSettings : public EncoderSpecificSettings {
150 public: 150 public:
151 explicit H264EncoderSpecificSettings(const VideoCodecH264& specifics); 151 explicit H264EncoderSpecificSettings(const VideoCodecH264& specifics);
152 void FillVideoCodecH264(VideoCodecH264* h264_settings) const override; 152 virtual void FillVideoCodecH264(
153 VideoCodecH264* h264_settings) const override;
153 154
154 private: 155 private:
155 VideoCodecH264 specifics_; 156 VideoCodecH264 specifics_;
156 }; 157 };
157 158
158 class Vp8EncoderSpecificSettings : public EncoderSpecificSettings { 159 class Vp8EncoderSpecificSettings : public EncoderSpecificSettings {
159 public: 160 public:
160 explicit Vp8EncoderSpecificSettings(const VideoCodecVP8& specifics); 161 explicit Vp8EncoderSpecificSettings(const VideoCodecVP8& specifics);
161 void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const override; 162 virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const override;
162 163
163 private: 164 private:
164 VideoCodecVP8 specifics_; 165 VideoCodecVP8 specifics_;
165 }; 166 };
166 167
167 class Vp9EncoderSpecificSettings : public EncoderSpecificSettings { 168 class Vp9EncoderSpecificSettings : public EncoderSpecificSettings {
168 public: 169 public:
169 explicit Vp9EncoderSpecificSettings(const VideoCodecVP9& specifics); 170 explicit Vp9EncoderSpecificSettings(const VideoCodecVP9& specifics);
170 void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const override; 171 virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const override;
171 172
172 private: 173 private:
173 VideoCodecVP9 specifics_; 174 VideoCodecVP9 specifics_;
174 }; 175 };
175 176
176 enum class ContentType { 177 enum class ContentType {
177 kRealtimeVideo, 178 kRealtimeVideo,
178 kScreen, 179 kScreen,
179 }; 180 };
180 181
181 class VideoStreamFactoryInterface : public rtc::RefCountInterface {
182 public:
183 // An implementation should return a std::vector<VideoStream> with the
184 // wanted VideoStream settings for the given video resolution.
185 // The size of the vector may not be larger than
186 // |encoder_config.number_of_streams|.
187 virtual std::vector<VideoStream> CreateEncoderStreams(
188 int width,
189 int height,
190 const VideoEncoderConfig& encoder_config) = 0;
191
192 protected:
193 virtual ~VideoStreamFactoryInterface() {}
194 };
195
196 VideoEncoderConfig& operator=(VideoEncoderConfig&&) = default; 182 VideoEncoderConfig& operator=(VideoEncoderConfig&&) = default;
197 VideoEncoderConfig& operator=(const VideoEncoderConfig&) = delete; 183 VideoEncoderConfig& operator=(const VideoEncoderConfig&) = delete;
198 184
199 // Mostly used by tests. Avoid creating copies if you can. 185 // Mostly used by tests. Avoid creating copies if you can.
200 VideoEncoderConfig Copy() const { return VideoEncoderConfig(*this); } 186 VideoEncoderConfig Copy() const { return VideoEncoderConfig(*this); }
201 187
202 VideoEncoderConfig(); 188 VideoEncoderConfig();
203 VideoEncoderConfig(VideoEncoderConfig&&) = default; 189 VideoEncoderConfig(VideoEncoderConfig&&) = default;
204 ~VideoEncoderConfig(); 190 ~VideoEncoderConfig();
205 std::string ToString() const; 191 std::string ToString() const;
206 192
207 rtc::scoped_refptr<VideoStreamFactoryInterface> video_stream_factory; 193 std::vector<VideoStream> streams;
208 std::vector<SpatialLayer> spatial_layers; 194 std::vector<SpatialLayer> spatial_layers;
209 ContentType content_type; 195 ContentType content_type;
210 rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings; 196 rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings;
211 197
212 // Padding will be used up to this bitrate regardless of the bitrate produced 198 // Padding will be used up to this bitrate regardless of the bitrate produced
213 // by the encoder. Padding above what's actually produced by the encoder helps 199 // by the encoder. Padding above what's actually produced by the encoder helps
214 // maintaining a higher bitrate estimate. Padding will however not be sent 200 // maintaining a higher bitrate estimate. Padding will however not be sent
215 // unless the estimated bandwidth indicates that the link can handle it. 201 // unless the estimated bandwidth indicates that the link can handle it.
216 int min_transmit_bitrate_bps; 202 int min_transmit_bitrate_bps;
217 int max_bitrate_bps; 203 bool expect_encode_from_texture;
218
219 // Max number of encoded VideoStreams to produce.
220 size_t number_of_streams;
221 204
222 private: 205 private:
223 // Access to the copy constructor is private to force use of the Copy() 206 // Access to the copy constructor is private to force use of the Copy()
224 // method for those exceptional cases where we do use it. 207 // method for those exceptional cases where we do use it.
225 VideoEncoderConfig(const VideoEncoderConfig&) = default; 208 VideoEncoderConfig(const VideoEncoderConfig&) = default;
226 }; 209 };
227 210
228 struct VideoDecoderH264Settings { 211 struct VideoDecoderH264Settings {
229 std::string sprop_parameter_sets; 212 std::string sprop_parameter_sets;
230 }; 213 };
231 214
232 class DecoderSpecificSettings { 215 class DecoderSpecificSettings {
233 public: 216 public:
234 virtual ~DecoderSpecificSettings() {} 217 virtual ~DecoderSpecificSettings() {}
235 rtc::Optional<VideoDecoderH264Settings> h264_extra_settings; 218 rtc::Optional<VideoDecoderH264Settings> h264_extra_settings;
236 }; 219 };
237 220
238 } // namespace webrtc 221 } // namespace webrtc
239 222
240 #endif // WEBRTC_CONFIG_H_ 223 #endif // WEBRTC_CONFIG_H_
OLDNEW
« no previous file with comments | « webrtc/call/rampup_tests.cc ('k') | webrtc/config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698