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

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

Issue 12047101: Move screen capturers from remoting/capturer to media/video/capturer/screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 REMOTING_CAPTURER_VIDEO_FRAME_QUEUE_H_ 5 #ifndef MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURE_FRAME_QUEUE_H_
6 #define REMOTING_CAPTURER_VIDEO_FRAME_QUEUE_H_ 6 #define MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURE_FRAME_QUEUE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 10
11 namespace remoting { 11 namespace media {
12 12
13 class VideoFrame; 13 class ScreenCaptureFrame;
14 14
15 // Represents a queue of reusable video frames. Provides access to the 'current' 15 // Represents a queue of reusable video frames. Provides access to the 'current'
16 // frame - the frame that the caller is working with at the moment, and to 16 // frame - the frame that the caller is working with at the moment, and to
17 // the 'previous' frame - the predecessor of the current frame swapped by 17 // the 'previous' frame - the predecessor of the current frame swapped by
18 // DoneWithCurrentFrame() call, if any. 18 // DoneWithCurrentFrame() call, if any.
19 // 19 //
20 // The caller is expected to (re)allocate frames if current_frame_needs_update() 20 // The caller is expected to (re)allocate frames if current_frame_needs_update()
21 // is set. The caller can mark all frames in the queue for reallocation (when, 21 // is set. The caller can mark all frames in the queue for reallocation (when,
22 // say, frame dimensions change). The queue records which frames need updating 22 // say, frame dimensions change). The queue records which frames need updating
23 // which the caller can query. 23 // which the caller can query.
24 class VideoFrameQueue { 24 class ScreenCaptureFrameQueue {
25 public: 25 public:
26 VideoFrameQueue(); 26 ScreenCaptureFrameQueue();
27 ~VideoFrameQueue(); 27 ~ScreenCaptureFrameQueue();
28 28
29 // Moves to the next frame in the queue, moving the 'current' frame to become 29 // Moves to the next frame in the queue, moving the 'current' frame to become
30 // the 'previous' one. 30 // the 'previous' one.
31 void DoneWithCurrentFrame(); 31 void DoneWithCurrentFrame();
32 32
33 // Replaces the current frame with a new one allocated by the caller. 33 // Replaces the current frame with a new one allocated by the caller.
34 // The existing frame (if any) is destroyed. 34 // The existing frame (if any) is destroyed.
35 void ReplaceCurrentFrame(scoped_ptr<VideoFrame> frame); 35 void ReplaceCurrentFrame(scoped_ptr<ScreenCaptureFrame> frame);
36 36
37 // Marks all frames obsolete and resets the previous frame pointer. No 37 // Marks all frames obsolete and resets the previous frame pointer. No
38 // frames are freed though as the caller can still access them. 38 // frames are freed though as the caller can still access them.
39 void SetAllFramesNeedUpdate(); 39 void SetAllFramesNeedUpdate();
40 40
41 VideoFrame* current_frame() const { 41 ScreenCaptureFrame* current_frame() const {
42 return frames_[current_].get(); 42 return frames_[current_].get();
43 } 43 }
44 44
45 bool current_frame_needs_update() const { 45 bool current_frame_needs_update() const {
46 return !current_frame() || needs_update_[current_]; 46 return !current_frame() || needs_update_[current_];
47 } 47 }
48 48
49 VideoFrame* previous_frame() const { return previous_; } 49 ScreenCaptureFrame* previous_frame() const { return previous_; }
50 50
51 private: 51 private:
52 // Index of the current frame. 52 // Index of the current frame.
53 int current_; 53 int current_;
54 54
55 static const int kQueueLength = 2; 55 static const int kQueueLength = 2;
56 scoped_ptr<VideoFrame> frames_[kQueueLength]; 56 scoped_ptr<ScreenCaptureFrame> frames_[kQueueLength];
57 57
58 // True if the corresponding frame needs to be re-allocated. 58 // True if the corresponding frame needs to be re-allocated.
59 bool needs_update_[kQueueLength]; 59 bool needs_update_[kQueueLength];
60 60
61 // Points to the previous frame if any. 61 // Points to the previous frame if any.
62 VideoFrame* previous_; 62 ScreenCaptureFrame* previous_;
63 63
64 DISALLOW_COPY_AND_ASSIGN(VideoFrameQueue); 64 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrameQueue);
65 }; 65 };
66 66
67 } // namespace remoting 67 } // namespace media
68 68
69 #endif // REMOTING_CAPTURER_VIDEO_FRAME_QUEUE_H_ 69 #endif // MEDIA_VIDEO_CAPTURE_SCREEN_SCREEN_CAPTURE_FRAME_QUEUE_H_
OLDNEW
« no previous file with comments | « media/video/capture/screen/screen_capture_frame.cc ('k') | media/video/capture/screen/screen_capture_frame_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698