Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Unified Diff: webrtc/modules/desktop_capture/win/dxgi_output_duplicator.h

Issue 2299663003: [WebRTC] Two DirectX capturers cannot work concurrently (Closed)
Patch Set: Sync latest changes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..020ca640edba19769610ce5dae4beea487e32110 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);
+ DesktopVector offset,
+ 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,
+ 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(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

Powered by Google App Engine
This is Rietveld 408576698