| 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/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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_shape.h" | 24 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_shape.h" |
| 25 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 25 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 26 | 26 |
| 27 namespace remoting { | 27 namespace remoting { |
| 28 | 28 |
| 29 // Maximum number of frames that can be processed simultaneously. | 29 // Maximum number of frames that can be processed simultaneously. |
| 30 // TODO(hclam): Move this value to CaptureScheduler. | 30 // TODO(hclam): Move this value to CaptureScheduler. |
| 31 static const int kMaxPendingFrames = 2; | 31 static const int kMaxPendingFrames = 2; |
| 32 | 32 |
| 33 // Interval between empty keep-alive frames. These frames are sent only | 33 // Interval between empty keep-alive frames. These frames are sent only |
| 34 // when there are no real video frames being sent. | 34 // when there are no real video frames being sent. To prevent PseudoTCP from |
| 35 static const int kKeepAlivePacketIntervalMs = 500; | 35 // resetting congestion window this value must be smaller that then the minimum |
| 36 // RTO used in PseudoTCP, which is 250ms. |
| 37 static const int kKeepAlivePacketIntervalMs = 200; |
| 36 | 38 |
| 37 VideoScheduler::VideoScheduler( | 39 VideoScheduler::VideoScheduler( |
| 38 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | 40 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
| 39 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, | 41 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, |
| 40 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 41 scoped_ptr<webrtc::ScreenCapturer> capturer, | 43 scoped_ptr<webrtc::ScreenCapturer> capturer, |
| 42 scoped_ptr<VideoEncoder> encoder, | 44 scoped_ptr<VideoEncoder> encoder, |
| 43 protocol::CursorShapeStub* cursor_stub, | 45 protocol::CursorShapeStub* cursor_stub, |
| 44 protocol::VideoStub* video_stub) | 46 protocol::VideoStub* video_stub) |
| 45 : capture_task_runner_(capture_task_runner), | 47 : capture_task_runner_(capture_task_runner), |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 frame.reset(); | 354 frame.reset(); |
| 353 | 355 |
| 354 scheduler_.RecordEncodeTime( | 356 scheduler_.RecordEncodeTime( |
| 355 base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); | 357 base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); |
| 356 network_task_runner_->PostTask( | 358 network_task_runner_->PostTask( |
| 357 FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, | 359 FROM_HERE, base::Bind(&VideoScheduler::SendVideoPacket, this, |
| 358 base::Passed(&packet))); | 360 base::Passed(&packet))); |
| 359 } | 361 } |
| 360 | 362 |
| 361 } // namespace remoting | 363 } // namespace remoting |
| OLD | NEW |