| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // This usually means we do not have enough memory or SharedMemoryFactory | 72 // This usually means we do not have enough memory or SharedMemoryFactory |
| 73 // cannot work correctly. | 73 // cannot work correctly. |
| 74 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); | 74 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 frames_.ReplaceCurrentFrame(SharedDesktopFrame::Wrap(std::move(new_frame))); | 77 frames_.ReplaceCurrentFrame(SharedDesktopFrame::Wrap(std::move(new_frame))); |
| 78 } | 78 } |
| 79 | 79 |
| 80 if (current_screen_id == kFullDesktopScreenId) { | 80 if (current_screen_id == kFullDesktopScreenId) { |
| 81 if (!DxgiDuplicatorController::Instance()->Duplicate( | 81 if (!DxgiDuplicatorController::Instance()->Duplicate( |
| 82 &context_, frames_.previous_frame(), frames_.current_frame())) { | 82 &context_, frames_.current_frame())) { |
| 83 // Screen size may be changed, so we need to reset the frames. | 83 // Screen size may be changed, so we need to reset the frames. |
| 84 frames_.Reset(); | 84 frames_.Reset(); |
| 85 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); | 85 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 } else { | 88 } else { |
| 89 if (!DxgiDuplicatorController::Instance()->DuplicateMonitor( | 89 if (!DxgiDuplicatorController::Instance()->DuplicateMonitor( |
| 90 &context_, current_screen_id, frames_.previous_frame(), | 90 &context_, current_screen_id, frames_.current_frame())) { |
| 91 frames_.current_frame())) { | |
| 92 // Screen size may be changed, so we need to reset the frames. | 91 // Screen size may be changed, so we need to reset the frames. |
| 93 frames_.Reset(); | 92 frames_.Reset(); |
| 94 if (current_screen_id >= | 93 if (current_screen_id >= |
| 95 DxgiDuplicatorController::Instance()->ScreenCount()) { | 94 DxgiDuplicatorController::Instance()->ScreenCount()) { |
| 96 // Current monitor has been removed from the system. | 95 // Current monitor has been removed from the system. |
| 97 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); | 96 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); |
| 98 } else { | 97 } else { |
| 99 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); | 98 callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); |
| 100 } | 99 } |
| 101 return; | 100 return; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 131 | 130 |
| 132 int screen_count = DxgiDuplicatorController::Instance()->ScreenCount(); | 131 int screen_count = DxgiDuplicatorController::Instance()->ScreenCount(); |
| 133 if (id >= 0 && id < screen_count) { | 132 if (id >= 0 && id < screen_count) { |
| 134 current_screen_id = id; | 133 current_screen_id = id; |
| 135 return true; | 134 return true; |
| 136 } | 135 } |
| 137 return false; | 136 return false; |
| 138 } | 137 } |
| 139 | 138 |
| 140 } // namespace webrtc | 139 } // namespace webrtc |
| OLD | NEW |