Chromium Code Reviews| Index: webrtc/modules/desktop_capture/screen_capture_frame_queue.h |
| diff --git a/webrtc/modules/desktop_capture/screen_capture_frame_queue.h b/webrtc/modules/desktop_capture/screen_capture_frame_queue.h |
| index 21af0f320fc277952c4515b547d9ab98492a2a15..b15ae4bc733e8f05d2d6b0660a43fb244c0ad3f7 100644 |
| --- a/webrtc/modules/desktop_capture/screen_capture_frame_queue.h |
| +++ b/webrtc/modules/desktop_capture/screen_capture_frame_queue.h |
| @@ -13,8 +13,8 @@ |
| #include <memory> |
| +#include "webrtc/modules/desktop_capture/screen_capture_content_queue.h" |
| #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
| -#include "webrtc/typedefs.h" |
| namespace webrtc { |
| class DesktopFrame; |
| @@ -35,10 +35,16 @@ namespace webrtc { |
| // Frame consumer is expected to never hold more than kQueueLength frames |
| // created by this function and it should release the earliest one before trying |
| // to capture a new frame (i.e. before MoveToNextFrame() is called). |
| -class ScreenCaptureFrameQueue { |
| +// |
| +// Users do not expect to call functions from |
| +// ScreenCaptureContentQueue<SharedDesktopFrame>, since extra assertions or |
| +// wrappers are applied. |
| +class ScreenCaptureFrameQueue : ScreenCaptureContentQueue<SharedDesktopFrame> { |
|
Sergey Ulanov
2016/04/14 23:10:42
Do we actually need this class? I'd prefer having
Hzj_jie
2016/04/15 19:42:17
To avoid changing capturers which are not involved
|
| public: |
| - ScreenCaptureFrameQueue(); |
| - ~ScreenCaptureFrameQueue(); |
| + ScreenCaptureFrameQueue() = default; |
| + virtual ~ScreenCaptureFrameQueue() = default; |
| + |
| + using ScreenCaptureContentQueue<SharedDesktopFrame>::Reset; |
| // Moves to the next frame in the queue, moving the 'current' frame to become |
| // the 'previous' one. |
| @@ -48,25 +54,14 @@ class ScreenCaptureFrameQueue { |
| // existing frame (if any) is destroyed. Takes ownership of |frame|. |
| void ReplaceCurrentFrame(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 Reset(); |
| - |
| SharedDesktopFrame* current_frame() const { |
| - return frames_[current_].get(); |
| + return current(); |
| } |
| SharedDesktopFrame* previous_frame() const { |
|
Sergey Ulanov
2016/04/14 23:10:42
I don't think you need these two methods. Just cha
Hzj_jie
2016/04/15 19:42:17
Same as above, let's do it in next change.
|
| - return frames_[(current_ + kQueueLength - 1) % kQueueLength].get(); |
| + return previous(); |
| } |
| - private: |
| - // Index of the current frame. |
| - int current_; |
| - |
| - static const int kQueueLength = 2; |
| - std::unique_ptr<SharedDesktopFrame> frames_[kQueueLength]; |
| - |
| RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrameQueue); |
| }; |