Index: webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h |
diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h |
index 169151975e04ab5a69c80380ce39fbfa1de596d6..119ffaecdfb0abac84436cca9caa33837129fa47 100644 |
--- a/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h |
+++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h |
@@ -13,23 +13,14 @@ |
#include "webrtc/modules/desktop_capture/screen_capturer.h" |
-#include <comdef.h> |
-#include <D3DCommon.h> |
-#include <D3D11.h> |
-#include <DXGI.h> |
-#include <DXGI1_2.h> |
-#include <windows.h> |
-#include <wrl/client.h> |
- |
#include <memory> |
#include <vector> |
-#include "webrtc/base/thread_annotations.h" |
#include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
-#include "webrtc/modules/desktop_capture/desktop_geometry.h" |
#include "webrtc/modules/desktop_capture/desktop_region.h" |
#include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" |
#include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
+#include "webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h" |
namespace webrtc { |
@@ -37,10 +28,8 @@ namespace webrtc { |
// implementation won't work when ScreenCaptureFrameQueue.kQueueLength is not 2. |
class ScreenCapturerWinDirectx : public ScreenCapturer { |
public: |
- // Initializes DirectX related components. Returns false if any error |
- // happened, any instance of this class won't be able to work in such status. |
- // Thread safe, guarded by initialize_lock. |
- static bool Initialize(); |
+ // Whether the system support DirectX based capturing. |
+ static bool IsSupported(); |
explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options); |
virtual ~ScreenCapturerWinDirectx(); |
@@ -53,48 +42,17 @@ class ScreenCapturerWinDirectx : public ScreenCapturer { |
bool SelectScreen(ScreenId id) override; |
private: |
- // Texture is a pair of an ID3D11Texture2D and an IDXGISurface. Refer to its |
- // implementation in source code for details. |
- class Texture; |
- |
- // An implementation of DesktopFrame to return data from a Texture instance. |
- class DxgiDesktopFrame; |
- |
- static bool DoInitialize(); |
- |
- // Initializes DxgiOutputDuplication. If current DxgiOutputDuplication |
- // instance is existing, this function takes no-op and returns true. Returns |
- // false if it fails to execute windows api. |
- static bool DuplicateOutput(); |
- |
- // Deprecates current DxgiOutputDuplication instance and calls DuplicateOutput |
- // to reinitialize it. |
- static bool ForceDuplicateOutput(); |
- |
- // Detects update regions in last frame, if anything wrong, returns false. |
- // ProcessFrame will insert a whole desktop size as updated region instead. |
- static bool DetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
- DesktopRegion* updated_region); |
+ // Returns desktop size of selected screen. |
+ DesktopSize SelectedDesktopSize() const; |
- // A helper function to handle _com_error result in DetectUpdatedRegion. |
- // Returns false if the _com_error shows an error. |
- static bool HandleDetectUpdatedRegionError(const _com_error& error, |
- const char* stage); |
- |
- // Processes one frame received from AcquireNextFrame function, returns a |
- // nullptr if anything wrong. |
- std::unique_ptr<DesktopFrame> ProcessFrame( |
- const DXGI_OUTDUPL_FRAME_INFO& frame_info, |
- IDXGIResource* resource); |
- |
- // A shortcut to execute callback with current frame in frames. |
- void EmitCurrentFrame(); |
- |
- ScreenCaptureFrameQueue<rtc::scoped_refptr<Texture>> surfaces_; |
ScreenCaptureFrameQueue<SharedDesktopFrame> frames_; |
std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; |
Callback* callback_ = nullptr; |
+ DxgiDuplicatorController::Context context_; |
+ |
+ ScreenId current_screen_id = kFullDesktopScreenId; |
+ |
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); |
}; |