OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_ | 11 #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_ |
12 #define WEBRTC_VIDEO_VIE_ENCODER_H_ | 12 #define WEBRTC_VIDEO_VIE_ENCODER_H_ |
13 | 13 |
14 #include <map> | |
14 #include <memory> | 15 #include <memory> |
15 #include <string> | 16 #include <string> |
16 #include <vector> | 17 #include <vector> |
17 | 18 |
18 #include "webrtc/api/video/video_rotation.h" | 19 #include "webrtc/api/video/video_rotation.h" |
19 #include "webrtc/base/criticalsection.h" | 20 #include "webrtc/base/criticalsection.h" |
20 #include "webrtc/base/event.h" | 21 #include "webrtc/base/event.h" |
21 #include "webrtc/base/sequenced_task_checker.h" | 22 #include "webrtc/base/sequenced_task_checker.h" |
22 #include "webrtc/base/task_queue.h" | 23 #include "webrtc/base/task_queue.h" |
23 #include "webrtc/call/call.h" | 24 #include "webrtc/call/call.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); | 210 size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); |
210 bool nack_enabled_ ACCESS_ON(&encoder_queue_); | 211 bool nack_enabled_ ACCESS_ON(&encoder_queue_); |
211 uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); | 212 uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); |
212 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); | 213 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); |
213 bool has_received_sli_ ACCESS_ON(&encoder_queue_); | 214 bool has_received_sli_ ACCESS_ON(&encoder_queue_); |
214 uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_); | 215 uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_); |
215 bool has_received_rpsi_ ACCESS_ON(&encoder_queue_); | 216 bool has_received_rpsi_ ACCESS_ON(&encoder_queue_); |
216 uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_); | 217 uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_); |
217 Clock* const clock_; | 218 Clock* const clock_; |
218 // Counters used for deciding if the video resolution is currently | 219 // Counters used for deciding if the video resolution is currently |
219 // restricted, and if so, why. | 220 // restricted, and if so, why, on a per degradation preference basis. |
220 std::vector<int> scale_counter_ ACCESS_ON(&encoder_queue_); | 221 // TODO(sprang): Replace this with a state holding a relative overuse measure |
222 // instead, that can be translated into suitable down-scale or fps limit. | |
223 std::map<size_t, std::vector<int>> scale_counter_ ACCESS_ON(&encoder_queue_); | |
kthelgason
2017/02/27 14:02:39
Why not have this a map from DegradationPreference
sprang_webrtc
2017/02/28 08:46:28
Hm, when I tried this I kept getting giant obscure
| |
221 // Set depending on degradation preferences | 224 // Set depending on degradation preferences |
222 VideoSendStream::DegradationPreference degradation_preference_ | 225 VideoSendStream::DegradationPreference degradation_preference_ |
223 ACCESS_ON(&encoder_queue_); | 226 ACCESS_ON(&encoder_queue_); |
224 | 227 |
225 struct AdaptationRequest { | 228 struct AdaptationRequest { |
226 // The pixel count produced by the source at the time of the adaptation. | 229 // The pixel count produced by the source at the time of the adaptation. |
227 int input_pixel_count_; | 230 int input_pixel_count_; |
231 // Framerate received from the source at the time of the adaptation. | |
232 int framerate_fps_; | |
228 // Indicates if request was to adapt up or down. | 233 // Indicates if request was to adapt up or down. |
229 enum class Mode { kAdaptUp, kAdaptDown } mode_; | 234 enum class Mode { kAdaptUp, kAdaptDown } mode_; |
230 }; | 235 }; |
231 // Stores a snapshot of the last adaptation request triggered by an AdaptUp | 236 // Stores a snapshot of the last adaptation request triggered by an AdaptUp |
232 // or AdaptDown signal. | 237 // or AdaptDown signal. |
233 rtc::Optional<AdaptationRequest> last_adaptation_request_ | 238 rtc::Optional<AdaptationRequest> last_adaptation_request_ |
234 ACCESS_ON(&encoder_queue_); | 239 ACCESS_ON(&encoder_queue_); |
235 | 240 |
236 rtc::RaceChecker incoming_frame_race_checker_ | 241 rtc::RaceChecker incoming_frame_race_checker_ |
237 GUARDED_BY(incoming_frame_race_checker_); | 242 GUARDED_BY(incoming_frame_race_checker_); |
(...skipping 13 matching lines...) Expand all Loading... | |
251 // All public methods are proxied to |encoder_queue_|. It must must be | 256 // All public methods are proxied to |encoder_queue_|. It must must be |
252 // destroyed first to make sure no tasks are run that use other members. | 257 // destroyed first to make sure no tasks are run that use other members. |
253 rtc::TaskQueue encoder_queue_; | 258 rtc::TaskQueue encoder_queue_; |
254 | 259 |
255 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); | 260 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); |
256 }; | 261 }; |
257 | 262 |
258 } // namespace webrtc | 263 } // namespace webrtc |
259 | 264 |
260 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 265 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |