Chromium Code Reviews| 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 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 | 122 |
| 123 protected: | 123 protected: |
| 124 // Used for testing. For example the |ScalingObserverInterface| methods must | 124 // Used for testing. For example the |ScalingObserverInterface| methods must |
| 125 // be called on |encoder_queue_|. | 125 // be called on |encoder_queue_|. |
| 126 rtc::TaskQueue* encoder_queue() { return &encoder_queue_; } | 126 rtc::TaskQueue* encoder_queue() { return &encoder_queue_; } |
| 127 | 127 |
| 128 // webrtc::ScalingObserverInterface implementation. | 128 // webrtc::ScalingObserverInterface implementation. |
| 129 // These methods are protected for easier testing. | 129 // These methods are protected for easier testing. |
| 130 void AdaptUp(AdaptReason reason) override; | 130 void AdaptUp(AdaptReason reason) override; |
| 131 void AdaptDown(AdaptReason reason) override; | 131 void AdaptDown(AdaptReason reason) override; |
| 132 static CpuOveruseOptions GetCpuOveruseOptions(bool full_overuse_time); | |
| 133 | |
| 134 void UpdateOveruseDetector( | |
| 135 std::unique_ptr<OveruseFrameDetector> overuse_detector); | |
| 132 | 136 |
| 133 private: | 137 private: |
| 134 class ConfigureEncoderTask; | 138 class ConfigureEncoderTask; |
| 135 class EncodeTask; | 139 class EncodeTask; |
| 136 class VideoSourceProxy; | 140 class VideoSourceProxy; |
| 137 | 141 |
| 138 class VideoFrameInfo { | 142 class VideoFrameInfo { |
| 139 public: | 143 public: |
| 140 VideoFrameInfo(int width, | 144 VideoFrameInfo(int width, |
| 141 int height, | 145 int height, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 const uint32_t number_of_cores_; | 226 const uint32_t number_of_cores_; |
| 223 // Counts how many frames we've dropped in the initial rampup phase. | 227 // Counts how many frames we've dropped in the initial rampup phase. |
| 224 int initial_rampup_; | 228 int initial_rampup_; |
| 225 | 229 |
| 226 const std::unique_ptr<VideoSourceProxy> source_proxy_; | 230 const std::unique_ptr<VideoSourceProxy> source_proxy_; |
| 227 EncoderSink* sink_; | 231 EncoderSink* sink_; |
| 228 const VideoSendStream::Config::EncoderSettings settings_; | 232 const VideoSendStream::Config::EncoderSettings settings_; |
| 229 const VideoCodecType codec_type_; | 233 const VideoCodecType codec_type_; |
| 230 | 234 |
| 231 vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); | 235 vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); |
| 232 OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_); | 236 std::unique_ptr<OveruseFrameDetector> overuse_detector_ |
| 237 ACCESS_ON(&encoder_queue_); | |
| 233 std::unique_ptr<QualityScaler> quality_scaler_ ACCESS_ON(&encoder_queue_); | 238 std::unique_ptr<QualityScaler> quality_scaler_ ACCESS_ON(&encoder_queue_); |
| 234 | 239 |
| 235 SendStatisticsProxy* const stats_proxy_; | 240 SendStatisticsProxy* const stats_proxy_; |
| 236 rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_; | 241 rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_; |
| 237 ProcessThread* module_process_thread_; | 242 ProcessThread* module_process_thread_; |
| 238 rtc::ThreadChecker module_process_thread_checker_; | 243 rtc::ThreadChecker module_process_thread_checker_; |
| 239 // |thread_checker_| checks that public methods that are related to lifetime | 244 // |thread_checker_| checks that public methods that are related to lifetime |
| 240 // of ViEEncoder are called on the same thread. | 245 // of ViEEncoder are called on the same thread. |
| 241 rtc::ThreadChecker thread_checker_; | 246 rtc::ThreadChecker thread_checker_; |
| 242 | 247 |
| 243 VideoEncoderConfig encoder_config_ ACCESS_ON(&encoder_queue_); | 248 VideoEncoderConfig encoder_config_ ACCESS_ON(&encoder_queue_); |
| 244 std::unique_ptr<VideoBitrateAllocator> rate_allocator_ | 249 std::unique_ptr<VideoBitrateAllocator> rate_allocator_ |
| 245 ACCESS_ON(&encoder_queue_); | 250 ACCESS_ON(&encoder_queue_); |
| 251 // The maximum frame rate of the current codec configuration, as determined | |
| 252 // at the last ReconfigureEncoder() call. | |
| 253 int max_framerate_ ACCESS_ON(&encoder_queue_); | |
|
kthelgason
2017/06/12 11:56:48
we already store the VideoEncoderConfig. Isn't thi
sprang_webrtc
2017/06/14 08:39:17
You'd think so, but it actually doesn't (explicitl
| |
| 246 | 254 |
| 247 // Set when ConfigureEncoder has been called in order to lazy reconfigure the | 255 // Set when ConfigureEncoder has been called in order to lazy reconfigure the |
| 248 // encoder on the next frame. | 256 // encoder on the next frame. |
| 249 bool pending_encoder_reconfiguration_ ACCESS_ON(&encoder_queue_); | 257 bool pending_encoder_reconfiguration_ ACCESS_ON(&encoder_queue_); |
| 250 rtc::Optional<VideoFrameInfo> last_frame_info_ ACCESS_ON(&encoder_queue_); | 258 rtc::Optional<VideoFrameInfo> last_frame_info_ ACCESS_ON(&encoder_queue_); |
| 251 uint32_t encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_); | 259 uint32_t encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_); |
| 252 size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); | 260 size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); |
| 253 bool nack_enabled_ ACCESS_ON(&encoder_queue_); | 261 bool nack_enabled_ ACCESS_ON(&encoder_queue_); |
| 254 uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); | 262 uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); |
| 255 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); | 263 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 // All public methods are proxied to |encoder_queue_|. It must must be | 304 // All public methods are proxied to |encoder_queue_|. It must must be |
| 297 // destroyed first to make sure no tasks are run that use other members. | 305 // destroyed first to make sure no tasks are run that use other members. |
| 298 rtc::TaskQueue encoder_queue_; | 306 rtc::TaskQueue encoder_queue_; |
| 299 | 307 |
| 300 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); | 308 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); |
| 301 }; | 309 }; |
| 302 | 310 |
| 303 } // namespace webrtc | 311 } // namespace webrtc |
| 304 | 312 |
| 305 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 313 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
| OLD | NEW |