Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 bool DoDuplicateAll(Context* context, SharedDesktopFrame* target); | 151 bool DoDuplicateAll(Context* context, SharedDesktopFrame* target); |
| 152 | 152 |
| 153 // Captures one monitor. | 153 // Captures one monitor. |
| 154 bool DoDuplicateOne(Context* context, | 154 bool DoDuplicateOne(Context* context, |
| 155 int monitor_id, | 155 int monitor_id, |
| 156 SharedDesktopFrame* target); | 156 SharedDesktopFrame* target); |
| 157 | 157 |
| 158 // The minimum GetNumFramesCaptured() returned by |duplicators_|. | 158 // The minimum GetNumFramesCaptured() returned by |duplicators_|. |
| 159 int64_t GetNumFramesCaptured() const; | 159 int64_t GetNumFramesCaptured() const; |
| 160 | 160 |
| 161 // Returns a DesktopSize to cover entire desktop_rect. This may be different | 161 // Returns a DesktopSize to cover entire |desktop_rect_|. |
| 162 // than desktop_rect().size(), since top-left of the screen does not need to | |
| 163 // be started from (0, 0). | |
| 164 DesktopSize desktop_size() const; | 162 DesktopSize desktop_size() const; |
| 165 | 163 |
| 166 // Returns the size of one screen. |id| should be >= 0. If system does not | 164 // Returns the size of one screen. |id| should be >= 0. If system does not |
| 167 // support DXGI based capturer, or |id| is greater than the total screen count | 165 // support DXGI based capturer, or |id| is greater than the total screen count |
| 168 // of all the Duplicators, this function returns an empty DesktopRect. | 166 // of all the Duplicators, this function returns an empty DesktopRect. |
| 169 DesktopRect ScreenRect(int id) const; | 167 DesktopRect ScreenRect(int id) const; |
| 170 | 168 |
| 171 int ScreenCountUnlocked() const; | 169 int ScreenCountUnlocked() const; |
| 172 | 170 |
| 173 // Returns the desktop size of the selected screen |monitor_id|. Setting | 171 // Returns the desktop size of the selected screen |monitor_id|. Setting |
| 174 // |monitor_id| < 0 to return the entire screen size. | 172 // |monitor_id| < 0 to return the entire screen size. |
| 175 DesktopSize SelectedDesktopSize(int monitor_id) const; | 173 DesktopSize SelectedDesktopSize(int monitor_id) const; |
| 176 | 174 |
| 177 // Retries DoDuplicateAll() for several times until GetNumFramesCaptured() is | 175 // Retries DoDuplicateAll() for several times until GetNumFramesCaptured() is |
| 178 // large enough. Returns false if DoDuplicateAll() returns false, or | 176 // large enough. Returns false if DoDuplicateAll() returns false, or |
| 179 // GetNumFramesCaptured() has never reached the requirement. | 177 // GetNumFramesCaptured() has never reached the requirement. |
| 180 // According to http://crbug.com/682112, dxgi capturer returns a black frame | 178 // According to http://crbug.com/682112, dxgi capturer returns a black frame |
| 181 // during first several capture attempts. | 179 // during first several capture attempts. |
| 182 bool EnsureFrameCaptured(Context* context, SharedDesktopFrame* target); | 180 bool EnsureFrameCaptured(Context* context, SharedDesktopFrame* target); |
| 183 | 181 |
| 182 // Moves |desktop_rect_| and all underlying |duplicators_| to (0, 0). | |
| 183 // DXGI_OUTPUT_DESC may return negative values in DesktopCoordinate, which is | |
| 184 // not consistent with the requirement of DesktopFrame. But we cannot get the | |
| 185 // size of desktop without initializing all the DxgiAdapterDuplicator and | |
| 186 // DxgiOutputDuplicator instances. So this is a helper function to "move" the | |
| 187 // entire screen from any quadrant to (0, 0). This function is expected to be | |
| 188 // executed in DoInitialize() only. | |
|
Sergey Ulanov
2017/04/28 01:15:02
Suggest rewording it a bit to simplify:
// Move
Hzj_jie
2017/04/28 01:58:32
Done.
| |
| 189 // This comment makes this piece of logic deserve a standalone function. | |
|
Sergey Ulanov
2017/04/28 01:15:02
I don't think you need this sentence.
Hzj_jie
2017/04/28 01:58:32
Done.
| |
| 190 void Translate(); | |
|
Sergey Ulanov
2017/04/28 01:15:02
TranslateDesktopRect()?
Hzj_jie
2017/04/28 01:58:32
Done.
| |
| 191 | |
| 184 // This lock must be locked whenever accessing any of the following objects. | 192 // This lock must be locked whenever accessing any of the following objects. |
| 185 rtc::CriticalSection lock_; | 193 rtc::CriticalSection lock_; |
| 186 | 194 |
| 187 // A self-incremented integer to compare with the one in Context. It ensures | 195 // A self-incremented integer to compare with the one in Context. It ensures |
| 188 // a Context instance is always initialized after DxgiDuplicatorController. | 196 // a Context instance is always initialized after DxgiDuplicatorController. |
| 189 int identity_ = 0; | 197 int identity_ = 0; |
| 190 DesktopRect desktop_rect_; | 198 DesktopRect desktop_rect_; |
| 191 DesktopVector dpi_; | 199 DesktopVector dpi_; |
| 192 std::vector<DxgiAdapterDuplicator> duplicators_; | 200 std::vector<DxgiAdapterDuplicator> duplicators_; |
| 193 D3dInfo d3d_info_; | 201 D3dInfo d3d_info_; |
| 194 ResolutionChangeDetector resolution_change_detector_; | 202 ResolutionChangeDetector resolution_change_detector_; |
| 195 }; | 203 }; |
| 196 | 204 |
| 197 } // namespace webrtc | 205 } // namespace webrtc |
| 198 | 206 |
| 199 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ | 207 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_DXGI_DUPLICATOR_CONTROLLER_H_ |
| OLD | NEW |