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

Side by Side Diff: webrtc/modules/desktop_capture/desktop_capturer.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_CAPTURER_H_ 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_
13 13
14 #include <stddef.h> 14 #include <stddef.h>
15 15
16 #include "webrtc/base/scoped_ptr.h"
16 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" 17 #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
18 #include "webrtc/modules/desktop_capture/shared_memory.h"
17 19
18 namespace webrtc { 20 namespace webrtc {
19 21
20 class DesktopFrame; 22 class DesktopFrame;
21 class DesktopRegion; 23 class DesktopRegion;
22 class SharedMemory;
23 24
24 // Abstract interface for screen and window capturers. 25 // Abstract interface for screen and window capturers.
25 class DesktopCapturer { 26 class DesktopCapturer {
26 public: 27 public:
27 // Interface that must be implemented by the DesktopCapturer consumers. 28 // Interface that must be implemented by the DesktopCapturer consumers.
28 class Callback { 29 class Callback {
29 public: 30 public:
30 // Creates a new shared memory buffer for a frame create by the capturer. 31 // Deprecated.
31 // Should return null shared memory is not used for captured frames (in that 32 // TODO(sergeyu): Remove this method once all references to it are removed
32 // case the capturer will allocate memory on the heap). 33 // from chromium.
33 virtual SharedMemory* CreateSharedMemory(size_t size) = 0; 34 virtual SharedMemory* CreateSharedMemory(size_t size) { return nullptr; }
34 35
35 // Called after a frame has been captured. Handler must take ownership of 36 // Called after a frame has been captured. Handler must take ownership of
36 // |frame|. If capture has failed for any reason |frame| is set to NULL 37 // |frame|. If capture has failed for any reason |frame| is set to NULL
37 // (e.g. the window has been closed). 38 // (e.g. the window has been closed).
38 virtual void OnCaptureCompleted(DesktopFrame* frame) = 0; 39 virtual void OnCaptureCompleted(DesktopFrame* frame) = 0;
39 40
40 protected: 41 protected:
41 virtual ~Callback() {} 42 virtual ~Callback() {}
42 }; 43 };
43 44
44 virtual ~DesktopCapturer() {} 45 virtual ~DesktopCapturer() {}
45 46
46 // Called at the beginning of a capturing session. |callback| must remain 47 // Called at the beginning of a capturing session. |callback| must remain
47 // valid until capturer is destroyed. 48 // valid until capturer is destroyed.
48 virtual void Start(Callback* callback) = 0; 49 virtual void Start(Callback* callback) = 0;
49 50
51 // Sets SharedMemoryFactory that will be used to create buffers for the
52 // captured frames. The factory can be invoked on a thread other than the one
53 // where Capture() is called. It will be destroyed on the same thread. Shared
54 // memory is currently supported only by some DesktopCapturer implementations.
55 virtual void SetSharedMemoryFactory(
56 rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) {}
57
50 // Captures next frame. |region| specifies region of the capture target that 58 // Captures next frame. |region| specifies region of the capture target that
51 // should be fresh in the resulting frame. The frame may also include fresh 59 // should be fresh in the resulting frame. The frame may also include fresh
52 // data for areas outside |region|. In that case capturer will include these 60 // data for areas outside |region|. In that case capturer will include these
53 // areas in updated_region() of the frame. |region| is specified relative to 61 // areas in updated_region() of the frame. |region| is specified relative to
54 // the top left corner of the capture target. Pending capture operations are 62 // the top left corner of the capture target. Pending capture operations are
55 // canceled when DesktopCapturer is deleted. 63 // canceled when DesktopCapturer is deleted.
56 virtual void Capture(const DesktopRegion& region) = 0; 64 virtual void Capture(const DesktopRegion& region) = 0;
57 65
58 // Sets the window to be excluded from the captured image in the future 66 // Sets the window to be excluded from the captured image in the future
59 // Capture calls. Used to exclude the screenshare notification window for 67 // Capture calls. Used to exclude the screenshare notification window for
60 // screen capturing. 68 // screen capturing.
61 virtual void SetExcludedWindow(WindowId window) {} 69 virtual void SetExcludedWindow(WindowId window) {}
62 }; 70 };
63 71
64 } // namespace webrtc 72 } // namespace webrtc
65 73
66 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ 74 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_
67 75
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc ('k') | webrtc/modules/desktop_capture/desktop_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698