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

Side by Side Diff: webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h

Issue 2468083002: Remove the requirement of D3D_FEATURE_LEVEL_11_0, but export the D3D_FEATURE_LEVEL through APIs (Closed)
Patch Set: Resolve review comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_
13 13
14 #include "webrtc/modules/desktop_capture/screen_capturer.h" 14 #include "webrtc/modules/desktop_capture/screen_capturer.h"
15 15
16 #include <D3DCommon.h>
17
16 #include <memory> 18 #include <memory>
17 #include <vector> 19 #include <vector>
18 20
19 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" 21 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
20 #include "webrtc/modules/desktop_capture/desktop_region.h" 22 #include "webrtc/modules/desktop_capture/desktop_region.h"
21 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" 23 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h"
22 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" 24 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
23 #include "webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h" 25 #include "webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h"
24 26
25 namespace webrtc { 27 namespace webrtc {
26 28
27 // ScreenCapturerWinDirectx captures 32bit RGBA using DirectX. This 29 // ScreenCapturerWinDirectx captures 32bit RGBA using DirectX.
28 // implementation won't work when ScreenCaptureFrameQueue.kQueueLength is not 2.
29 class ScreenCapturerWinDirectx : public ScreenCapturer { 30 class ScreenCapturerWinDirectx : public ScreenCapturer {
30 public: 31 public:
32 using D3dInfo = DxgiDuplicatorController::D3dInfo;
33
31 // Whether the system supports DirectX based capturing. 34 // Whether the system supports DirectX based capturing.
32 static bool IsSupported(); 35 static bool IsSupported();
33 36
37 // Returns a most recent D3dInfo composed by
38 // DxgiDuplicatorController::Initialize() function. This function implicitly
39 // calls DxgiDuplicatorController::Initialize() if it has not been
40 // initialized. This function returns false and output parameter is kept
41 // unchanged if DxgiDuplicatorController::Initialize() failed.
42 // The D3dInfo may change based on hardware configuration even without
43 // restarting the hardware and software. Refer to https://goo.gl/OOCppq. So
44 // consumers should not cache the result returned by this function.
45 static bool RetrieveD3dInfo(D3dInfo* info);
46
34 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options); 47 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options);
35 48
36 ~ScreenCapturerWinDirectx() override; 49 ~ScreenCapturerWinDirectx() override;
37 50
38 void Start(Callback* callback) override; 51 void Start(Callback* callback) override;
39 void SetSharedMemoryFactory( 52 void SetSharedMemoryFactory(
40 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; 53 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override;
41 void CaptureFrame() override; 54 void CaptureFrame() override;
42 bool GetScreenList(ScreenList* screens) override; 55 bool GetScreenList(ScreenList* screens) override;
43 bool SelectScreen(ScreenId id) override; 56 bool SelectScreen(ScreenId id) override;
44 57
45 private: 58 private:
46 // Returns desktop size of selected screen. 59 // Returns desktop size of selected screen.
47 DesktopSize SelectedDesktopSize() const; 60 DesktopSize SelectedDesktopSize() const;
48 61
49 ScreenCaptureFrameQueue<SharedDesktopFrame> frames_; 62 ScreenCaptureFrameQueue<SharedDesktopFrame> frames_;
50 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; 63 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
51 Callback* callback_ = nullptr; 64 Callback* callback_ = nullptr;
52 65
53 DxgiDuplicatorController::Context context_; 66 DxgiDuplicatorController::Context context_;
54 67
55 ScreenId current_screen_id_ = kFullDesktopScreenId; 68 ScreenId current_screen_id_ = kFullDesktopScreenId;
56 69
57 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); 70 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx);
58 }; 71 };
59 72
60 } // namespace webrtc 73 } // namespace webrtc
61 74
62 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ 75 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698