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

Unified Diff: webrtc/modules/video_coding/main/source/generic_encoder.cc

Issue 1193513006: In screenshare mode, suppress VP8 bitrate overshoot and increase quality (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 5 years, 6 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
« no previous file with comments | « webrtc/modules/video_coding/main/source/generic_encoder.h ('k') | webrtc/video/full_stack.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/main/source/generic_encoder.cc
diff --git a/webrtc/modules/video_coding/main/source/generic_encoder.cc b/webrtc/modules/video_coding/main/source/generic_encoder.cc
index 109150101f1a965b7a7982693191e9cd89ac25d8..f2cdd599ae85ef8c3104ec6e3653ddc8658175f9 100644
--- a/webrtc/modules/video_coding/main/source/generic_encoder.cc
+++ b/webrtc/modules/video_coding/main/source/generic_encoder.cc
@@ -60,7 +60,8 @@ VCMGenericEncoder::VCMGenericEncoder(VideoEncoder* encoder,
bit_rate_(0),
frame_rate_(0),
internal_source_(internalSource),
- rotation_(kVideoRotation_0) {
+ rotation_(kVideoRotation_0),
+ is_screenshare_(false) {
}
VCMGenericEncoder::~VCMGenericEncoder()
@@ -90,6 +91,7 @@ VCMGenericEncoder::InitEncode(const VideoCodec* settings,
frame_rate_ = settings->maxFramerate;
}
+ is_screenshare_ = settings->mode == VideoCodecMode::kScreensharing;
if (encoder_->InitEncode(settings, numberOfCores, maxPayloadSize) != 0) {
LOG(LS_ERROR) << "Failed to initialize the encoder associated with "
"payload name: " << settings->plName;
@@ -114,7 +116,15 @@ int32_t VCMGenericEncoder::Encode(const VideoFrame& inputFrame,
vcm_encoded_frame_callback_->SetRotation(rotation_);
}
- return encoder_->Encode(inputFrame, codecSpecificInfo, &video_frame_types);
+ int32_t result =
+ encoder_->Encode(inputFrame, codecSpecificInfo, &video_frame_types);
+ if (is_screenshare_ &&
+ result == WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT) {
+ // Target bitrate exceeded, encoder state has been reset - try again.
+ return encoder_->Encode(inputFrame, codecSpecificInfo, &video_frame_types);
+ }
+
+ return result;
}
int32_t
« no previous file with comments | « webrtc/modules/video_coding/main/source/generic_encoder.h ('k') | webrtc/video/full_stack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698