Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: webrtc/video/vie_encoder.cc

Issue 2398963003: Move usage of QualityScaler to ViEEncoder. (Closed)
Patch Set: fix videotoolbox overridden QP thresholds Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/video/vie_encoder.cc
diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc
index a9e7e097c1d9d97cc87a8938bf918cbf4595aa6c..d87689f901612e2cf7c16374724506e548b09a25 100644
--- a/webrtc/video/vie_encoder.cc
+++ b/webrtc/video/vie_encoder.cc
@@ -237,6 +237,7 @@ class ViEEncoder::EncodeTask : public rtc::QueuedTask {
LOG(LS_VERBOSE)
<< "Incoming frame dropped due to that the encoder is blocked.";
++vie_encoder_->dropped_frame_count_;
+ vie_encoder_->quality_scaler_.ReportDroppedFrame();
perkj_webrtc 2016/10/07 07:41:16 note- this is not the same ReportDroppedFrame as p
kthelgason 2016/10/07 09:34:48 Ok, that's good to know. At what point does ViEEnc
}
if (log_stats_) {
LOG(LS_INFO) << "Number of frames: captured "
@@ -414,6 +415,7 @@ void ViEEncoder::Stop() {
video_sender_.RegisterExternalEncoder(nullptr, settings_.payload_type,
false);
overuse_detector_.StopCheckForOveruse();
+ quality_scaler_.Stop();
shutdown_event_.Set();
});
@@ -508,6 +510,13 @@ void ViEEncoder::ReconfigureEncoder() {
codec.startBitrate = std::min(codec.startBitrate, codec.maxBitrate);
codec.expect_encode_from_texture = last_frame_info_->is_texture;
+ const auto thresholds = settings_.encoder->GetQPThresholds();
+ if (thresholds)
perkj_webrtc 2016/10/07 07:41:16 nit: {}
+ quality_scaler_.Init(this, thresholds->first, thresholds->second,
+ streams[0].max_framerate);
+ else
+ quality_scaler_.Init(this, codec_type_, streams[0].max_framerate);
perkj_webrtc 2016/10/07 07:41:16 {}
+
bool success = video_sender_.RegisterSendCodec(
&codec, number_of_cores_,
static_cast<uint32_t>(max_data_payload_length_)) == VCM_OK;
@@ -688,9 +697,10 @@ EncodedImageCallback::Result ViEEncoder::OnEncodedImage(
int64_t time_sent = clock_->TimeInMilliseconds();
uint32_t timestamp = encoded_image._timeStamp;
- encoder_queue_.PostTask([this, timestamp, time_sent] {
+ encoder_queue_.PostTask([this, timestamp, time_sent, encoded_image] {
RTC_DCHECK_RUN_ON(&encoder_queue_);
overuse_detector_.FrameSent(timestamp, time_sent);
+ quality_scaler_.ReportQP(encoded_image.qp_);
});
return result;
}
@@ -767,7 +777,7 @@ void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps,
}
}
-void ViEEncoder::OveruseDetected() {
+void ViEEncoder::ScaleDown() {
RTC_DCHECK_RUN_ON(&encoder_queue_);
if (disable_resolution_scaling_)
@@ -790,7 +800,7 @@ void ViEEncoder::OveruseDetected() {
}
}
-void ViEEncoder::NormalUsage() {
+void ViEEncoder::ScaleUp() {
RTC_DCHECK_RUN_ON(&encoder_queue_);
if (disable_resolution_scaling_)
return;

Powered by Google App Engine
This is Rietveld 408576698