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

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

Issue 2933893003: Add reference counter of DxgiDuplicatorController to unload DXGI components (Closed)
Patch Set: unique_ptr -> scoped_refptr Created 3 years, 6 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 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
(...skipping 12 matching lines...) Expand all
23 #include "webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h" 23 #include "webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.h"
24 #include "webrtc/modules/desktop_capture/win/dxgi_frame.h" 24 #include "webrtc/modules/desktop_capture/win/dxgi_frame.h"
25 25
26 namespace webrtc { 26 namespace webrtc {
27 27
28 // ScreenCapturerWinDirectx captures 32bit RGBA using DirectX. 28 // ScreenCapturerWinDirectx captures 32bit RGBA using DirectX.
29 class ScreenCapturerWinDirectx : public DesktopCapturer { 29 class ScreenCapturerWinDirectx : public DesktopCapturer {
30 public: 30 public:
31 using D3dInfo = DxgiDuplicatorController::D3dInfo; 31 using D3dInfo = DxgiDuplicatorController::D3dInfo;
32 32
33 // Deprecated: use "IsAvailable()" instead.
34 static bool IsSupported();
35
36 // Deprecated: use "GetD3dInfo()" instead.
37 static bool RetrieveD3dInfo(D3dInfo* info);
38
39 explicit ScreenCapturerWinDirectx();
40
41 ~ScreenCapturerWinDirectx() override;
42
33 // Whether the system supports DirectX based capturing. 43 // Whether the system supports DirectX based capturing.
34 static bool IsSupported(); 44 bool IsAvailable() const;
35 45
36 // Returns a most recent D3dInfo composed by 46 // Returns a most recent D3dInfo composed by
37 // DxgiDuplicatorController::Initialize() function. This function implicitly 47 // DxgiDuplicatorController::Initialize() function. This function implicitly
38 // calls DxgiDuplicatorController::Initialize() if it has not been 48 // calls DxgiDuplicatorController::Initialize() if it has not been
39 // initialized. This function returns false and output parameter is kept 49 // initialized. This function returns false and output parameter is kept
40 // unchanged if DxgiDuplicatorController::Initialize() failed. 50 // unchanged if DxgiDuplicatorController::Initialize() failed.
41 // The D3dInfo may change based on hardware configuration even without 51 // The D3dInfo may change based on hardware configuration even without
42 // restarting the hardware and software. Refer to https://goo.gl/OOCppq. So 52 // restarting the hardware and software. Refer to https://goo.gl/OOCppq. So
43 // consumers should not cache the result returned by this function. 53 // consumers should not cache the result returned by this function.
44 static bool RetrieveD3dInfo(D3dInfo* info); 54 bool GetD3dInfo(D3dInfo* info) const;
45 55
46 explicit ScreenCapturerWinDirectx(const DesktopCaptureOptions& options); 56 // DesktopCapturer implementation.
47
48 ~ScreenCapturerWinDirectx() override;
49
50 void Start(Callback* callback) override; 57 void Start(Callback* callback) override;
51 void SetSharedMemoryFactory( 58 void SetSharedMemoryFactory(
52 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; 59 std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override;
53 void CaptureFrame() override; 60 void CaptureFrame() override;
54 bool GetSourceList(SourceList* sources) override; 61 bool GetSourceList(SourceList* sources) override;
55 bool SelectSource(SourceId id) override; 62 bool SelectSource(SourceId id) override;
56 63
57 private: 64 private:
65 const DxgiDuplicatorController::Reference controller_;
58 ScreenCaptureFrameQueue<DxgiFrame> frames_; 66 ScreenCaptureFrameQueue<DxgiFrame> frames_;
59 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; 67 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
60 Callback* callback_ = nullptr; 68 Callback* callback_ = nullptr;
61 SourceId current_screen_id_ = kFullDesktopScreenId; 69 SourceId current_screen_id_ = kFullDesktopScreenId;
62 70
63 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); 71 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx);
64 }; 72 };
65 73
66 } // namespace webrtc 74 } // namespace webrtc
67 75
68 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_ 76 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_DIRECTX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698