OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 DesktopAndCursorComposer::~DesktopAndCursorComposer() {} | 130 DesktopAndCursorComposer::~DesktopAndCursorComposer() {} |
131 | 131 |
132 void DesktopAndCursorComposer::Start(DesktopCapturer::Callback* callback) { | 132 void DesktopAndCursorComposer::Start(DesktopCapturer::Callback* callback) { |
133 callback_ = callback; | 133 callback_ = callback; |
134 if (mouse_monitor_.get()) | 134 if (mouse_monitor_.get()) |
135 mouse_monitor_->Init(this, MouseCursorMonitor::SHAPE_AND_POSITION); | 135 mouse_monitor_->Init(this, MouseCursorMonitor::SHAPE_AND_POSITION); |
136 desktop_capturer_->Start(this); | 136 desktop_capturer_->Start(this); |
137 } | 137 } |
138 | 138 |
| 139 void DesktopAndCursorComposer::SetSharedMemoryFactory( |
| 140 rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) { |
| 141 desktop_capturer_->SetSharedMemoryFactory(std::move(shared_memory_factory)); |
| 142 } |
| 143 |
139 void DesktopAndCursorComposer::Capture(const DesktopRegion& region) { | 144 void DesktopAndCursorComposer::Capture(const DesktopRegion& region) { |
140 if (mouse_monitor_.get()) | 145 if (mouse_monitor_.get()) |
141 mouse_monitor_->Capture(); | 146 mouse_monitor_->Capture(); |
142 desktop_capturer_->Capture(region); | 147 desktop_capturer_->Capture(region); |
143 } | 148 } |
144 | 149 |
145 void DesktopAndCursorComposer::SetExcludedWindow(WindowId window) { | 150 void DesktopAndCursorComposer::SetExcludedWindow(WindowId window) { |
146 desktop_capturer_->SetExcludedWindow(window); | 151 desktop_capturer_->SetExcludedWindow(window); |
147 } | 152 } |
148 | 153 |
149 SharedMemory* DesktopAndCursorComposer::CreateSharedMemory(size_t size) { | |
150 return callback_->CreateSharedMemory(size); | |
151 } | |
152 | |
153 void DesktopAndCursorComposer::OnCaptureCompleted(DesktopFrame* frame) { | 154 void DesktopAndCursorComposer::OnCaptureCompleted(DesktopFrame* frame) { |
154 if (frame && cursor_.get() && cursor_state_ == MouseCursorMonitor::INSIDE) { | 155 if (frame && cursor_.get() && cursor_state_ == MouseCursorMonitor::INSIDE) { |
155 DesktopFrameWithCursor* frame_with_cursor = | 156 DesktopFrameWithCursor* frame_with_cursor = |
156 new DesktopFrameWithCursor(frame, *cursor_, cursor_position_); | 157 new DesktopFrameWithCursor(frame, *cursor_, cursor_position_); |
157 frame = frame_with_cursor; | 158 frame = frame_with_cursor; |
158 } | 159 } |
159 | 160 |
160 callback_->OnCaptureCompleted(frame); | 161 callback_->OnCaptureCompleted(frame); |
161 } | 162 } |
162 | 163 |
163 void DesktopAndCursorComposer::OnMouseCursor(MouseCursor* cursor) { | 164 void DesktopAndCursorComposer::OnMouseCursor(MouseCursor* cursor) { |
164 cursor_.reset(cursor); | 165 cursor_.reset(cursor); |
165 } | 166 } |
166 | 167 |
167 void DesktopAndCursorComposer::OnMouseCursorPosition( | 168 void DesktopAndCursorComposer::OnMouseCursorPosition( |
168 MouseCursorMonitor::CursorState state, | 169 MouseCursorMonitor::CursorState state, |
169 const DesktopVector& position) { | 170 const DesktopVector& position) { |
170 cursor_state_ = state; | 171 cursor_state_ = state; |
171 cursor_position_ = position; | 172 cursor_position_ = position; |
172 } | 173 } |
173 | 174 |
174 } // namespace webrtc | 175 } // namespace webrtc |
OLD | NEW |