OLD | NEW |
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> | 13 #include <assert.h> |
14 #include <algorithm> | 14 #include <algorithm> |
15 | 15 |
16 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 16 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
17 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" | 17 #include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
18 #include "webrtc/system_wrappers/interface/logging.h" | 18 #include "webrtc/system_wrappers/include/logging.h" |
19 #include "webrtc/typedefs.h" | 19 #include "webrtc/typedefs.h" |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 | 22 |
23 ScreenCaptureFrameQueue::ScreenCaptureFrameQueue() : current_(0) {} | 23 ScreenCaptureFrameQueue::ScreenCaptureFrameQueue() : current_(0) {} |
24 | 24 |
25 ScreenCaptureFrameQueue::~ScreenCaptureFrameQueue() {} | 25 ScreenCaptureFrameQueue::~ScreenCaptureFrameQueue() {} |
26 | 26 |
27 void ScreenCaptureFrameQueue::MoveToNextFrame() { | 27 void ScreenCaptureFrameQueue::MoveToNextFrame() { |
28 current_ = (current_ + 1) % kQueueLength; | 28 current_ = (current_ + 1) % kQueueLength; |
29 | 29 |
30 // Verify that the frame is not shared, i.e. that consumer has released it | 30 // Verify that the frame is not shared, i.e. that consumer has released it |
31 // before attempting to capture again. | 31 // before attempting to capture again. |
32 assert(!frames_[current_].get() || !frames_[current_]->IsShared()); | 32 assert(!frames_[current_].get() || !frames_[current_]->IsShared()); |
33 } | 33 } |
34 | 34 |
35 void ScreenCaptureFrameQueue::ReplaceCurrentFrame(DesktopFrame* frame) { | 35 void ScreenCaptureFrameQueue::ReplaceCurrentFrame(DesktopFrame* frame) { |
36 frames_[current_].reset(SharedDesktopFrame::Wrap(frame)); | 36 frames_[current_].reset(SharedDesktopFrame::Wrap(frame)); |
37 } | 37 } |
38 | 38 |
39 void ScreenCaptureFrameQueue::Reset() { | 39 void ScreenCaptureFrameQueue::Reset() { |
40 for (int i = 0; i < kQueueLength; ++i) | 40 for (int i = 0; i < kQueueLength; ++i) |
41 frames_[i].reset(); | 41 frames_[i].reset(); |
42 } | 42 } |
43 | 43 |
44 } // namespace webrtc | 44 } // namespace webrtc |
OLD | NEW |