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

Side by Side Diff: media/video/capture/screen/screen_capturer_helper.h

Issue 15692018: Remove screen capturers from media/video/capture/screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_HELPER_H_
6 #define MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_HELPER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/synchronization/lock.h"
10 #include "media/base/media_export.h"
11 #include "third_party/skia/include/core/SkRegion.h"
12 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
13 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
14
15 namespace media {
16
17 // ScreenCapturerHelper is intended to be used by an implementation of the
18 // ScreenCapturer interface. It maintains a thread-safe invalid region, and
19 // the size of the most recently captured screen, on behalf of the
20 // ScreenCapturer that owns it.
21 class MEDIA_EXPORT ScreenCapturerHelper {
22 public:
23 ScreenCapturerHelper();
24 ~ScreenCapturerHelper();
25
26 // Clear out the invalid region.
27 void ClearInvalidRegion();
28
29 // Invalidate the specified region.
30 void InvalidateRegion(const webrtc::DesktopRegion& invalid_region);
31
32 // Invalidate the entire screen, of a given size.
33 void InvalidateScreen(const webrtc::DesktopSize& size);
34
35 // Copies current invalid region to |invalid_region| clears invalid region
36 // storage for the next frame.
37 void TakeInvalidRegion(webrtc::DesktopRegion* invalid_region);
38
39 // Access the size of the most recently captured screen.
40 const webrtc::DesktopSize& size_most_recent() const;
41 void set_size_most_recent(const webrtc::DesktopSize& size);
42
43 // Lossy compression can result in color values leaking between pixels in one
44 // block. If part of a block changes, then unchanged parts of that block can
45 // be changed in the compressed output. So we need to re-render an entire
46 // block whenever part of the block changes.
47 //
48 // If |log_grid_size| is >= 1, then this function makes TakeInvalidRegion()
49 // produce an invalid region expanded so that its vertices lie on a grid of
50 // size 2 ^ |log_grid_size|. The expanded region is then clipped to the size
51 // of the most recently captured screen, as previously set by
52 // set_size_most_recent().
53 // If |log_grid_size| is <= 0, then the invalid region is not expanded.
54 void SetLogGridSize(int log_grid_size);
55
56 // Expands a region so that its vertices all lie on a grid.
57 // The grid size must be >= 2, so |log_grid_size| must be >= 1.
58 static scoped_ptr<SkRegion> ExpandToGrid(const SkRegion& region,
59 int log_grid_size);
60
61 private:
62 // A region that has been manually invalidated (through InvalidateRegion).
63 // These will be returned as dirty_region in the capture data during the next
64 // capture.
65 SkRegion invalid_region_;
66
67 // A lock protecting |invalid_region_| across threads.
68 base::Lock invalid_region_lock_;
69
70 // The size of the most recently captured screen.
71 webrtc::DesktopSize size_most_recent_;
72
73 // The log (base 2) of the size of the grid to which the invalid region is
74 // expanded.
75 // If the value is <= 0, then the invalid region is not expanded to a grid.
76 int log_grid_size_;
77
78 DISALLOW_COPY_AND_ASSIGN(ScreenCapturerHelper);
79 };
80
81 } // namespace media
82
83 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURER_HELPER_H_
OLDNEW
« no previous file with comments | « media/video/capture/screen/screen_capturer_fake.cc ('k') | media/video/capture/screen/screen_capturer_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698