| 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/host/desktop_session_agent.h" | 5 #include "remoting/host/desktop_session_agent.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ipc/ipc_channel_proxy.h" | 8 #include "ipc/ipc_channel_proxy.h" |
| 9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
| 10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 // Start the video capturer. | 211 // Start the video capturer. |
| 212 video_capture_task_runner()->PostTask( | 212 video_capture_task_runner()->PostTask( |
| 213 FROM_HERE, base::Bind(&DesktopSessionAgent::StartVideoCapturer, this)); | 213 FROM_HERE, base::Bind(&DesktopSessionAgent::StartVideoCapturer, this)); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void DesktopSessionAgent::OnCaptureCompleted( | 216 void DesktopSessionAgent::OnCaptureCompleted( |
| 217 scoped_refptr<CaptureData> capture_data) { | 217 scoped_refptr<CaptureData> capture_data) { |
| 218 DCHECK(video_capture_task_runner()->BelongsToCurrentThread()); | 218 DCHECK(video_capture_task_runner()->BelongsToCurrentThread()); |
| 219 | 219 |
| 220 size_most_recent_ = capture_data->size(); |
| 221 |
| 220 // Serialize CaptureData | 222 // Serialize CaptureData |
| 221 SerializedCapturedData serialized_data; | 223 SerializedCapturedData serialized_data; |
| 222 serialized_data.shared_buffer_id = capture_data->shared_buffer()->id(); | 224 serialized_data.shared_buffer_id = capture_data->shared_buffer()->id(); |
| 223 serialized_data.bytes_per_row = capture_data->stride(); | 225 serialized_data.bytes_per_row = capture_data->stride(); |
| 224 serialized_data.dimensions = capture_data->size(); | 226 serialized_data.dimensions = capture_data->size(); |
| 225 serialized_data.capture_time_ms = capture_data->capture_time_ms(); | 227 serialized_data.capture_time_ms = capture_data->capture_time_ms(); |
| 226 serialized_data.client_sequence_number = | 228 serialized_data.client_sequence_number = |
| 227 capture_data->client_sequence_number(); | 229 capture_data->client_sequence_number(); |
| 228 serialized_data.dpi = capture_data->dpi(); | 230 serialized_data.dpi = capture_data->dpi(); |
| 229 for (SkRegion::Iterator i(capture_data->dirty_region()); !i.done(); i.next()) | 231 for (SkRegion::Iterator i(capture_data->dirty_region()); !i.done(); i.next()) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 void DesktopSessionAgent::OnInvalidateRegion( | 336 void DesktopSessionAgent::OnInvalidateRegion( |
| 335 const std::vector<SkIRect>& invalid_rects) { | 337 const std::vector<SkIRect>& invalid_rects) { |
| 336 if (!video_capture_task_runner()->BelongsToCurrentThread()) { | 338 if (!video_capture_task_runner()->BelongsToCurrentThread()) { |
| 337 video_capture_task_runner()->PostTask( | 339 video_capture_task_runner()->PostTask( |
| 338 FROM_HERE, | 340 FROM_HERE, |
| 339 base::Bind(&DesktopSessionAgent::OnInvalidateRegion, this, | 341 base::Bind(&DesktopSessionAgent::OnInvalidateRegion, this, |
| 340 invalid_rects)); | 342 invalid_rects)); |
| 341 return; | 343 return; |
| 342 } | 344 } |
| 343 | 345 |
| 344 SkIRect bounds = SkIRect::MakeSize(video_capturer_->size_most_recent()); | 346 SkIRect bounds = SkIRect::MakeSize(size_most_recent_); |
| 345 | 347 |
| 346 // Convert |invalid_rects| into a region. | 348 // Convert |invalid_rects| into a region. |
| 347 SkRegion invalid_region; | 349 SkRegion invalid_region; |
| 348 for (std::vector<SkIRect>::const_iterator i = invalid_rects.begin(); | 350 for (std::vector<SkIRect>::const_iterator i = invalid_rects.begin(); |
| 349 i != invalid_rects.end(); ++i) { | 351 i != invalid_rects.end(); ++i) { |
| 350 // Validate each rectange and clip it to the frame bounds. If the rectangle | 352 // Validate each rectange and clip it to the frame bounds. If the rectangle |
| 351 // is not valid it is ignored. | 353 // is not valid it is ignored. |
| 352 SkIRect rect; | 354 SkIRect rect; |
| 353 if (rect.intersect(*i, bounds)) { | 355 if (rect.intersect(*i, bounds)) { |
| 354 invalid_region.op(rect, SkRegion::kUnion_Op); | 356 invalid_region.op(rect, SkRegion::kUnion_Op); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 508 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 507 scoped_refptr<AutoThreadTaskRunner> input_task_runner, | 509 scoped_refptr<AutoThreadTaskRunner> input_task_runner, |
| 508 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 510 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 509 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) | 511 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner) |
| 510 : audio_capture_task_runner_(audio_capture_task_runner), | 512 : audio_capture_task_runner_(audio_capture_task_runner), |
| 511 caller_task_runner_(caller_task_runner), | 513 caller_task_runner_(caller_task_runner), |
| 512 input_task_runner_(input_task_runner), | 514 input_task_runner_(input_task_runner), |
| 513 io_task_runner_(io_task_runner), | 515 io_task_runner_(io_task_runner), |
| 514 video_capture_task_runner_(video_capture_task_runner), | 516 video_capture_task_runner_(video_capture_task_runner), |
| 515 next_shared_buffer_id_(1), | 517 next_shared_buffer_id_(1), |
| 518 size_most_recent_(SkISize::Make(0, 0)), |
| 516 started_(false) { | 519 started_(false) { |
| 517 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 520 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 518 } | 521 } |
| 519 | 522 |
| 520 } // namespace remoting | 523 } // namespace remoting |
| OLD | NEW |