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; return;
} }
// UpdatedRect is reset to full update if it's not empty, because buffer was VideoFrame::UpdateRect update_rect = out_frame.update_rect();
// converted, therefore we can't guarantee that pixels outside of UpdateRect if (!update_rect.IsEmpty() &&
// didn't change comparing to the previous frame. out_frame.video_frame_buffer()->GetI420() == nullptr) {
VideoFrame::UpdateRect update_rect = // UpdatedRect is reset to full update if it's not empty, and buffer was
out_frame.update_rect().IsEmpty() // converted, therefore we can't guarantee that pixels outside of
? out_frame.update_rect() // UpdateRect didn't change comparing to the previous frame.
: VideoFrame::UpdateRect{0, 0, out_frame.width(), update_rect =
out_frame.height()}; VideoFrame::UpdateRect{0, 0, out_frame.width(), out_frame.height()};
}
out_frame = VideoFrame::Builder() out_frame = VideoFrame::Builder()
.set_video_frame_buffer(converted_buffer) .set_video_frame_buffer(converted_buffer)