| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 ~ScreenCaptureFrameQueue() = default; | 42 ~ScreenCaptureFrameQueue() = default; |
| 43 | 43 |
| 44 // Moves to the next frame in the queue, moving the 'current' frame to become | 44 // Moves to the next frame in the queue, moving the 'current' frame to become |
| 45 // the 'previous' one. | 45 // the 'previous' one. |
| 46 void MoveToNextFrame() { | 46 void MoveToNextFrame() { |
| 47 current_ = (current_ + 1) % kQueueLength; | 47 current_ = (current_ + 1) % kQueueLength; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Replaces the current frame with a new one allocated by the caller. The | 50 // Replaces the current frame with a new one allocated by the caller. The |
| 51 // existing frame (if any) is destroyed. Takes ownership of |frame|. | 51 // existing frame (if any) is destroyed. Takes ownership of |frame|. |
| 52 void ReplaceCurrentFrame(std::unique_ptr<FrameType> frame) { | 52 void ReplaceCurrentFrame(FrameType* frame) { |
| 53 frames_[current_] = std::move(frame); | 53 frames_[current_].reset(frame); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Marks all frames obsolete and resets the previous frame pointer. No | 56 // Marks all frames obsolete and resets the previous frame pointer. No |
| 57 // frames are freed though as the caller can still access them. | 57 // frames are freed though as the caller can still access them. |
| 58 void Reset() { | 58 void Reset() { |
| 59 for (int i = 0; i < kQueueLength; i++) { | 59 for (int i = 0; i < kQueueLength; i++) { |
| 60 frames_[i].reset(); | 60 frames_[i].reset(); |
| 61 } | 61 } |
| 62 current_ = 0; | 62 current_ = 0; |
| 63 } | 63 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 76 | 76 |
| 77 static const int kQueueLength = 2; | 77 static const int kQueueLength = 2; |
| 78 std::unique_ptr<FrameType> frames_[kQueueLength]; | 78 std::unique_ptr<FrameType> frames_[kQueueLength]; |
| 79 | 79 |
| 80 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrameQueue); | 80 RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrameQueue); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace webrtc | 83 } // namespace webrtc |
| 84 | 84 |
| 85 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURE_FRAME_QUEUE_H_ | 85 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURE_FRAME_QUEUE_H_ |
| OLD | NEW |