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

Side by Side Diff: remoting/host/video_frame_recorder.h

Issue 468613002: Readability review. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_HOST_VIDEO_FRAME_RECORDER_H_ 5 #ifndef REMOTING_HOST_VIDEO_FRAME_RECORDER_H_
6 #define REMOTING_HOST_VIDEO_FRAME_RECORDER_H_ 6 #define REMOTING_HOST_VIDEO_FRAME_RECORDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <list> 9 #include <list>
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 class VideoEncoder; 22 class VideoEncoder;
23 23
24 // Allows sequences of DesktopFrames passed to a VideoEncoder to be recorded. 24 // Allows sequences of DesktopFrames passed to a VideoEncoder to be recorded.
25 // 25 //
26 // VideoFrameRecorder is designed to support applications which use a dedicated 26 // VideoFrameRecorder is designed to support applications which use a dedicated
27 // thread for video encoding, but need to manage that process from a "main" 27 // thread for video encoding, but need to manage that process from a "main"
28 // or "control" thread. 28 // or "control" thread.
29 // 29 //
30 // On the control thread: 30 // On the control thread:
31 // 1. Create the VideoFrameRecorder on the controlling thread. 31 // 1. Create the VideoFrameRecorder.
32 // 2. Specify the amount of memory that may be used for recording. 32 // 2. Specify the amount of memory that may be used for recording.
33 // 3. Call WrapVideoEncoder(), passing the actual VideoEncoder that will be 33 // 3. Call WrapVideoEncoder(), passing the actual VideoEncoder that will be
34 // used to encode frames. 34 // used to encode frames.
35 // 4. Hand the returned wrapper VideoEncoder of to the video encoding thread, 35 // 4. Hand off the returned wrapper VideoEncoder to the video encoding thread,
36 // to call in place of the actual VideoEncoder. 36 // to call in place of the actual VideoEncoder.
37 // 5. Start/stop frame recording as necessary. 37 // 5. Start/stop frame recording as necessary.
38 // 6. Use NextFrame() to read each recorded frame in sequence. 38 // 6. Use NextFrame() to read each recorded frame in sequence.
39 // 39 //
40 // The wrapper VideoEncoder is designed to be handed off to the video encoding 40 // The wrapper VideoEncoder is designed to be handed off to the video encoding
41 // thread, and used and torn down there. 41 // thread, and used and torn down there.
42 // 42 //
43 // The VideoFrameRecorder and VideoEncoder may be torn down in any order; frame 43 // The VideoFrameRecorder and VideoEncoder may be torn down in any order; frame
44 // recording will stop as soon as either is destroyed. 44 // recording will stop as soon as either is destroyed.
45 45
46 class VideoFrameRecorder { 46 class VideoFrameRecorder {
47 public: 47 public:
48 VideoFrameRecorder(); 48 VideoFrameRecorder();
49 virtual ~VideoFrameRecorder(); 49 virtual ~VideoFrameRecorder();
50 50
51 // Wraps the supplied VideoEncoder, returning a replacement VideoEncoder that 51 // Wraps the supplied VideoEncoder, returning a replacement VideoEncoder that
52 // will route frames to the recorder, as well as passing them for encoding. 52 // will route frames to the recorder, as well as passing them for encoding.
53 // The caller must delete the previous recording VideoEncoder, or call 53 // Each VideoFrameRecorder supports at most one wrapper at a time; if a new
54 // DetachVideoEncoderWrapper() before calling WrapVideoEncoder() to create 54 // wrapper is required then any existing one must be deleted, or detached via
55 // a new wrapper. 55 // DetachVideoEncoderWrapper(), before WrapVideoEncoder() is called again.
56 scoped_ptr<VideoEncoder> WrapVideoEncoder(scoped_ptr<VideoEncoder> encoder); 56 scoped_ptr<VideoEncoder> WrapVideoEncoder(scoped_ptr<VideoEncoder> encoder);
57 57
58 // Detaches the existing VideoEncoder wrapper, stopping it from recording. 58 // Detaches the existing VideoEncoder wrapper, stopping it from recording.
59 // The detached wrapper remains owned by the caller and will continue to
60 // pass-through frames to the wrapped encoder, without recording them.
59 void DetachVideoEncoderWrapper(); 61 void DetachVideoEncoderWrapper();
60 62
61 // Enables/disables frame recording. Frame recording is initially disabled. 63 // Enables/disables frame recording. Frame recording is initially disabled.
62 void SetEnableRecording(bool enable_recording); 64 void SetEnableRecording(bool enable_recording);
63 65
64 // Sets the maximum number of bytes of pixel data that may be recorded. 66 // Sets the maximum number of bytes of pixel data that may be recorded.
65 // When this maximum is reached older frames will be discard to make space 67 // When this maximum is reached older frames will be discarded to make space
66 // for new ones. 68 // for new ones.
67 void SetMaxContentBytes(int64_t max_content_bytes); 69 void SetMaxContentBytes(int64_t max_content_bytes);
68 70
69 // Pops the next recorded frame in the sequence, and returns it. 71 // Pops the next recorded frame in the sequence, and returns it.
70 scoped_ptr<webrtc::DesktopFrame> NextFrame(); 72 scoped_ptr<webrtc::DesktopFrame> NextFrame();
71 73
72 private: 74 private:
73 class RecordingVideoEncoder; 75 class RecordingVideoEncoder;
74 friend class RecordingVideoEncoder; 76 friend class RecordingVideoEncoder;
75 77
(...skipping 20 matching lines...) Expand all
96 98
97 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; 99 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
98 base::WeakPtrFactory<VideoFrameRecorder> weak_factory_; 100 base::WeakPtrFactory<VideoFrameRecorder> weak_factory_;
99 101
100 DISALLOW_COPY_AND_ASSIGN(VideoFrameRecorder); 102 DISALLOW_COPY_AND_ASSIGN(VideoFrameRecorder);
101 }; 103 };
102 104
103 } // namespace remoting 105 } // namespace remoting
104 106
105 #endif // REMOTING_HOST_VIDEO_FRAME_RECORDER_H_ 107 #endif // REMOTING_HOST_VIDEO_FRAME_RECORDER_H_
OLDNEW
« no previous file with comments | « remoting/host/host_extension_session_manager_unittest.cc ('k') | remoting/host/video_frame_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698