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

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: 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:
31 // Whether the system supports DirectX based capturing. 32 // Whether the system supports DirectX based capturing.
32 static bool IsSupported(); 33 static bool IsSupported();
33 34
35 // Each video adapter has its own D3D_FEATURE_LEVEL, so this function
36 // retrieves the minimum and maximium D3D_FEATURE_LEVELs current system
37 // supports. This function implicitly calls
38 // DxgiDuplicatorController::Initialize() if it has not been initialized. This
39 // function returns false and both output parameters are kept unchanged if
40 // DxgiDuplicatorController::Initialize() failed. Both |min_feature_level| and
41 // |max_feature_level| can be nullptr.
42 static bool SupportedFeatureLevels(D3D_FEATURE_LEVEL* min_feature_level,
Sergey Ulanov 2016/11/07 19:37:16 Maybe we should expose some other hardware info he
Hzj_jie 2016/11/08 01:25:40 Yes, I have added a D3dInfo structure for further
43 D3D_FEATURE_LEVEL* max_feature_level);
44
34 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options); 45 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options);
35 46
36 ~ScreenCapturerWinDirectx() override; 47 ~ScreenCapturerWinDirectx() override;
37 48
38 void Start(Callback* callback) override; 49 void Start(Callback* callback) override;
39 void SetSharedMemoryFactory( 50 void SetSharedMemoryFactory(
40 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; 51 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override;
41 void CaptureFrame() override; 52 void CaptureFrame() override;
42 bool GetScreenList(ScreenList* screens) override; 53 bool GetScreenList(ScreenList* screens) override;
43 bool SelectScreen(ScreenId id) override; 54 bool SelectScreen(ScreenId id) override;
44 55
45 private: 56 private:
46 // Returns desktop size of selected screen. 57 // Returns desktop size of selected screen.
47 DesktopSize SelectedDesktopSize() const; 58 DesktopSize SelectedDesktopSize() const;
48 59
49 ScreenCaptureFrameQueue<SharedDesktopFrame> frames_; 60 ScreenCaptureFrameQueue<SharedDesktopFrame> frames_;
50 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; 61 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
51 Callback* callback_ = nullptr; 62 Callback* callback_ = nullptr;
52 63
53 DxgiDuplicatorController::Context context_; 64 DxgiDuplicatorController::Context context_;
54 65
55 ScreenId current_screen_id_ = kFullDesktopScreenId; 66 ScreenId current_screen_id_ = kFullDesktopScreenId;
56 67
57 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); 68 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx);
58 }; 69 };
59 70
60 } // namespace webrtc 71 } // namespace webrtc
61 72
62 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ 73 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698