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

Unified Diff: webrtc/modules/desktop_capture/screen_capture_frame_queue.h

Issue 1910203002: Revert of Modify ScreenCaptureFrameQueue into a template (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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 c9bd631b594a8be9a5942c594267a6c7015229e8..21af0f320fc277952c4515b547d9ab98492a2a15 100644
--- a/webrtc/modules/desktop_capture/screen_capture_frame_queue.h
+++ b/webrtc/modules/desktop_capture/screen_capture_frame_queue.h
@@ -13,7 +13,12 @@
#include <memory>
-#include "webrtc/base/constructormagic.h"
+#include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
+#include "webrtc/typedefs.h"
+
+namespace webrtc {
+class DesktopFrame;
+} // namespace webrtc
namespace webrtc {
@@ -30,38 +35,28 @@
// 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).
-template <typename FrameType>
class ScreenCaptureFrameQueue {
public:
- ScreenCaptureFrameQueue() : current_(0) {}
- ~ScreenCaptureFrameQueue() = default;
+ ScreenCaptureFrameQueue();
+ ~ScreenCaptureFrameQueue();
// Moves to the next frame in the queue, moving the 'current' frame to become
// the 'previous' one.
- void MoveToNextFrame() {
- current_ = (current_ + 1) % kQueueLength;
- }
+ void MoveToNextFrame();
// Replaces the current frame with a new one allocated by the caller. The
// existing frame (if any) is destroyed. Takes ownership of |frame|.
- void ReplaceCurrentFrame(FrameType* frame) {
- frames_[current_].reset(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() {
- for (int i = 0; i < kQueueLength; i++) {
- frames_[i].reset();
- }
- current_ = 0;
- }
+ void Reset();
- FrameType* current_frame() const {
+ SharedDesktopFrame* current_frame() const {
return frames_[current_].get();
}
- FrameType* previous_frame() const {
+ SharedDesktopFrame* previous_frame() const {
return frames_[(current_ + kQueueLength - 1) % kQueueLength].get();
}
@@ -70,7 +65,7 @@
int current_;
static const int kQueueLength = 2;
- std::unique_ptr<FrameType> frames_[kQueueLength];
+ std::unique_ptr<SharedDesktopFrame> frames_[kQueueLength];
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrameQueue);
};
« no previous file with comments | « webrtc/modules/desktop_capture/desktop_capture.gypi ('k') | webrtc/modules/desktop_capture/screen_capture_frame_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698