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 // 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.h" | 22 #include "webrtc/common.h" |
21 #include "webrtc/common_types.h" | 23 #include "webrtc/common_types.h" |
22 #include "webrtc/typedefs.h" | 24 #include "webrtc/typedefs.h" |
23 | 25 |
24 namespace webrtc { | 26 namespace webrtc { |
25 | 27 |
26 // Settings for NACK, see RFC 4585 for details. | 28 // Settings for NACK, see RFC 4585 for details. |
27 struct NackConfig { | 29 struct NackConfig { |
28 NackConfig() : rtp_history_ms(0) {} | 30 NackConfig() : rtp_history_ms(0) {} |
29 std::string ToString() const; | 31 std::string ToString() const; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 // The VideoEncoder may redistribute bitrates over the temporal layers so a | 120 // The VideoEncoder may redistribute bitrates over the temporal layers so a |
119 // bitrate threshold of 100k and an estimate of 105k does not imply that we | 121 // bitrate threshold of 100k and an estimate of 105k does not imply that we |
120 // get 100k in one temporal layer and 5k in the other, just that the bitrate | 122 // get 100k in one temporal layer and 5k in the other, just that the bitrate |
121 // in the first temporal layer should not exceed 100k. | 123 // in the first temporal layer should not exceed 100k. |
122 // TODO(pbos): Apart from a special case for two-layer screencast these | 124 // TODO(pbos): Apart from a special case for two-layer screencast these |
123 // thresholds are not propagated to the VideoEncoder. To be implemented. | 125 // thresholds are not propagated to the VideoEncoder. To be implemented. |
124 std::vector<int> temporal_layer_thresholds_bps; | 126 std::vector<int> temporal_layer_thresholds_bps; |
125 }; | 127 }; |
126 | 128 |
127 struct VideoEncoderConfig { | 129 struct VideoEncoderConfig { |
130 // These are reference counted to permit copying VideoEncoderConfig and be | |
131 // kept alive until all encoder_specific_settings go out of scope. | |
132 // TODO(pbos): Consider removing the need for copying VideoEncoderConfig and | |
133 // use a rtc::Optional for encoder_specific_settings instead. | |
134 class EncoderSpecificSettings : public rtc::RefCountInterface { | |
perkj_webrtc
2016/09/14 09:51:31
I really think this should be landed. But I think
| |
135 public: | |
136 virtual ~EncoderSpecificSettings() {} | |
137 // TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is | |
138 // not in use and encoder implementations ask for codec-specific structs | |
139 // directly. | |
140 void FillEncoderSpecificSettings(VideoCodec* codec_struct) const; | |
141 | |
142 virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const; | |
143 virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const; | |
144 virtual void FillVideoCodecH264(VideoCodecH264* h264_settings) const; | |
145 }; | |
146 | |
147 class H264EncoderSpecificSettings : public EncoderSpecificSettings { | |
148 public: | |
149 explicit H264EncoderSpecificSettings(const VideoCodecH264& specifics); | |
150 virtual void FillVideoCodecH264( | |
151 VideoCodecH264* h264_settings) const override; | |
152 | |
153 private: | |
154 VideoCodecH264 specifics_; | |
155 }; | |
156 | |
157 class Vp8EncoderSpecificSettings : public EncoderSpecificSettings { | |
158 public: | |
159 explicit Vp8EncoderSpecificSettings(const VideoCodecVP8& specifics); | |
160 virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const override; | |
161 | |
162 private: | |
163 VideoCodecVP8 specifics_; | |
164 }; | |
165 | |
166 class Vp9EncoderSpecificSettings : public EncoderSpecificSettings { | |
167 public: | |
168 explicit Vp9EncoderSpecificSettings(const VideoCodecVP9& specifics); | |
169 virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const override; | |
170 | |
171 private: | |
172 VideoCodecVP9 specifics_; | |
173 }; | |
174 | |
128 enum class ContentType { | 175 enum class ContentType { |
129 kRealtimeVideo, | 176 kRealtimeVideo, |
130 kScreen, | 177 kScreen, |
131 }; | 178 }; |
132 | 179 |
133 VideoEncoderConfig(); | 180 VideoEncoderConfig(); |
134 ~VideoEncoderConfig(); | 181 ~VideoEncoderConfig(); |
135 std::string ToString() const; | 182 std::string ToString() const; |
136 | 183 |
137 std::vector<VideoStream> streams; | 184 std::vector<VideoStream> streams; |
138 std::vector<SpatialLayer> spatial_layers; | 185 std::vector<SpatialLayer> spatial_layers; |
139 ContentType content_type; | 186 ContentType content_type; |
140 void* encoder_specific_settings; | 187 rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings; |
141 | 188 |
142 // Padding will be used up to this bitrate regardless of the bitrate produced | 189 // Padding will be used up to this bitrate regardless of the bitrate produced |
143 // by the encoder. Padding above what's actually produced by the encoder helps | 190 // by the encoder. Padding above what's actually produced by the encoder helps |
144 // maintaining a higher bitrate estimate. Padding will however not be sent | 191 // maintaining a higher bitrate estimate. Padding will however not be sent |
145 // unless the estimated bandwidth indicates that the link can handle it. | 192 // unless the estimated bandwidth indicates that the link can handle it. |
146 int min_transmit_bitrate_bps; | 193 int min_transmit_bitrate_bps; |
147 bool expect_encode_from_texture; | 194 bool expect_encode_from_texture; |
148 }; | 195 }; |
149 | 196 |
150 struct VideoDecoderH264Settings { | 197 struct VideoDecoderH264Settings { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 struct VoicePacing { | 229 struct VoicePacing { |
183 VoicePacing() : enabled(false) {} | 230 VoicePacing() : enabled(false) {} |
184 explicit VoicePacing(bool value) : enabled(value) {} | 231 explicit VoicePacing(bool value) : enabled(value) {} |
185 static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing; | 232 static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing; |
186 bool enabled; | 233 bool enabled; |
187 }; | 234 }; |
188 | 235 |
189 } // namespace webrtc | 236 } // namespace webrtc |
190 | 237 |
191 #endif // WEBRTC_CONFIG_H_ | 238 #endif // WEBRTC_CONFIG_H_ |
OLD | NEW |