Index: media/video/capture/screen/screen_capture_frame_queue.h |
diff --git a/media/video/capture/screen/screen_capture_frame_queue.h b/media/video/capture/screen/screen_capture_frame_queue.h |
index d36f15a462501a2b7b403015e8ee3ac2ed5b6c50..7d92024583f5f8ee45a0725f8af4f920a16fc1f6 100644 |
--- a/media/video/capture/screen/screen_capture_frame_queue.h |
+++ b/media/video/capture/screen/screen_capture_frame_queue.h |
@@ -8,14 +8,16 @@ |
#include "base/compiler_specific.h" |
#include "base/memory/scoped_ptr.h" |
-namespace media { |
+namespace webrtc { |
+class DesktopFrame; |
+} // namespace webrtc |
-class ScreenCaptureFrame; |
+namespace media { |
// Represents a queue of reusable video frames. Provides access to the 'current' |
// frame - the frame that the caller is working with at the moment, and to |
// the 'previous' frame - the predecessor of the current frame swapped by |
-// DoneWithCurrentFrame() call, if any. |
+// MoveToNextFrame() call, if any. |
Wez
2013/04/26 18:48:14
EmitCurrentFrameAndMoveToNext()?
alexeypa (please no reviews)
2013/04/26 21:33:58
nit: it is EmitCurrentFrameAndMoveToNext() in the
Sergey Ulanov
2013/05/07 22:25:50
Done.
Sergey Ulanov
2013/05/07 22:25:50
Done.
|
// |
// The caller is expected to (re)allocate frames if current_frame_needs_update() |
// is set. The caller can mark all frames in the queue for reallocation (when, |
@@ -28,38 +30,44 @@ class ScreenCaptureFrameQueue { |
// Moves to the next frame in the queue, moving the 'current' frame to become |
// the 'previous' one. |
- void DoneWithCurrentFrame(); |
+ webrtc::DesktopFrame* EmitCurrentFrameAndMoveToNext(); |
Wez
2013/04/26 18:48:14
Why not call this MoveToNextFrame() and document t
Wez
2013/04/26 18:48:14
CLarify the ownership of the returned frame, for t
Wez
2013/04/26 18:48:14
Also, for calls that return something and transfer
Sergey Ulanov
2013/05/07 22:25:50
Done.
Sergey Ulanov
2013/05/07 22:25:50
MoveToNextFrame() is not verbose enough.
Sergey Ulanov
2013/05/07 22:25:50
Right, but the frame is actually "emitted" by the
|
// Replaces the current frame with a new one allocated by the caller. |
// The existing frame (if any) is destroyed. |
- void ReplaceCurrentFrame(scoped_ptr<ScreenCaptureFrame> frame); |
+ void ReplaceCurrentFrame(scoped_ptr<webrtc::DesktopFrame> frame); |
// Marks all frames obsolete and resets the previous frame pointer. No |
// frames are freed though as the caller can still access them. |
void SetAllFramesNeedUpdate(); |
- ScreenCaptureFrame* current_frame() const { |
- return frames_[current_].get(); |
+ webrtc::DesktopFrame* current_frame() const { |
+ return frames_[current_]; |
} |
bool current_frame_needs_update() const { |
Wez
2013/04/26 18:48:14
You don't need this any more; just delete the fram
Sergey Ulanov
2013/05/07 22:25:50
Yes, thanks!
|
return !current_frame() || needs_update_[current_]; |
} |
- ScreenCaptureFrame* previous_frame() const { return previous_; } |
+ webrtc::DesktopFrame* previous_frame() const { return previous_; } |
private: |
+ class EmittedFrame; |
+ friend class EmittedFrame; |
+ |
+ void ReturnEmittedFrame(webrtc::DesktopFrame* frame); |
Wez
2013/04/26 18:48:14
nit: Please document what this is for.
Sergey Ulanov
2013/05/07 22:25:50
Done.
|
+ |
// Index of the current frame. |
int current_; |
static const int kQueueLength = 2; |
- scoped_ptr<ScreenCaptureFrame> frames_[kQueueLength]; |
+ webrtc::DesktopFrame* frames_[kQueueLength]; |
+ EmittedFrame* emitted_frames_[kQueueLength]; |
// True if the corresponding frame needs to be re-allocated. |
bool needs_update_[kQueueLength]; |
// Points to the previous frame if any. |
- ScreenCaptureFrame* previous_; |
+ webrtc::DesktopFrame* previous_; |
DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrameQueue); |
}; |