OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // not take the ownership of |generator|. | 55 // not take the ownership of |generator|. |
56 void set_frame_generator(DesktopFrameGenerator* generator) { | 56 void set_frame_generator(DesktopFrameGenerator* generator) { |
57 generator_ = generator; | 57 generator_ = generator; |
58 } | 58 } |
59 | 59 |
60 // DesktopCapturer interface | 60 // DesktopCapturer interface |
61 void Start(DesktopCapturer::Callback* callback) override { | 61 void Start(DesktopCapturer::Callback* callback) override { |
62 callback_ = callback; | 62 callback_ = callback; |
63 } | 63 } |
64 | 64 |
65 void Capture(const DesktopRegion& region) override { | 65 void CaptureFrame() override { |
66 if (generator_) { | 66 if (generator_) { |
67 std::unique_ptr<DesktopFrame> frame( | 67 std::unique_ptr<DesktopFrame> frame( |
68 generator_->GetNextFrame(shared_memory_factory_.get())); | 68 generator_->GetNextFrame(shared_memory_factory_.get())); |
69 if (frame) { | 69 if (frame) { |
70 callback_->OnCaptureResult(result_, std::move(frame)); | 70 callback_->OnCaptureResult(result_, std::move(frame)); |
71 } else { | 71 } else { |
72 callback_->OnCaptureResult(DesktopCapturer::Result::ERROR_TEMPORARY, | 72 callback_->OnCaptureResult(DesktopCapturer::Result::ERROR_TEMPORARY, |
73 nullptr); | 73 nullptr); |
74 } | 74 } |
75 return; | 75 return; |
(...skipping 10 matching lines...) Expand all Loading... |
86 private: | 86 private: |
87 DesktopCapturer::Callback* callback_; | 87 DesktopCapturer::Callback* callback_; |
88 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; | 88 std::unique_ptr<SharedMemoryFactory> shared_memory_factory_; |
89 DesktopCapturer::Result result_; | 89 DesktopCapturer::Result result_; |
90 DesktopFrameGenerator* generator_; | 90 DesktopFrameGenerator* generator_; |
91 }; | 91 }; |
92 | 92 |
93 } // namespace webrtc | 93 } // namespace webrtc |
94 | 94 |
95 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_FAKE_DESKTOP_CAPTURER_H_ | 95 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_FAKE_DESKTOP_CAPTURER_H_ |
OLD | NEW |