OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/client/frame_consumer_proxy.h" | 5 #include "remoting/client/frame_consumer_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
12 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 | 15 |
16 FrameConsumerProxy::FrameConsumerProxy( | 16 FrameConsumerProxy::FrameConsumerProxy( |
17 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 17 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
18 const base::WeakPtr<FrameConsumer>& frame_consumer) | 18 const base::WeakPtr<FrameConsumer>& frame_consumer) |
19 : frame_consumer_(frame_consumer), | 19 : frame_consumer_(frame_consumer), |
20 task_runner_(task_runner) { | 20 task_runner_(task_runner) { |
21 pixel_format_ = frame_consumer_->GetPixelFormat(); | 21 pixel_format_ = frame_consumer_->GetPixelFormat(); |
22 } | 22 } |
23 | 23 |
24 void FrameConsumerProxy::ApplyBuffer(const webrtc::DesktopSize& view_size, | 24 void FrameConsumerProxy::ApplyBuffer(const webrtc::DesktopSize& view_size, |
25 const webrtc::DesktopRect& clip_area, | 25 const webrtc::DesktopRect& clip_area, |
26 webrtc::DesktopFrame* buffer, | 26 webrtc::DesktopFrame* buffer, |
27 const webrtc::DesktopRegion& region) { | 27 const webrtc::DesktopRegion& region, |
| 28 const webrtc::DesktopRegion& shape) { |
28 if (!task_runner_->BelongsToCurrentThread()) { | 29 if (!task_runner_->BelongsToCurrentThread()) { |
29 task_runner_->PostTask(FROM_HERE, base::Bind( | 30 task_runner_->PostTask(FROM_HERE, base::Bind( |
30 &FrameConsumerProxy::ApplyBuffer, this, | 31 &FrameConsumerProxy::ApplyBuffer, this, |
31 view_size, clip_area, buffer, region)); | 32 view_size, clip_area, buffer, region, shape)); |
32 return; | 33 return; |
33 } | 34 } |
34 | 35 |
35 if (frame_consumer_.get()) | 36 if (frame_consumer_.get()) |
36 frame_consumer_->ApplyBuffer(view_size, clip_area, buffer, region); | 37 frame_consumer_->ApplyBuffer(view_size, clip_area, buffer, region, shape); |
37 } | 38 } |
38 | 39 |
39 void FrameConsumerProxy::ReturnBuffer(webrtc::DesktopFrame* buffer) { | 40 void FrameConsumerProxy::ReturnBuffer(webrtc::DesktopFrame* buffer) { |
40 if (!task_runner_->BelongsToCurrentThread()) { | 41 if (!task_runner_->BelongsToCurrentThread()) { |
41 task_runner_->PostTask(FROM_HERE, base::Bind( | 42 task_runner_->PostTask(FROM_HERE, base::Bind( |
42 &FrameConsumerProxy::ReturnBuffer, this, buffer)); | 43 &FrameConsumerProxy::ReturnBuffer, this, buffer)); |
43 return; | 44 return; |
44 } | 45 } |
45 | 46 |
46 if (frame_consumer_.get()) | 47 if (frame_consumer_.get()) |
(...skipping 14 matching lines...) Expand all Loading... |
61 } | 62 } |
62 | 63 |
63 FrameConsumer::PixelFormat FrameConsumerProxy::GetPixelFormat() { | 64 FrameConsumer::PixelFormat FrameConsumerProxy::GetPixelFormat() { |
64 return pixel_format_; | 65 return pixel_format_; |
65 } | 66 } |
66 | 67 |
67 FrameConsumerProxy::~FrameConsumerProxy() { | 68 FrameConsumerProxy::~FrameConsumerProxy() { |
68 } | 69 } |
69 | 70 |
70 } // namespace remoting | 71 } // namespace remoting |
OLD | NEW |