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

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

Issue 455073004: Switch DesktopEnvironment to return a DesktopCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove ShapedDesktopCapturer::Create() Created 6 years, 4 months 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
« no previous file with comments | « remoting/host/video_scheduler.h ('k') | remoting/host/video_scheduler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop_proxy.h" 13 #include "base/message_loop/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/time.h" 16 #include "base/time/time.h"
17 #include "remoting/proto/control.pb.h" 17 #include "remoting/proto/control.pb.h"
18 #include "remoting/proto/internal.pb.h" 18 #include "remoting/proto/internal.pb.h"
19 #include "remoting/proto/video.pb.h" 19 #include "remoting/proto/video.pb.h"
20 #include "remoting/protocol/cursor_shape_stub.h" 20 #include "remoting/protocol/cursor_shape_stub.h"
21 #include "remoting/protocol/message_decoder.h" 21 #include "remoting/protocol/message_decoder.h"
22 #include "remoting/protocol/video_stub.h" 22 #include "remoting/protocol/video_stub.h"
23 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
23 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 24 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
24 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" 25 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h"
25 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_shape.h" 26 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_shape.h"
26 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
27 27
28 namespace remoting { 28 namespace remoting {
29 29
30 // Maximum number of frames that can be processed simultaneously. 30 // Maximum number of frames that can be processed simultaneously.
31 // TODO(hclam): Move this value to CaptureScheduler. 31 // TODO(hclam): Move this value to CaptureScheduler.
32 static const int kMaxPendingFrames = 2; 32 static const int kMaxPendingFrames = 2;
33 33
34 // Interval between empty keep-alive frames. These frames are sent only 34 // Interval between empty keep-alive frames. These frames are sent only
35 // when there are no real video frames being sent. To prevent PseudoTCP from 35 // when there are no real video frames being sent. To prevent PseudoTCP from
36 // resetting congestion window this value must be smaller than the minimum 36 // resetting congestion window this value must be smaller than the minimum
37 // RTO used in PseudoTCP, which is 250ms. 37 // RTO used in PseudoTCP, which is 250ms.
38 static const int kKeepAlivePacketIntervalMs = 200; 38 static const int kKeepAlivePacketIntervalMs = 200;
39 39
40 static bool g_enable_timestamps = false; 40 static bool g_enable_timestamps = false;
41 41
42 // static 42 // static
43 void VideoScheduler::EnableTimestampsForTests() { 43 void VideoScheduler::EnableTimestampsForTests() {
44 g_enable_timestamps = true; 44 g_enable_timestamps = true;
45 } 45 }
46 46
47 VideoScheduler::VideoScheduler( 47 VideoScheduler::VideoScheduler(
48 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, 48 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
49 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, 49 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
50 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, 50 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
51 scoped_ptr<webrtc::ScreenCapturer> capturer, 51 scoped_ptr<webrtc::DesktopCapturer> capturer,
52 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, 52 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor,
53 scoped_ptr<VideoEncoder> encoder, 53 scoped_ptr<VideoEncoder> encoder,
54 protocol::CursorShapeStub* cursor_stub, 54 protocol::CursorShapeStub* cursor_stub,
55 protocol::VideoStub* video_stub) 55 protocol::VideoStub* video_stub)
56 : capture_task_runner_(capture_task_runner), 56 : capture_task_runner_(capture_task_runner),
57 encode_task_runner_(encode_task_runner), 57 encode_task_runner_(encode_task_runner),
58 network_task_runner_(network_task_runner), 58 network_task_runner_(network_task_runner),
59 capturer_(capturer.Pass()), 59 capturer_(capturer.Pass()),
60 mouse_cursor_monitor_(mouse_cursor_monitor.Pass()), 60 mouse_cursor_monitor_(mouse_cursor_monitor.Pass()),
61 encoder_(encoder.Pass()), 61 encoder_(encoder.Pass()),
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 frame.reset(); 395 frame.reset();
396 396
397 scheduler_.RecordEncodeTime( 397 scheduler_.RecordEncodeTime(
398 base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); 398 base::TimeDelta::FromMilliseconds(packet->encode_time_ms()));
399 network_task_runner_->PostTask( 399 network_task_runner_->PostTask(
400 FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, 400 FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this,
401 base::Passed(&packet))); 401 base::Passed(&packet)));
402 } 402 }
403 403
404 } // namespace remoting 404 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/video_scheduler.h ('k') | remoting/host/video_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698