In screenshare mode, suppress VP8 bitrate overshoot and increase quality
This change includes several improvements: * VP8 configured with new rate control * Detection of frame dropping, with qp bump for next frame * Increased target and TL0 bitrates * Reworked rate control (TL allocation) in screenshare_layers A note on performance: PSNR and SSIM is expected to get slightly worse with this cl. Frame drops and delays should however improve. BUG=4171 R=pbos@webrtc.org, stefan@webrtc.org Review URL: https://codereview.webrtc.org/1193513006. Cr-Commit-Position: refs/heads/master@{#9495}
This commit is contained in:
@ -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
|
||||
|
||||
@ -149,6 +149,7 @@ private:
|
||||
const bool internal_source_;
|
||||
mutable rtc::CriticalSection rates_lock_;
|
||||
VideoRotation rotation_;
|
||||
bool is_screenshare_;
|
||||
}; // end of VCMGenericEncoder class
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user