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

Side by Side Diff: webrtc/config.h

Issue 2047513002: Add proper lifetime of encoder-specific settings. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: typo Created 4 years, 6 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 | « no previous file | 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
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/refcount.h"
20 #include "webrtc/base/scoped_ref_ptr.h"
19 #include "webrtc/common.h" 21 #include "webrtc/common.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 // Send side: the time RTP packets are stored for retransmissions. 30 // Send side: the time RTP packets are stored for retransmissions.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // The VideoEncoder may redistribute bitrates over the temporal layers so a 115 // The VideoEncoder may redistribute bitrates over the temporal layers so a
114 // bitrate threshold of 100k and an estimate of 105k does not imply that we 116 // bitrate threshold of 100k and an estimate of 105k does not imply that we
115 // get 100k in one temporal layer and 5k in the other, just that the bitrate 117 // get 100k in one temporal layer and 5k in the other, just that the bitrate
116 // in the first temporal layer should not exceed 100k. 118 // in the first temporal layer should not exceed 100k.
117 // TODO(pbos): Apart from a special case for two-layer screencast these 119 // TODO(pbos): Apart from a special case for two-layer screencast these
118 // thresholds are not propagated to the VideoEncoder. To be implemented. 120 // thresholds are not propagated to the VideoEncoder. To be implemented.
119 std::vector<int> temporal_layer_thresholds_bps; 121 std::vector<int> temporal_layer_thresholds_bps;
120 }; 122 };
121 123
122 struct VideoEncoderConfig { 124 struct VideoEncoderConfig {
125 class EncoderSpecificSettings : public rtc::RefCountInterface {
mflodman 2016/06/16 09:05:48 Add comment why ref counted and possible next step
pbos-webrtc 2016/07/13 08:44:12 Done.
126 public:
127 virtual ~EncoderSpecificSettings() {}
128 // TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is
129 // not in use and encoder implementations ask for codec-specific structs
130 // directly.
131 void FillEncoderSpecificSettings(VideoCodec* codec_struct) const;
132
133 virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const;
134 virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const;
135 virtual void FillVideoCodecH264(VideoCodecH264* h264_settings) const;
136 };
137
138 class H264EncoderSpecificSettings : public EncoderSpecificSettings {
139 public:
140 explicit H264EncoderSpecificSettings(const VideoCodecH264& specifics);
141 virtual void FillVideoCodecH264(
142 VideoCodecH264* vp8_settings) const override;
mflodman 2016/06/16 09:05:48 s/vp8/h264
pbos-webrtc 2016/07/13 08:44:12 Done.
143
144 private:
145 VideoCodecH264 specifics_;
146 };
147
148 class Vp8EncoderSpecificSettings : public EncoderSpecificSettings {
149 public:
150 explicit Vp8EncoderSpecificSettings(const VideoCodecVP8& specifics);
151 virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const override;
152
153 private:
154 VideoCodecVP8 specifics_;
155 };
156
157 class Vp9EncoderSpecificSettings : public EncoderSpecificSettings {
158 public:
159 explicit Vp9EncoderSpecificSettings(const VideoCodecVP9& specifics);
160 virtual void FillVideoCodecVp9(VideoCodecVP9* vp8_settings) const override;
mflodman 2016/06/16 09:05:48 s/vp8/vp9
pbos-webrtc 2016/07/13 08:44:12 Done.
161
162 private:
163 VideoCodecVP9 specifics_;
164 };
165
123 enum class ContentType { 166 enum class ContentType {
124 kRealtimeVideo, 167 kRealtimeVideo,
125 kScreen, 168 kScreen,
126 }; 169 };
127 170
128 VideoEncoderConfig(); 171 VideoEncoderConfig();
129 ~VideoEncoderConfig(); 172 ~VideoEncoderConfig();
130 std::string ToString() const; 173 std::string ToString() const;
131 174
132 std::vector<VideoStream> streams; 175 std::vector<VideoStream> streams;
133 std::vector<SpatialLayer> spatial_layers; 176 std::vector<SpatialLayer> spatial_layers;
134 ContentType content_type; 177 ContentType content_type;
135 void* encoder_specific_settings; 178 rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings;
136 179
137 // Padding will be used up to this bitrate regardless of the bitrate produced 180 // Padding will be used up to this bitrate regardless of the bitrate produced
138 // by the encoder. Padding above what's actually produced by the encoder helps 181 // by the encoder. Padding above what's actually produced by the encoder helps
139 // maintaining a higher bitrate estimate. Padding will however not be sent 182 // maintaining a higher bitrate estimate. Padding will however not be sent
140 // unless the estimated bandwidth indicates that the link can handle it. 183 // unless the estimated bandwidth indicates that the link can handle it.
141 int min_transmit_bitrate_bps; 184 int min_transmit_bitrate_bps;
142 }; 185 };
143 186
144 // Controls the capacity of the packet buffer in NetEq. The capacity is the 187 // Controls the capacity of the packet buffer in NetEq. The capacity is the
145 // maximum number of packets that the buffer can contain. If the limit is 188 // maximum number of packets that the buffer can contain. If the limit is
(...skipping 20 matching lines...) Expand all
166 struct VoicePacing { 209 struct VoicePacing {
167 VoicePacing() : enabled(false) {} 210 VoicePacing() : enabled(false) {}
168 explicit VoicePacing(bool value) : enabled(value) {} 211 explicit VoicePacing(bool value) : enabled(value) {}
169 static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing; 212 static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing;
170 bool enabled; 213 bool enabled;
171 }; 214 };
172 215
173 } // namespace webrtc 216 } // namespace webrtc
174 217
175 #endif // WEBRTC_CONFIG_H_ 218 #endif // WEBRTC_CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698