Fixing a buffer copy issue in DesktopFrame

This CL fixes a buffer copying issue introduced in this CL:
https://webrtc-review.googlesource.com/c/src/+/196485

In the BasicDesktopFrame::CopyOf function, the src and dst params
were swapped.  For me this manifested as a missing cursor when using
Chrome Remote Desktop.  I don't know of any other bugs this caused
but I have to assume it affects all callers of the function given
that the copy will never occur.

Bug: chromium:1197210
Change-Id: I076bffbad1d658b1c6f4b0dffea17d339c867bef
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214840
Commit-Queue: Joe Downing <joedow@google.com>
Commit-Queue: Jamie Walch <jamiewalch@chromium.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#33672}
This commit is contained in:
Joe Downing 2021-04-09 12:34:35 -07:00 committed by Commit Bot
parent fc5d2762f5
commit f2f9bb66ca

View File

@ -157,8 +157,8 @@ BasicDesktopFrame::~BasicDesktopFrame() {
// static
DesktopFrame* BasicDesktopFrame::CopyOf(const DesktopFrame& frame) {
DesktopFrame* result = new BasicDesktopFrame(frame.size());
libyuv::CopyPlane(result->data(), result->stride(), frame.data(),
frame.stride(), frame.size().width() * kBytesPerPixel,
libyuv::CopyPlane(frame.data(), frame.stride(), result->data(),
result->stride(), frame.size().width() * kBytesPerPixel,
frame.size().height());
result->CopyFrameInfoFrom(frame);
return result;