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

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

Issue 2788863006: Merge ScreenCapturerWinDirectx::frames_ and contexts_ (Closed)
Patch Set: Resolve review comments Created 3 years, 8 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
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_FRAME_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_FRAME_H_
13
14 #include <memory>
15 #include <vector>
16
17 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
18 #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
19 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
20 #include "webrtc/modules/desktop_capture/resolution_change_detector.h"
21 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
22 #include "webrtc/modules/desktop_capture/shared_memory.h"
23 #include "webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.h"
24
25 namespace webrtc {
26
27 class DxgiDuplicatorController;
28
29 // A pair of a SharedDesktopFrame and a DxgiDuplicatorController::Context for
30 // the client of DxgiDuplicatorController.
31 class DxgiFrame final {
32 public:
33 // DxgiFrame does not take ownership of |factory|, consumers should ensure it
34 // outlives this instance. nullptr is acceptable.
35 explicit DxgiFrame(SharedMemoryFactory* factory);
36 ~DxgiFrame();
37
38 // Should not be called if Prepare() is not executed or returns false.
39 SharedDesktopFrame* frame() const;
40
41 private:
42 // A Context to store the status of a single DxgiFrame of
43 // DxgiDuplicatorController.
44 struct Context final {
Sergey Ulanov 2017/04/18 23:39:09 Looking at the there Context classes we have I thi
Hzj_jie 2017/04/19 04:35:54 Merging the DesktopRegion into one will cause the
45 public:
46 Context();
47 // Unregister this Context instance from DxgiDuplicatorController during
48 // destructing.
49 ~Context();
50
51 // Reset current Context, so it will be reinitialized next time.
52 void Reset();
53
54 // A Context will have an exactly same |identity_| as
55 // DxgiDuplicatorController, to ensure it has been correctly setted up after
56 // each DxgiDuplicatorController::Initialize().
57 int identity = 0;
Sergey Ulanov 2017/04/18 23:39:09 maybe call it controller_id?
Hzj_jie 2017/04/19 04:35:54 Done.
58
59 // Child DxgiAdapterDuplicator::Context belongs to this Context.
60 std::vector<DxgiAdapterDuplicator::Context> contexts;
61 };
62
63 // Allows DxgiDuplicatorController to access Prepare() and context() function
64 // as well as Context class.
65 friend class DxgiDuplicatorController;
66
67 // Prepares current instance with desktop size and source id.
68 bool Prepare(DesktopSize size, DesktopCapturer::SourceId source_id);
69
70 // Should not be called if Prepare() is not executed or returns false.
71 Context* context();
72
73 SharedMemoryFactory* const factory_;
74 ResolutionChangeDetector resolution_change_detector_;
75 DesktopCapturer::SourceId source_id_ = kFullDesktopScreenId;
76 std::unique_ptr<SharedDesktopFrame> frame_;
77 Context context_;
78 };
79
80 } // namespace webrtc
81
82 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698