Chromium Code Reviews| Index: webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h |
| diff --git a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h |
| index 31fb32ab9e53fb22bc9f674c5f86c645bd2cf609..42756249eeb3484c535c7526eae3427961d2467c 100644 |
| --- a/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h |
| +++ b/webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h |
| @@ -21,9 +21,9 @@ |
| #include "webrtc/base/criticalsection.h" |
| #include "webrtc/base/thread_annotations.h" |
| -#include "webrtc/modules/desktop_capture/desktop_frame.h" |
| #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
| #include "webrtc/modules/desktop_capture/desktop_region.h" |
| +#include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
| #include "webrtc/modules/desktop_capture/win/d3d_device.h" |
| #include "webrtc/modules/desktop_capture/win/dxgi_texture.h" |
| @@ -60,17 +60,14 @@ class DxgiOutputDuplicator { |
| // Copies the content of current IDXGIOutput to the |target|. To improve the |
| // performance, this function copies only regions merged from |
| - // |last_frame|.updated_region and DetectUpdatedRegion(). The |offset| decides |
| - // the |
| - // offset in the |target| where the content should be copied to. i.e. this |
| + // |context|->updated_region and DetectUpdatedRegion(). The |offset| decides |
| + // the offset in the |target| where the content should be copied to. i.e. this |
| // function copies the content to the rectangle of (offset.x(), offset.y()) to |
| // (offset.x() + desktop_rect_.width(), offset.y() + desktop_rect_.height()). |
| - // The |last_frame| is always expected to be translated by the same offset. |
| // Returns false in case of a failure. |
| bool Duplicate(Context* context, |
| - const DesktopFrame* last_frame, |
| - const DesktopVector offset, |
| - DesktopFrame* target); |
| + const DesktopVector& offset, |
|
Sergey Ulanov
2016/09/02 23:57:35
Don't need &. DesktopVector is small, just 8 bytes
Hzj_jie
2016/09/05 21:24:22
I used to use const to ensure this parameter won't
|
| + SharedDesktopFrame* target); |
| // Returns the desktop rect covered by this DxgiOutputDuplicator. |
| DesktopRect desktop_rect() const { return desktop_rect_; } |
| @@ -82,7 +79,7 @@ class DxgiOutputDuplicator { |
| // function will set the |updated_region| as entire DesktopRect starts from |
| // offset if it failed to execute Windows APIs. |
| void DetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
| - const DesktopVector offset, |
| + const DesktopVector& offset, |
| DesktopRegion* updated_region); |
| // Returns untranslated updated region, which are directly returned by Windows |
| @@ -98,7 +95,7 @@ class DxgiOutputDuplicator { |
| // Returns a DesktopRect with the same size of desktop_size_, but translated |
| // by offset. |
| - DesktopRect TranslatedDesktopRect(const DesktopVector offset); |
| + DesktopRect TranslatedDesktopRect(const DesktopVector& offset); |
| void Setup(Context* context); |
| @@ -108,6 +105,12 @@ class DxgiOutputDuplicator { |
| // contexts_. |
| void SpreadContextChange(const Context* const context); |
| + // Returns a DesktopRect in the coordinate of |texture_|->AsDesktopFrame(). |
| + DesktopRect SourceRect(DesktopRect rect); |
| + |
| + // Returns a DesktopRect in the coordinate of |offset|. |
| + DesktopRect TargetRect(DesktopRect rect, DesktopVector offset); |
| + |
| const D3dDevice& device_; |
| const Microsoft::WRL::ComPtr<IDXGIOutput1> output_; |
| const DesktopRect desktop_rect_; |
| @@ -121,6 +124,12 @@ class DxgiOutputDuplicator { |
| // change this time. And during next Duplicate() function call, their |
| // updated_region_ will be merged and copied. |
| std::vector<Context*> contexts_; |
| + |
| + // The last full frame of this output and its offset. If on AcquireNextFrame() |
| + // failed because of timeout, i.e. no update, we can copy content from |
| + // |last_frame_|. |
| + std::unique_ptr<SharedDesktopFrame> last_frame_; |
| + DesktopVector last_frame_offset_; |
| }; |
| } // namespace webrtc |