Don't invalidate whole update_rect if buffer conversion didn't change any pixels

Bug: webrtc:10310,chromium:930186
Change-Id: Ib7c9937fc376cc6b0ce63538768623e9edbe221f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135123
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27859}
This commit is contained in:
Ilya Nikolaevskiy
2019-05-03 14:34:35 +02:00
committed by Commit Bot
parent e396276686
commit cfff652c82

View File

@ -1335,14 +1335,15 @@ void VideoStreamEncoder::EncodeVideoFrame(const VideoFrame& video_frame,
return;
}
// UpdatedRect is reset to full update if it's not empty, because buffer was
// converted, therefore we can't guarantee that pixels outside of UpdateRect
// didn't change comparing to the previous frame.
VideoFrame::UpdateRect update_rect =
out_frame.update_rect().IsEmpty()
? out_frame.update_rect()
: VideoFrame::UpdateRect{0, 0, out_frame.width(),
out_frame.height()};
VideoFrame::UpdateRect update_rect = out_frame.update_rect();
if (!update_rect.IsEmpty() &&
out_frame.video_frame_buffer()->GetI420() == nullptr) {
// UpdatedRect is reset to full update if it's not empty, and buffer was
// converted, therefore we can't guarantee that pixels outside of
// UpdateRect didn't change comparing to the previous frame.
update_rect =
VideoFrame::UpdateRect{0, 0, out_frame.width(), out_frame.height()};
}
out_frame = VideoFrame::Builder()
.set_video_frame_buffer(converted_buffer)