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_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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 { |
127 public: | 129 public: |
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 | |
perkj_webrtc
2016/09/19 08:38:30
no todo pbos please....
kthelgason
2016/09/19 09:15:40
Acknowledged.
| |
133 // use a rtc::Optional for encoder_specific_settings instead. | |
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; | |
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& operator=(VideoEncoderConfig&&) = default; | 180 VideoEncoderConfig& operator=(VideoEncoderConfig&&) = default; |
134 VideoEncoderConfig& operator=(const VideoEncoderConfig&) = delete; | 181 VideoEncoderConfig& operator=(const VideoEncoderConfig&) = delete; |
135 | 182 |
136 // Mostly used by tests. Avoid creating copies if you can. | 183 // Mostly used by tests. Avoid creating copies if you can. |
137 VideoEncoderConfig Copy() const { return VideoEncoderConfig(*this); } | 184 VideoEncoderConfig Copy() const { return VideoEncoderConfig(*this); } |
138 | 185 |
139 VideoEncoderConfig(); | 186 VideoEncoderConfig(); |
140 VideoEncoderConfig(VideoEncoderConfig&&) = default; | 187 VideoEncoderConfig(VideoEncoderConfig&&) = default; |
141 ~VideoEncoderConfig(); | 188 ~VideoEncoderConfig(); |
142 std::string ToString() const; | 189 std::string ToString() const; |
143 | 190 |
144 std::vector<VideoStream> streams; | 191 std::vector<VideoStream> streams; |
145 std::vector<SpatialLayer> spatial_layers; | 192 std::vector<SpatialLayer> spatial_layers; |
146 ContentType content_type; | 193 ContentType content_type; |
147 void* encoder_specific_settings; | 194 rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings; |
148 | 195 |
149 // Padding will be used up to this bitrate regardless of the bitrate produced | 196 // 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 | 197 // 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 | 198 // maintaining a higher bitrate estimate. Padding will however not be sent |
152 // unless the estimated bandwidth indicates that the link can handle it. | 199 // unless the estimated bandwidth indicates that the link can handle it. |
153 int min_transmit_bitrate_bps; | 200 int min_transmit_bitrate_bps; |
154 bool expect_encode_from_texture; | 201 bool expect_encode_from_texture; |
155 | 202 |
156 private: | 203 private: |
157 // Access to the copy constructor is private to force use of the Copy() | 204 // Access to the copy constructor is private to force use of the Copy() |
158 // method for those exceptional cases where we do use it. | 205 // method for those exceptional cases where we do use it. |
159 VideoEncoderConfig(const VideoEncoderConfig&) = default; | 206 VideoEncoderConfig(const VideoEncoderConfig&) = default; |
160 }; | 207 }; |
161 | 208 |
162 struct VideoDecoderH264Settings { | 209 struct VideoDecoderH264Settings { |
163 std::string sprop_parameter_sets; | 210 std::string sprop_parameter_sets; |
164 }; | 211 }; |
165 | 212 |
166 class DecoderSpecificSettings { | 213 class DecoderSpecificSettings { |
167 public: | 214 public: |
168 virtual ~DecoderSpecificSettings() {} | 215 virtual ~DecoderSpecificSettings() {} |
169 rtc::Optional<VideoDecoderH264Settings> h264_extra_settings; | 216 rtc::Optional<VideoDecoderH264Settings> h264_extra_settings; |
170 }; | 217 }; |
171 | 218 |
172 } // namespace webrtc | 219 } // namespace webrtc |
173 | 220 |
174 #endif // WEBRTC_CONFIG_H_ | 221 #endif // WEBRTC_CONFIG_H_ |
OLD | NEW |