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

Side by Side Diff: remoting/capturer/video_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
« no previous file with comments | « remoting/capturer/video_frame_capturer_win.cc ('k') | remoting/capturer/video_frame_queue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 REMOTING_CAPTURER_VIDEO_FRAME_QUEUE_H_
6 #define REMOTING_CAPTURER_VIDEO_FRAME_QUEUE_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10
11 namespace remoting {
12
13 class VideoFrame;
14
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
17 // the 'previous' frame - the predecessor of the current frame swapped by
18 // DoneWithCurrentFrame() call, if any.
19 //
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,
22 // say, frame dimensions change). The queue records which frames need updating
23 // which the caller can query.
24 class VideoFrameQueue {
25 public:
26 VideoFrameQueue();
27 ~VideoFrameQueue();
28
29 // Moves to the next frame in the queue, moving the 'current' frame to become
30 // the 'previous' one.
31 void DoneWithCurrentFrame();
32
33 // Replaces the current frame with a new one allocated by the caller.
34 // The existing frame (if any) is destroyed.
35 void ReplaceCurrentFrame(scoped_ptr<VideoFrame> frame);
36
37 // Marks all frames obsolete and resets the previous frame pointer. No
38 // frames are freed though as the caller can still access them.
39 void SetAllFramesNeedUpdate();
40
41 VideoFrame* current_frame() const {
42 return frames_[current_].get();
43 }
44
45 bool current_frame_needs_update() const {
46 return !current_frame() || needs_update_[current_];
47 }
48
49 VideoFrame* previous_frame() const { return previous_; }
50
51 private:
52 // Index of the current frame.
53 int current_;
54
55 static const int kQueueLength = 2;
56 scoped_ptr<VideoFrame> frames_[kQueueLength];
57
58 // True if the corresponding frame needs to be re-allocated.
59 bool needs_update_[kQueueLength];
60
61 // Points to the previous frame if any.
62 VideoFrame* previous_;
63
64 DISALLOW_COPY_AND_ASSIGN(VideoFrameQueue);
65 };
66
67 } // namespace remoting
68
69 #endif // REMOTING_CAPTURER_VIDEO_FRAME_QUEUE_H_
OLDNEW
« no previous file with comments | « remoting/capturer/video_frame_capturer_win.cc ('k') | remoting/capturer/video_frame_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698