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

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

Issue 13983010: Use webrtc::DesktopCapturer for screen capturer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
« no previous file with comments | « media/video/capture/screen/DEPS ('k') | media/video/capture/screen/differ.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 MEDIA_VIDEO_CAPTURE_SCREEN_DIFFER_H_ 5 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_DIFFER_H_
6 #define MEDIA_VIDEO_CAPTURE_SCREEN_DIFFER_H_ 6 #define MEDIA_VIDEO_CAPTURE_SCREEN_DIFFER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "media/base/media_export.h" 12 #include "media/base/media_export.h"
13 #include "third_party/skia/include/core/SkRegion.h" 13 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 typedef uint8 DiffInfo; 17 typedef uint8 DiffInfo;
18 18
19 // TODO: Simplify differ now that we are working with SkRegions. 19 // TODO: Simplify differ now that we are working with webrtc::DesktopRegion.
20 // diff_info_ should no longer be needed, as we can put our data directly into 20 // diff_info_ should no longer be needed, as we can put our data directly into
21 // the region that we are calculating. 21 // the region that we are calculating.
22 // http://crbug.com/92379 22 // http://crbug.com/92379
23 // TODO(sergeyu): Rename this class to something more sensible, e.g. 23 // TODO(sergeyu): Rename this class to something more sensible, e.g.
24 // ScreenCaptureFrameDifferencer. 24 // ScreenCaptureFrameDifferencer.
25 class MEDIA_EXPORT Differ { 25 class MEDIA_EXPORT Differ {
26 public: 26 public:
27 // Create a differ that operates on bitmaps with the specified width, height 27 // Create a differ that operates on bitmaps with the specified width, height
28 // and bytes_per_pixel. 28 // and bytes_per_pixel.
29 Differ(int width, int height, int bytes_per_pixel, int stride); 29 Differ(int width, int height, int bytes_per_pixel, int stride);
30 ~Differ(); 30 ~Differ();
31 31
32 int width() { return width_; } 32 int width() { return width_; }
33 int height() { return height_; } 33 int height() { return height_; }
34 int bytes_per_pixel() { return bytes_per_pixel_; } 34 int bytes_per_pixel() { return bytes_per_pixel_; }
35 int bytes_per_row() { return bytes_per_row_; } 35 int bytes_per_row() { return bytes_per_row_; }
36 36
37 // Given the previous and current screen buffer, calculate the dirty region 37 // Given the previous and current screen buffer, calculate the dirty region
38 // that encloses all of the changed pixels in the new screen. 38 // that encloses all of the changed pixels in the new screen.
39 void CalcDirtyRegion(const void* prev_buffer, const void* curr_buffer, 39 void CalcDirtyRegion(const void* prev_buffer, const void* curr_buffer,
40 SkRegion* region); 40 webrtc::DesktopRegion* region);
41 41
42 private: 42 private:
43 // Allow tests to access our private parts. 43 // Allow tests to access our private parts.
44 friend class DifferTest; 44 friend class DifferTest;
45 45
46 // Identify all of the blocks that contain changed pixels. 46 // Identify all of the blocks that contain changed pixels.
47 void MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer); 47 void MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer);
48 48
49 // After the dirty blocks have been identified, this routine merges adjacent 49 // After the dirty blocks have been identified, this routine merges adjacent
50 // blocks into a region. 50 // blocks into a region.
51 // The goal is to minimize the region that covers the dirty blocks. 51 // The goal is to minimize the region that covers the dirty blocks.
52 void MergeBlocks(SkRegion* region); 52 void MergeBlocks(webrtc::DesktopRegion* region);
53 53
54 // Check for diffs in upper-left portion of the block. The size of the portion 54 // Check for diffs in upper-left portion of the block. The size of the portion
55 // to check is specified by the |width| and |height| values. 55 // to check is specified by the |width| and |height| values.
56 // Note that if we force the capturer to always return images whose width and 56 // Note that if we force the capturer to always return images whose width and
57 // height are multiples of kBlockSize, then this will never be called. 57 // height are multiples of kBlockSize, then this will never be called.
58 DiffInfo DiffPartialBlock(const uint8* prev_buffer, const uint8* curr_buffer, 58 DiffInfo DiffPartialBlock(const uint8* prev_buffer, const uint8* curr_buffer,
59 int stride, int width, int height); 59 int stride, int width, int height);
60 60
61 // Dimensions of screen. 61 // Dimensions of screen.
62 int width_; 62 int width_;
(...skipping 13 matching lines...) Expand all
76 int diff_info_width_; 76 int diff_info_width_;
77 int diff_info_height_; 77 int diff_info_height_;
78 int diff_info_size_; 78 int diff_info_size_;
79 79
80 DISALLOW_COPY_AND_ASSIGN(Differ); 80 DISALLOW_COPY_AND_ASSIGN(Differ);
81 }; 81 };
82 82
83 } // namespace media 83 } // namespace media
84 84
85 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_DIFFER_H_ 85 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_DIFFER_H_
OLDNEW
« no previous file with comments | « media/video/capture/screen/DEPS ('k') | media/video/capture/screen/differ.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698