Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: remoting/host/video_scheduler.cc

Issue 11470028: Move screen capturers to remoting/capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/video_scheduler.h" 5 #include "remoting/host/video_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop_proxy.h" 13 #include "base/message_loop_proxy.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/sys_info.h" 15 #include "base/sys_info.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "remoting/base/capture_data.h" 17 #include "remoting/capturer/capture_data.h"
18 #include "remoting/host/video_frame_capturer.h" 18 #include "remoting/capturer/mouse_cursor_shape.h"
19 #include "remoting/capturer/video_frame_capturer.h"
19 #include "remoting/proto/control.pb.h" 20 #include "remoting/proto/control.pb.h"
20 #include "remoting/proto/internal.pb.h" 21 #include "remoting/proto/internal.pb.h"
21 #include "remoting/proto/video.pb.h" 22 #include "remoting/proto/video.pb.h"
22 #include "remoting/protocol/client_stub.h" 23 #include "remoting/protocol/client_stub.h"
23 #include "remoting/protocol/message_decoder.h" 24 #include "remoting/protocol/message_decoder.h"
24 #include "remoting/protocol/video_stub.h" 25 #include "remoting/protocol/video_stub.h"
25 #include "remoting/protocol/util.h" 26 #include "remoting/protocol/util.h"
26 27
27 namespace remoting { 28 namespace remoting {
28 29
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // accurate as long as capture is synchronous as the following statement 75 // accurate as long as capture is synchronous as the following statement
75 // will obtain the most recent sequence number received. 76 // will obtain the most recent sequence number received.
76 capture_data->set_client_sequence_number(sequence_number_); 77 capture_data->set_client_sequence_number(sequence_number_);
77 } 78 }
78 79
79 encode_task_runner_->PostTask( 80 encode_task_runner_->PostTask(
80 FROM_HERE, base::Bind(&VideoScheduler::EncodeFrame, this, capture_data)); 81 FROM_HERE, base::Bind(&VideoScheduler::EncodeFrame, this, capture_data));
81 } 82 }
82 83
83 void VideoScheduler::OnCursorShapeChanged( 84 void VideoScheduler::OnCursorShapeChanged(
84 scoped_ptr<protocol::CursorShapeInfo> cursor_shape) { 85 const MouseCursorShape& cursor_shape) {
85 DCHECK(capture_task_runner_->BelongsToCurrentThread()); 86 DCHECK(capture_task_runner_->BelongsToCurrentThread());
86 87
88 scoped_ptr<protocol::CursorShapeInfo> cursor_proto(
89 new protocol::CursorShapeInfo());
90 cursor_proto->set_width(cursor_shape.width);
91 cursor_proto->set_height(cursor_shape.height);
92 cursor_proto->set_hotspot_x(cursor_shape.hotspot_x);
93 cursor_proto->set_hotspot_y(cursor_shape.hotspot_y);
94 cursor_proto->set_data(cursor_shape.data);
95
87 network_task_runner_->PostTask( 96 network_task_runner_->PostTask(
88 FROM_HERE, base::Bind(&VideoScheduler::SendCursorShape, this, 97 FROM_HERE, base::Bind(&VideoScheduler::SendCursorShape, this,
89 base::Passed(&cursor_shape))); 98 base::Passed(&cursor_proto)));
90 } 99 }
91 100
92 void VideoScheduler::Stop(const base::Closure& done_task) { 101 void VideoScheduler::Stop(const base::Closure& done_task) {
93 DCHECK(network_task_runner_->BelongsToCurrentThread()); 102 DCHECK(network_task_runner_->BelongsToCurrentThread());
94 DCHECK(!done_task.is_null()); 103 DCHECK(!done_task.is_null());
95 104
96 // Clear stubs to prevent further updates reaching the client. 105 // Clear stubs to prevent further updates reaching the client.
97 cursor_stub_ = NULL; 106 cursor_stub_ = NULL;
98 video_stub_ = NULL; 107 video_stub_ = NULL;
99 108
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 scheduler_.RecordEncodeTime( 288 scheduler_.RecordEncodeTime(
280 base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); 289 base::TimeDelta::FromMilliseconds(packet->encode_time_ms()));
281 } 290 }
282 291
283 network_task_runner_->PostTask( 292 network_task_runner_->PostTask(
284 FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, 293 FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this,
285 base::Passed(&packet))); 294 base::Passed(&packet)));
286 } 295 }
287 296
288 } // namespace remoting 297 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698