commit | 5acd9d0393260b63e80b435fed9e5024ea6f4498 | [log] [tgz] |
---|---|---|
author | Zijie He <zijiehe@chromium.org> | Thu Aug 24 12:41:53 2017 -0700 |
committer | Commit Bot <commit-bot@chromium.org> | Thu Aug 24 23:44:22 2017 +0000 |
tree | d52df0164ff68c2459c18dc36a374d1a5eb45b4f | |
parent | 2b706343de6f79839f46d12008ec3c8062bb94bc [diff] |
Add DesktopFrame::MoveFrameInfoFrom() and DesktopFrame::CopyFrameInfoFrom() The original change https://chromium-review.googlesource.com/c/575315 and https://chromium-review.googlesource.com/c/590508 have not been well-considered. So this change reverts part of two changes and adds a DesktopFrame::set_top_left() function A DesktopFrame usually contains a very large chunk of memory, which should be reused as much as possible to reduce the memory allocations. The size of the memory usually controls by the DesktopFrame::size(). So it's reasonable to const DesktopFrame::size_: changing it is wrong if the underly buffer is not large enough. But DesktopFrame::top_left() is a different story, same as capturer_id, capture_time_ms and other information in the DesktopFrame, it can be changed to any value without needing to reconstruct a DesktopFrame instance. So instead of adding it to the constructor, a DesktopFrame::set_top_left() is added to adjust the top-left of the DesktopFrame in the entire display coordinate. After adding DesktopFrame::set_top_left(), we have five variables in a DesktopFrame which is not initialized in the constructor. For any kind of wrapper DesktopFrame, say, SharedDesktopFrame and CroppedDesktopFrame, they needs to copy these five variables after constructing themselves. This is not convenient and easily to be broken if an implementation forgot to copy them. So DesktopFrame::MoveFrameInfoFrom() and DesktopFrame::CopyFrameInfoFrom() are added to the DesktopFrame to help derived classes to copy or move these variables in one function call. The difference between MoveFrameInfoFrom() and CopyFrameInfoFrom() is that the former one uses DesktopRegion::Swap() to move the DesktopRegion from the source DesktopFrame to this instance, while the later one uses copy-operator to copy the DesktopRegion from the source DesktopFrame. So CopyFrameInfoFrom() is usually used when sharing a source DesktopFrame with several clients. I.e. the source DesktopFrame should be kept unchanged. For example, BasicDesktopFrame::CopyOf() and SharedDesktopFrame::Share(). On the other side, MoveFrameInfoFrom() is usually used when wrapping a DesktopFrame. E.g. CroppedDesktopFrame and DesktopFrameWithCursor. Bug: webrtc:7950 Change-Id: I8b23418960fb681d2ea1f012d1b453f514da2272 Reviewed-on: https://chromium-review.googlesource.com/622453 Commit-Queue: Zijie He <zijiehe@chromium.org> Reviewed-by: Jamie Walch <jamiewalch@chromium.org> Cr-Commit-Position: refs/heads/master@{#19504}
WebRTC is a free, open software project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.
Our mission: To enable rich, high-quality RTC applications to be developed for the browser, mobile platforms, and IoT devices, and allow them all to communicate via a common set of protocols.
The WebRTC initiative is a project supported by Google, Mozilla and Opera, amongst others.
See http://www.webrtc.org/native-code/development for instructions on how to get started developing with the native code.