OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/chromeos/aura_desktop_capturer.h" | 5 #include "remoting/host/chromeos/aura_desktop_capturer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 gfx::Rect window_rect(desktop_window_->bounds().size()); | 49 gfx::Rect window_rect(desktop_window_->bounds().size()); |
50 | 50 |
51 request->set_area(window_rect); | 51 request->set_area(window_rect); |
52 desktop_window_->layer()->RequestCopyOfOutput(std::move(request)); | 52 desktop_window_->layer()->RequestCopyOfOutput(std::move(request)); |
53 } | 53 } |
54 | 54 |
55 void AuraDesktopCapturer::OnFrameCaptured( | 55 void AuraDesktopCapturer::OnFrameCaptured( |
56 std::unique_ptr<cc::CopyOutputResult> result) { | 56 std::unique_ptr<cc::CopyOutputResult> result) { |
57 if (result->IsEmpty()) { | 57 if (result->IsEmpty()) { |
58 callback_->OnCaptureCompleted(nullptr); | 58 callback_->OnCaptureResult(DesktopCapturer::Result::ERROR_TEMPORARY, |
| 59 nullptr); |
59 return; | 60 return; |
60 } | 61 } |
61 | 62 |
62 DCHECK(result->HasBitmap()); | 63 DCHECK(result->HasBitmap()); |
63 | 64 |
64 std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap(); | 65 std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap(); |
65 | 66 |
66 std::unique_ptr<webrtc::DesktopFrame> frame( | 67 std::unique_ptr<webrtc::DesktopFrame> frame( |
67 SkiaBitmapDesktopFrame::Create(std::move(bitmap))); | 68 SkiaBitmapDesktopFrame::Create(std::move(bitmap))); |
68 | 69 |
69 // |VideoFramePump| will not encode the frame if |updated_region| is empty. | 70 // |VideoFramePump| will not encode the frame if |updated_region| is empty. |
70 const webrtc::DesktopRect& rect = webrtc::DesktopRect::MakeWH( | 71 const webrtc::DesktopRect& rect = webrtc::DesktopRect::MakeWH( |
71 frame->size().width(), frame->size().height()); | 72 frame->size().width(), frame->size().height()); |
72 | 73 |
73 // TODO(kelvinp): Set Frame DPI according to the screen resolution. | 74 // TODO(kelvinp): Set Frame DPI according to the screen resolution. |
74 // See cc::Layer::contents_scale_(x|y)() and frame->set_depi(). | 75 // See cc::Layer::contents_scale_(x|y)() and frame->set_depi(). |
75 frame->mutable_updated_region()->SetRect(rect); | 76 frame->mutable_updated_region()->SetRect(rect); |
76 | 77 |
77 callback_->OnCaptureCompleted(frame.release()); | 78 callback_->OnCaptureResult(DesktopCapturer::Result::SUCCESS, |
| 79 std::move(frame)); |
78 } | 80 } |
79 | 81 |
80 } // namespace remoting | 82 } // namespace remoting |
OLD | NEW |