Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: webrtc/modules/desktop_capture/desktop_and_cursor_composer.h

Issue 1678073003: Cleanup shared memory handling in DesktopCapturer interface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_ 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_ 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
13 13
14 #include "webrtc/base/scoped_ptr.h" 14 #include "webrtc/base/scoped_ptr.h"
15 #include "webrtc/modules/desktop_capture/desktop_capturer.h" 15 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
16 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h" 16 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
17 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 // A wrapper for DesktopCapturer that also captures mouse using specified 20 // A wrapper for DesktopCapturer that also captures mouse using specified
21 // MouseCursorMonitor and renders it on the generated streams. 21 // MouseCursorMonitor and renders it on the generated streams.
22 class DesktopAndCursorComposer : public DesktopCapturer, 22 class DesktopAndCursorComposer : public DesktopCapturer,
23 public DesktopCapturer::Callback, 23 public DesktopCapturer::Callback,
24 public MouseCursorMonitor::Callback { 24 public MouseCursorMonitor::Callback {
25 public: 25 public:
26 // Creates a new blender that captures mouse cursor using |mouse_monitor| and 26 // Creates a new blender that captures mouse cursor using |mouse_monitor| and
27 // renders it into the frames generated by |desktop_capturer|. If 27 // renders it into the frames generated by |desktop_capturer|. If
28 // |mouse_monitor| is NULL the frames are passed unmodified. Takes ownership 28 // |mouse_monitor| is NULL the frames are passed unmodified. Takes ownership
29 // of both arguments. 29 // of both arguments.
30 DesktopAndCursorComposer(DesktopCapturer* desktop_capturer, 30 DesktopAndCursorComposer(DesktopCapturer* desktop_capturer,
31 MouseCursorMonitor* mouse_monitor); 31 MouseCursorMonitor* mouse_monitor);
32 virtual ~DesktopAndCursorComposer(); 32 virtual ~DesktopAndCursorComposer();
33 33
34 // DesktopCapturer interface. 34 // DesktopCapturer interface.
35 void Start(DesktopCapturer::Callback* callback) override; 35 void Start(DesktopCapturer::Callback* callback) override;
36 void SetSharedMemoryFactory(
37 rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) override;
36 void Capture(const DesktopRegion& region) override; 38 void Capture(const DesktopRegion& region) override;
37 void SetExcludedWindow(WindowId window) override; 39 void SetExcludedWindow(WindowId window) override;
38 40
39 private: 41 private:
40 // DesktopCapturer::Callback interface. 42 // DesktopCapturer::Callback interface.
41 SharedMemory* CreateSharedMemory(size_t size) override;
42 void OnCaptureCompleted(DesktopFrame* frame) override; 43 void OnCaptureCompleted(DesktopFrame* frame) override;
43 44
44 // MouseCursorMonitor::Callback interface. 45 // MouseCursorMonitor::Callback interface.
45 void OnMouseCursor(MouseCursor* cursor) override; 46 void OnMouseCursor(MouseCursor* cursor) override;
46 void OnMouseCursorPosition(MouseCursorMonitor::CursorState state, 47 void OnMouseCursorPosition(MouseCursorMonitor::CursorState state,
47 const DesktopVector& position) override; 48 const DesktopVector& position) override;
48 49
49 rtc::scoped_ptr<DesktopCapturer> desktop_capturer_; 50 rtc::scoped_ptr<DesktopCapturer> desktop_capturer_;
50 rtc::scoped_ptr<MouseCursorMonitor> mouse_monitor_; 51 rtc::scoped_ptr<MouseCursorMonitor> mouse_monitor_;
51 52
52 DesktopCapturer::Callback* callback_; 53 DesktopCapturer::Callback* callback_;
53 54
54 rtc::scoped_ptr<MouseCursor> cursor_; 55 rtc::scoped_ptr<MouseCursor> cursor_;
55 MouseCursorMonitor::CursorState cursor_state_; 56 MouseCursorMonitor::CursorState cursor_state_;
56 DesktopVector cursor_position_; 57 DesktopVector cursor_position_;
57 58
58 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopAndCursorComposer); 59 RTC_DISALLOW_COPY_AND_ASSIGN(DesktopAndCursorComposer);
59 }; 60 };
60 61
61 } // namespace webrtc 62 } // namespace webrtc
62 63
63 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_ 64 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698