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 #ifndef REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 5 #ifndef REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
6 #define REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 6 #define REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 13 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 class DesktopSessionProxy; | 17 class DesktopSessionProxy; |
18 | 18 |
19 // Routes webrtc::DesktopCapturer calls though the IPC channel to the desktop | 19 // Routes webrtc::DesktopCapturer calls though the IPC channel to the desktop |
20 // session agent running in the desktop integration process. | 20 // session agent running in the desktop integration process. |
| 21 // GetSourceList() and SelectSource() functions are not implemented, they always |
| 22 // return false. |
21 class IpcVideoFrameCapturer : public webrtc::DesktopCapturer { | 23 class IpcVideoFrameCapturer : public webrtc::DesktopCapturer { |
22 public: | 24 public: |
23 explicit IpcVideoFrameCapturer( | 25 explicit IpcVideoFrameCapturer( |
24 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); | 26 scoped_refptr<DesktopSessionProxy> desktop_session_proxy); |
25 ~IpcVideoFrameCapturer() override; | 27 ~IpcVideoFrameCapturer() override; |
26 | 28 |
27 // webrtc::DesktopCapturer interface. | 29 // webrtc::DesktopCapturer interface. |
28 void Start(Callback* callback) override; | 30 void Start(Callback* callback) override; |
29 void CaptureFrame() override; | 31 void CaptureFrame() override; |
| 32 bool GetSourceList(SourceList* sources) override; |
| 33 bool SelectSource(SourceId id) override; |
30 | 34 |
31 // Called when a video |frame| has been captured. | 35 // Called when a video |frame| has been captured. |
32 void OnCaptureResult(webrtc::DesktopCapturer::Result result, | 36 void OnCaptureResult(webrtc::DesktopCapturer::Result result, |
33 std::unique_ptr<webrtc::DesktopFrame> frame); | 37 std::unique_ptr<webrtc::DesktopFrame> frame); |
34 | 38 |
35 private: | 39 private: |
36 // Points to the callback passed to webrtc::DesktopCapturer::Start(). | 40 // Points to the callback passed to webrtc::DesktopCapturer::Start(). |
37 webrtc::DesktopCapturer::Callback* callback_; | 41 webrtc::DesktopCapturer::Callback* callback_; |
38 | 42 |
39 // Wraps the IPC channel to the desktop session agent. | 43 // Wraps the IPC channel to the desktop session agent. |
40 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; | 44 scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; |
41 | 45 |
42 // Set to true when a frame is being captured. | 46 // Set to true when a frame is being captured. |
43 bool capture_pending_; | 47 bool capture_pending_; |
44 | 48 |
45 // Used to cancel tasks pending on the capturer when it is stopped. | 49 // Used to cancel tasks pending on the capturer when it is stopped. |
46 base::WeakPtrFactory<IpcVideoFrameCapturer> weak_factory_; | 50 base::WeakPtrFactory<IpcVideoFrameCapturer> weak_factory_; |
47 | 51 |
48 DISALLOW_COPY_AND_ASSIGN(IpcVideoFrameCapturer); | 52 DISALLOW_COPY_AND_ASSIGN(IpcVideoFrameCapturer); |
49 }; | 53 }; |
50 | 54 |
51 } // namespace remoting | 55 } // namespace remoting |
52 | 56 |
53 #endif // REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ | 57 #endif // REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_ |
OLD | NEW |