| Index: webrtc/video/vie_encoder.h
|
| diff --git a/webrtc/video/vie_encoder.h b/webrtc/video/vie_encoder.h
|
| index b89f66e9d9707a2ee8484368aefd1abf978c0c07..69ec137af4784dedc54d66dc7ee12955bc068d9a 100644
|
| --- a/webrtc/video/vie_encoder.h
|
| +++ b/webrtc/video/vie_encoder.h
|
| @@ -25,6 +25,7 @@
|
| #include "webrtc/media/base/videosinkinterface.h"
|
| #include "webrtc/modules/video_coding/include/video_coding_defines.h"
|
| #include "webrtc/modules/video_coding/utility/simulcast_rate_allocator.h"
|
| +#include "webrtc/modules/video_coding/utility/quality_scaler.h"
|
| #include "webrtc/modules/video_coding/video_coding_impl.h"
|
| #include "webrtc/modules/video_processing/include/video_processing.h"
|
| #include "webrtc/system_wrappers/include/atomic32.h"
|
| @@ -49,7 +50,7 @@ class SendStatisticsProxy;
|
| class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
| public EncodedImageCallback,
|
| public VCMSendStatisticsCallback,
|
| - public CpuOveruseObserver {
|
| + public ScalingObserverInterface {
|
| public:
|
| // Interface for receiving encoded video frames and notifications about
|
| // configuration changes.
|
| @@ -60,9 +61,6 @@ class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
| int min_transmit_bitrate_bps) = 0;
|
| };
|
|
|
| - // Down grade resolution at most 2 times for CPU reasons.
|
| - static const int kMaxCpuDowngrades = 2;
|
| -
|
| ViEEncoder(uint32_t number_of_cores,
|
| SendStatisticsProxy* stats_proxy,
|
| const VideoSendStream::Config::EncoderSettings& settings,
|
| @@ -110,14 +108,14 @@ class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
| int64_t round_trip_time_ms);
|
|
|
| protected:
|
| - // Used for testing. For example the |CpuOveruseObserver| methods must be
|
| - // called on |encoder_queue_|.
|
| + // Used for testing. For example the |ScalingObserverInterface| methods must
|
| + // be called on |encoder_queue_|.
|
| rtc::TaskQueue* encoder_queue() { return &encoder_queue_; }
|
|
|
| - // webrtc::CpuOveruseObserver implementation.
|
| + // webrtc::ScalingObserverInterface implementation.
|
| // These methods are protected for easier testing.
|
| - void OveruseDetected() override;
|
| - void NormalUsage() override;
|
| + void ScaleUp(ScaleReason reason) override;
|
| + void ScaleDown(ScaleReason reason) override;
|
|
|
| private:
|
| class ConfigureEncoderTask;
|
| @@ -174,6 +172,7 @@ class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
|
|
| vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_);
|
| OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_);
|
| + std::unique_ptr<QualityScaler> quality_scaler_ ACCESS_ON(&encoder_queue_);
|
|
|
| SendStatisticsProxy* const stats_proxy_;
|
| rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_;
|
| @@ -203,12 +202,9 @@ class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>,
|
| bool has_received_rpsi_ ACCESS_ON(&encoder_queue_);
|
| uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_);
|
| Clock* const clock_;
|
| -
|
| - VideoSendStream::DegradationPreference degradation_preference_
|
| - ACCESS_ON(&encoder_queue_);
|
| // Counter used for deciding if the video resolution is currently
|
| - // restricted by CPU usage.
|
| - int cpu_restricted_counter_ ACCESS_ON(&encoder_queue_);
|
| + // restricted by CPU usage. It is reset if |source_| is changed.
|
| + int scale_counter_[kScaleReasonSize] ACCESS_ON(&encoder_queue_) = {0};
|
|
|
| int last_frame_width_ ACCESS_ON(&encoder_queue_);
|
| int last_frame_height_ ACCESS_ON(&encoder_queue_);
|
|
|