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

Side by Side Diff: webrtc/modules/desktop_capture/screen_capture_frame_queue.cc

Issue 1845113002: DirectX based screen capturer logic (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove width change in Texture::Capture 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" 11 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h"
12 12
13 #include <assert.h>
14 #include <algorithm> 13 #include <algorithm>
15 14
16 #include "webrtc/modules/desktop_capture/desktop_frame.h" 15 #include "webrtc/base/checks.h"
17 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" 16 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
18 #include "webrtc/system_wrappers/include/logging.h"
19 #include "webrtc/typedefs.h"
20 17
21 namespace webrtc { 18 namespace webrtc {
22 19
23 ScreenCaptureFrameQueue::ScreenCaptureFrameQueue() : current_(0) {}
24
25 ScreenCaptureFrameQueue::~ScreenCaptureFrameQueue() {}
26
27 void ScreenCaptureFrameQueue::MoveToNextFrame() { 20 void ScreenCaptureFrameQueue::MoveToNextFrame() {
28 current_ = (current_ + 1) % kQueueLength; 21 MoveToNext();
29 22
30 // Verify that the frame is not shared, i.e. that consumer has released it 23 // Verify that the frame is not shared, i.e. that consumer has released it
31 // before attempting to capture again. 24 // before attempting to capture again.
32 assert(!frames_[current_].get() || !frames_[current_]->IsShared()); 25 RTC_DCHECK(!current() || !current()->IsShared());
Sergey Ulanov 2016/04/14 23:10:42 I don't think we need MoveToNextFrame() just for t
Hzj_jie 2016/04/15 19:42:17 It would be a large change, considering we have fi
Sergey Ulanov 2016/04/19 23:51:07 That's good point. I suggest refactoring ScreenCap
Hzj_jie 2016/04/26 23:00:07 Done.
33 } 26 }
34 27
35 void ScreenCaptureFrameQueue::ReplaceCurrentFrame(DesktopFrame* frame) { 28 void ScreenCaptureFrameQueue::ReplaceCurrentFrame(DesktopFrame* frame) {
36 frames_[current_].reset(SharedDesktopFrame::Wrap(frame)); 29 ReplaceCurrent(SharedDesktopFrame::Wrap(frame));
Sergey Ulanov 2016/04/14 23:10:42 Same here - make the caller responsible for wrappi
Hzj_jie 2016/04/15 19:42:17 Same as above, but I also have concern to your dec
37 }
38
39 void ScreenCaptureFrameQueue::Reset() {
40 for (int i = 0; i < kQueueLength; ++i)
41 frames_[i].reset();
42 } 30 }
43 31
44 } // namespace webrtc 32 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698