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/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 std::string ToString() const; | 30 std::string ToString() const; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 { |
129 // These are reference counted to permit copying VideoEncoderConfig and be | |
130 // kept alive until all encoder_specific_settings go out of scope. | |
131 // TODO(pbos): Consider removing the need for copying VideoEncoderConfig and | |
132 // use a rtc::Optional for encoder_specific_settings instead. | |
133 // | |
mflodman
2016/08/04 13:53:24
Remove empty comment line.
pbos-webrtc
2016/08/08 20:42:21
Done.
| |
134 class EncoderSpecificSettings : public rtc::RefCountInterface { | |
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; | |
mflodman
2016/08/04 13:53:23
Can this be statically implemented and the fillers
pbos-webrtc
2016/08/08 20:42:21
I have the base implementation here to avoid code
| |
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 | |
127 enum class ContentType { | 175 enum class ContentType { |
128 kRealtimeVideo, | 176 kRealtimeVideo, |
129 kScreen, | 177 kScreen, |
130 }; | 178 }; |
131 | 179 |
132 VideoEncoderConfig(); | 180 VideoEncoderConfig(); |
133 ~VideoEncoderConfig(); | 181 ~VideoEncoderConfig(); |
134 std::string ToString() const; | 182 std::string ToString() const; |
135 | 183 |
136 std::vector<VideoStream> streams; | 184 std::vector<VideoStream> streams; |
137 std::vector<SpatialLayer> spatial_layers; | 185 std::vector<SpatialLayer> spatial_layers; |
138 ContentType content_type; | 186 ContentType content_type; |
139 void* encoder_specific_settings; | 187 rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings; |
140 | 188 |
141 // 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 |
142 // 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 |
143 // maintaining a higher bitrate estimate. Padding will however not be sent | 191 // maintaining a higher bitrate estimate. Padding will however not be sent |
144 // unless the estimated bandwidth indicates that the link can handle it. | 192 // unless the estimated bandwidth indicates that the link can handle it. |
145 int min_transmit_bitrate_bps; | 193 int min_transmit_bitrate_bps; |
146 bool expect_encode_from_texture; | 194 bool expect_encode_from_texture; |
147 }; | 195 }; |
148 | 196 |
149 // Controls the capacity of the packet buffer in NetEq. The capacity is the | 197 // Controls the capacity of the packet buffer in NetEq. The capacity is the |
(...skipping 21 matching lines...) Expand all Loading... | |
171 struct VoicePacing { | 219 struct VoicePacing { |
172 VoicePacing() : enabled(false) {} | 220 VoicePacing() : enabled(false) {} |
173 explicit VoicePacing(bool value) : enabled(value) {} | 221 explicit VoicePacing(bool value) : enabled(value) {} |
174 static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing; | 222 static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing; |
175 bool enabled; | 223 bool enabled; |
176 }; | 224 }; |
177 | 225 |
178 } // namespace webrtc | 226 } // namespace webrtc |
179 | 227 |
180 #endif // WEBRTC_CONFIG_H_ | 228 #endif // WEBRTC_CONFIG_H_ |
OLD | NEW |