OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/ipc_video_frame_capturer.h" | 5 #include "remoting/host/ipc_video_frame_capturer.h" |
6 | 6 |
7 #include "media/video/capture/screen/mouse_cursor_shape.h" | 7 #include "media/video/capture/screen/mouse_cursor_shape.h" |
8 #include "media/video/capture/screen/screen_capture_data.h" | |
9 #include "remoting/host/desktop_session_proxy.h" | 8 #include "remoting/host/desktop_session_proxy.h" |
9 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | |
10 | 10 |
11 namespace remoting { | 11 namespace remoting { |
12 | 12 |
13 IpcVideoFrameCapturer::IpcVideoFrameCapturer( | 13 IpcVideoFrameCapturer::IpcVideoFrameCapturer( |
14 scoped_refptr<DesktopSessionProxy> desktop_session_proxy) | 14 scoped_refptr<DesktopSessionProxy> desktop_session_proxy) |
15 : delegate_(NULL), | 15 : callback_(NULL), |
16 mouse_shape_observer_(NULL), | |
16 desktop_session_proxy_(desktop_session_proxy), | 17 desktop_session_proxy_(desktop_session_proxy), |
17 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 18 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
18 } | 19 } |
19 | 20 |
20 IpcVideoFrameCapturer::~IpcVideoFrameCapturer() { | 21 IpcVideoFrameCapturer::~IpcVideoFrameCapturer() { |
21 } | 22 } |
22 | 23 |
23 void IpcVideoFrameCapturer::Start(Delegate* delegate) { | 24 void IpcVideoFrameCapturer::Start(Callback* callback) { |
24 delegate_ = delegate; | 25 callback_ = callback; |
alexeypa (please no reviews)
2013/04/26 21:33:58
DCHECK(!callback_);
DCHECK(callback);
Sergey Ulanov
2013/05/07 22:25:50
Done.
| |
25 desktop_session_proxy_->SetVideoCapturer(weak_factory_.GetWeakPtr()); | 26 desktop_session_proxy_->SetVideoCapturer(weak_factory_.GetWeakPtr()); |
26 } | 27 } |
27 | 28 |
28 void IpcVideoFrameCapturer::CaptureFrame() { | 29 void IpcVideoFrameCapturer::SetMouseShapeObserver( |
30 MouseShapeObserver* mouse_shape_observer) { | |
31 mouse_shape_observer_ = mouse_shape_observer; | |
alexeypa (please no reviews)
2013/04/26 21:33:58
DCHECK(!mouse_shape_observer_);
DCHECK(mouse_shape
Sergey Ulanov
2013/05/07 22:25:50
Done.
| |
32 } | |
33 | |
34 void IpcVideoFrameCapturer::Capture(const webrtc::DesktopRegion& region) { | |
29 desktop_session_proxy_->CaptureFrame(); | 35 desktop_session_proxy_->CaptureFrame(); |
30 } | 36 } |
31 | 37 |
32 void IpcVideoFrameCapturer::OnCaptureCompleted( | 38 void IpcVideoFrameCapturer::OnCaptureCompleted( |
33 scoped_refptr<media::ScreenCaptureData> capture_data) { | 39 scoped_ptr<webrtc::DesktopFrame> frame) { |
34 if (delegate_) | 40 if (callback_) |
alexeypa (please no reviews)
2013/04/26 21:33:58
I think this check can be removed.
Sergey Ulanov
2013/05/07 22:25:50
Done.
| |
35 delegate_->OnCaptureCompleted(capture_data); | 41 callback_->OnCaptureCompleted(frame.release()); |
36 } | 42 } |
37 | 43 |
38 void IpcVideoFrameCapturer::OnCursorShapeChanged( | 44 void IpcVideoFrameCapturer::OnCursorShapeChanged( |
39 scoped_ptr<media::MouseCursorShape> cursor_shape) { | 45 scoped_ptr<media::MouseCursorShape> cursor_shape) { |
40 if (delegate_) | 46 if (mouse_shape_observer_) |
alexeypa (please no reviews)
2013/04/26 21:33:58
Can this be NULL?
Sergey Ulanov
2013/05/07 22:25:50
yes
| |
41 delegate_->OnCursorShapeChanged(cursor_shape.Pass()); | 47 mouse_shape_observer_->OnCursorShapeChanged(cursor_shape.Pass()); |
42 } | 48 } |
43 | 49 |
44 } // namespace remoting | 50 } // namespace remoting |
OLD | NEW |