summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2015-02-05 15:53:14 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-05 23:54:32 +0000
commit10ce97b93303fbaae04e340537bb7d964ccf542b (patch)
tree83b601b263d073acf96e3203d9de4ad6a2318426
parentb73c88950e945e1f0a97ba90db9f89cd55b1bd87 (diff)
downloadchromium_src-10ce97b93303fbaae04e340537bb7d964ccf542b.zip
chromium_src-10ce97b93303fbaae04e340537bb7d964ccf542b.tar.gz
chromium_src-10ce97b93303fbaae04e340537bb7d964ccf542b.tar.bz2
Rename VideoScheduler->VideoFramePump.
BUG=455818 Review URL: https://codereview.chromium.org/893353002 Cr-Commit-Position: refs/heads/master@{#314917}
-rw-r--r--remoting/host/capture_scheduler.h2
-rw-r--r--remoting/host/chromeos/aura_desktop_capturer.cc2
-rw-r--r--remoting/host/chromoting_host.h2
-rw-r--r--remoting/host/client_session.cc52
-rw-r--r--remoting/host/client_session.h6
-rw-r--r--remoting/host/client_session_unittest.cc2
-rw-r--r--remoting/host/video_frame_pump.cc (renamed from remoting/host/video_scheduler.cc)72
-rw-r--r--remoting/host/video_frame_pump.h (renamed from remoting/host/video_scheduler.h)29
-rw-r--r--remoting/host/video_frame_pump_unittest.cc (renamed from remoting/host/video_scheduler_unittest.cc)66
-rw-r--r--remoting/remoting_host_srcs.gypi4
-rw-r--r--remoting/remoting_test.gypi2
-rw-r--r--remoting/test/protocol_perftest.cc4
12 files changed, 121 insertions, 122 deletions
diff --git a/remoting/host/capture_scheduler.h b/remoting/host/capture_scheduler.h
index 5f978da..b3136e7 100644
--- a/remoting/host/capture_scheduler.h
+++ b/remoting/host/capture_scheduler.h
@@ -18,7 +18,7 @@
namespace remoting {
-// CaptureScheduler is used by the VideoScheduler to schedule frame capturer,
+// CaptureScheduler is used by the VideoFramePump to schedule frame capturer,
// taking into account capture delay, encoder delay, network bandwidth, etc.
class CaptureScheduler : public base::NonThreadSafe {
public:
diff --git a/remoting/host/chromeos/aura_desktop_capturer.cc b/remoting/host/chromeos/aura_desktop_capturer.cc
index d37ae32..d996a97 100644
--- a/remoting/host/chromeos/aura_desktop_capturer.cc
+++ b/remoting/host/chromeos/aura_desktop_capturer.cc
@@ -61,7 +61,7 @@ void AuraDesktopCapturer::OnFrameCaptured(
scoped_ptr<webrtc::DesktopFrame> frame(
SkiaBitmapDesktopFrame::Create(bitmap.Pass()));
- // |VideoScheduler| will not encode the frame if |updated_region| is empty.
+ // |VideoFramePump| will not encode the frame if |updated_region| is empty.
const webrtc::DesktopRect& rect = webrtc::DesktopRect::MakeWH(
frame->size().width(), frame->size().height());
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index 878b3a8..a6b1811 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -49,7 +49,7 @@ class DesktopEnvironmentFactory;
//
// 2. We listen for incoming connection using libjingle. We will create
// a ConnectionToClient object that wraps around linjingle for transport.
-// A VideoScheduler is created with an Encoder and a webrtc::DesktopCapturer.
+// A VideoFramePump is created with an Encoder and a webrtc::DesktopCapturer.
// A ConnectionToClient is added to the ScreenRecorder for transporting
// the screen captures. An InputStub is created and registered with the
// ConnectionToClient to receive mouse / keyboard events from the remote
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 6fae325..1874f24 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -22,7 +22,7 @@
#include "remoting/host/input_injector.h"
#include "remoting/host/screen_controls.h"
#include "remoting/host/screen_resolution.h"
-#include "remoting/host/video_scheduler.h"
+#include "remoting/host/video_frame_pump.h"
#include "remoting/proto/control.pb.h"
#include "remoting/proto/event.pb.h"
#include "remoting/protocol/client_stub.h"
@@ -101,7 +101,7 @@ ClientSession::~ClientSession() {
DCHECK(!desktop_environment_);
DCHECK(!input_injector_);
DCHECK(!screen_controls_);
- DCHECK(!video_scheduler_.get());
+ DCHECK(!video_frame_pump_.get());
connection_.reset();
}
@@ -136,28 +136,28 @@ void ClientSession::NotifyClientResolution(
void ClientSession::ControlVideo(const protocol::VideoControl& video_control) {
DCHECK(CalledOnValidThread());
- // Note that |video_scheduler_| may be null, depending upon whether extensions
- // choose to wrap or "steal" the video capturer or encoder.
+ // Note that |video_frame_pump_| may be null, depending upon whether
+ // extensions choose to wrap or "steal" the video capturer or encoder.
if (video_control.has_enable()) {
VLOG(1) << "Received VideoControl (enable="
<< video_control.enable() << ")";
pause_video_ = !video_control.enable();
- if (video_scheduler_.get())
- video_scheduler_->Pause(pause_video_);
+ if (video_frame_pump_.get())
+ video_frame_pump_->Pause(pause_video_);
}
if (video_control.has_lossless_encode()) {
VLOG(1) << "Received VideoControl (lossless_encode="
<< video_control.lossless_encode() << ")";
lossless_video_encode_ = video_control.lossless_encode();
- if (video_scheduler_.get())
- video_scheduler_->SetLosslessEncode(lossless_video_encode_);
+ if (video_frame_pump_.get())
+ video_frame_pump_->SetLosslessEncode(lossless_video_encode_);
}
if (video_control.has_lossless_color()) {
VLOG(1) << "Received VideoControl (lossless_color="
<< video_control.lossless_color() << ")";
lossless_video_color_ = video_control.lossless_color();
- if (video_scheduler_.get())
- video_scheduler_->SetLosslessColor(lossless_video_color_);
+ if (video_frame_pump_.get())
+ video_frame_pump_->SetLosslessColor(lossless_video_color_);
}
}
@@ -250,7 +250,7 @@ void ClientSession::OnConnectionAuthenticated(
DCHECK(!desktop_environment_);
DCHECK(!input_injector_);
DCHECK(!screen_controls_);
- DCHECK(!video_scheduler_.get());
+ DCHECK(!video_frame_pump_.get());
auth_input_filter_.set_enabled(true);
auth_clipboard_filter_.set_enabled(true);
@@ -368,9 +368,9 @@ void ClientSession::OnConnectionClosed(
audio_scheduler_->Stop();
audio_scheduler_ = nullptr;
}
- if (video_scheduler_.get()) {
- video_scheduler_->Stop();
- video_scheduler_ = nullptr;
+ if (video_frame_pump_.get()) {
+ video_frame_pump_->Stop();
+ video_frame_pump_ = nullptr;
}
client_clipboard_factory_.InvalidateWeakPtrs();
@@ -388,8 +388,8 @@ void ClientSession::OnEventTimestamp(protocol::ConnectionToClient* connection,
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
- if (video_scheduler_.get())
- video_scheduler_->SetLatestEventTimestamp(timestamp);
+ if (video_frame_pump_.get())
+ video_frame_pump_->SetLatestEventTimestamp(timestamp);
}
void ClientSession::OnRouteChange(
@@ -434,9 +434,9 @@ void ClientSession::SetDisableInputs(bool disable_inputs) {
void ClientSession::ResetVideoPipeline() {
DCHECK(CalledOnValidThread());
- if (video_scheduler_.get()) {
- video_scheduler_->Stop();
- video_scheduler_ = nullptr;
+ if (video_frame_pump_.get()) {
+ video_frame_pump_->Stop();
+ video_frame_pump_ = nullptr;
}
// Create VideoEncoder and DesktopCapturer to match the session's video
@@ -448,12 +448,12 @@ void ClientSession::ResetVideoPipeline() {
CreateVideoEncoder(connection_->session()->config());
extension_manager_->OnCreateVideoEncoder(&video_encoder);
- // Don't start the VideoScheduler if either capturer or encoder are missing.
+ // Don't start the VideoFramePump if either capturer or encoder are missing.
if (!video_capturer || !video_encoder)
return;
- // Create a VideoScheduler to pump frames from the capturer to the client.
- video_scheduler_ = new VideoScheduler(
+ // Create a VideoFramePump to pump frames from the capturer to the client.
+ video_frame_pump_ = new VideoFramePump(
video_capture_task_runner_,
video_encode_task_runner_,
network_task_runner_,
@@ -464,14 +464,14 @@ void ClientSession::ResetVideoPipeline() {
&mouse_clamping_filter_);
// Apply video-control parameters to the new scheduler.
- video_scheduler_->SetLosslessEncode(lossless_video_encode_);
- video_scheduler_->SetLosslessColor(lossless_video_color_);
+ video_frame_pump_->SetLosslessEncode(lossless_video_encode_);
+ video_frame_pump_->SetLosslessColor(lossless_video_color_);
// Start capturing the screen.
- video_scheduler_->Start();
+ video_frame_pump_->Start();
// Pause capturing if necessary.
- video_scheduler_->Pause(pause_video_);
+ video_frame_pump_->Pause(pause_video_);
}
void ClientSession::SetGnubbyAuthHandlerForTesting(
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 58c5ec0..05f8b7f 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -42,7 +42,7 @@ class DesktopEnvironmentFactory;
class InputInjector;
class ScreenControls;
class VideoEncoder;
-class VideoScheduler;
+class VideoFramePump;
// A ClientSession keeps a reference to a connection to a client, and maintains
// per-client state.
@@ -219,10 +219,10 @@ class ClientSession
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
// Schedulers for audio and video capture.
- // |video_scheduler_| may be nullptr if the video channel is not required -
+ // |video_frame_pump_| may be nullptr if the video channel is not required -
// see ResetVideoPipeline().
scoped_refptr<AudioScheduler> audio_scheduler_;
- scoped_refptr<VideoScheduler> video_scheduler_;
+ scoped_refptr<VideoFramePump> video_frame_pump_;
// The set of all capabilities supported by the client.
scoped_ptr<std::string> client_capabilities_;
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc
index 0f0898e..3138454 100644
--- a/remoting/host/client_session_unittest.cc
+++ b/remoting/host/client_session_unittest.cc
@@ -774,7 +774,7 @@ TEST_F(ClientSessionTest, Extensions) {
}
// Verifies that an extension can "steal" the video capture, in which case no
-// VideoScheduler is instantiated.
+// VideoFramePump is instantiated.
TEST_F(ClientSessionTest, StealVideoCapturer) {
FakeExtension extension("ext1", "cap1");
extensions_.push_back(&extension);
diff --git a/remoting/host/video_scheduler.cc b/remoting/host/video_frame_pump.cc
index ea57e8a..4c82ece 100644
--- a/remoting/host/video_scheduler.cc
+++ b/remoting/host/video_frame_pump.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/host/video_scheduler.h"
+#include "remoting/host/video_frame_pump.h"
#include <algorithm>
@@ -52,11 +52,11 @@ static const int kKeepAlivePacketIntervalMs = 200;
static bool g_enable_timestamps = false;
// static
-void VideoScheduler::EnableTimestampsForTests() {
+void VideoFramePump::EnableTimestampsForTests() {
g_enable_timestamps = true;
}
-VideoScheduler::VideoScheduler(
+VideoFramePump::VideoFramePump(
scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
@@ -84,22 +84,22 @@ VideoScheduler::VideoScheduler(
// Public methods --------------------------------------------------------------
-void VideoScheduler::Start() {
+void VideoFramePump::Start() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
- keep_alive_timer_.reset(new base::DelayTimer<VideoScheduler>(
+ keep_alive_timer_.reset(new base::DelayTimer<VideoFramePump>(
FROM_HERE, base::TimeDelta::FromMilliseconds(kKeepAlivePacketIntervalMs),
- this, &VideoScheduler::SendKeepAlivePacket));
+ this, &VideoFramePump::SendKeepAlivePacket));
capture_scheduler_.reset(new CaptureScheduler(
- base::Bind(&VideoScheduler::CaptureNextFrame, this)));
+ base::Bind(&VideoFramePump::CaptureNextFrame, this)));
capture_scheduler_->Start();
capture_task_runner_->PostTask(
- FROM_HERE, base::Bind(&VideoScheduler::StartOnCaptureThread, this));
+ FROM_HERE, base::Bind(&VideoFramePump::StartOnCaptureThread, this));
}
-void VideoScheduler::Stop() {
+void VideoFramePump::Stop() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
// Clear stubs to prevent further updates reaching the client.
@@ -110,22 +110,22 @@ void VideoScheduler::Stop() {
keep_alive_timer_.reset();
capture_task_runner_->PostTask(
- FROM_HERE, base::Bind(&VideoScheduler::StopOnCaptureThread, this));
+ FROM_HERE, base::Bind(&VideoFramePump::StopOnCaptureThread, this));
}
-void VideoScheduler::Pause(bool pause) {
+void VideoFramePump::Pause(bool pause) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
capture_scheduler_->Pause(pause);
}
-void VideoScheduler::SetLatestEventTimestamp(int64 latest_event_timestamp) {
+void VideoFramePump::SetLatestEventTimestamp(int64 latest_event_timestamp) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
latest_event_timestamp_ = latest_event_timestamp;
}
-void VideoScheduler::SetLosslessEncode(bool want_lossless) {
+void VideoFramePump::SetLosslessEncode(bool want_lossless) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
encode_task_runner_->PostTask(
@@ -133,7 +133,7 @@ void VideoScheduler::SetLosslessEncode(bool want_lossless) {
base::Unretained(encoder_.get()), want_lossless));
}
-void VideoScheduler::SetLosslessColor(bool want_lossless) {
+void VideoFramePump::SetLosslessColor(bool want_lossless) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
encode_task_runner_->PostTask(
@@ -143,7 +143,7 @@ void VideoScheduler::SetLosslessColor(bool want_lossless) {
// Private methods -----------------------------------------------------------
-VideoScheduler::~VideoScheduler() {
+VideoFramePump::~VideoFramePump() {
// Destroy the capturer and encoder on their respective threads.
capture_task_runner_->DeleteSoon(FROM_HERE, capturer_.release());
capture_task_runner_->DeleteSoon(FROM_HERE, mouse_cursor_monitor_.release());
@@ -152,19 +152,19 @@ VideoScheduler::~VideoScheduler() {
// Capturer thread -------------------------------------------------------------
-webrtc::SharedMemory* VideoScheduler::CreateSharedMemory(size_t size) {
+webrtc::SharedMemory* VideoFramePump::CreateSharedMemory(size_t size) {
return nullptr;
}
-void VideoScheduler::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
+void VideoFramePump::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
DCHECK(capture_task_runner_->BelongsToCurrentThread());
network_task_runner_->PostTask(
- FROM_HERE, base::Bind(&VideoScheduler::EncodeAndSendFrame, this,
+ FROM_HERE, base::Bind(&VideoFramePump::EncodeAndSendFrame, this,
base::Passed(make_scoped_ptr(frame))));
}
-void VideoScheduler::OnMouseCursor(webrtc::MouseCursor* cursor) {
+void VideoFramePump::OnMouseCursor(webrtc::MouseCursor* cursor) {
DCHECK(capture_task_runner_->BelongsToCurrentThread());
scoped_ptr<webrtc::MouseCursor> owned_cursor(cursor);
@@ -187,25 +187,25 @@ void VideoScheduler::OnMouseCursor(webrtc::MouseCursor* cursor) {
}
network_task_runner_->PostTask(
- FROM_HERE, base::Bind(&VideoScheduler::SendCursorShape, this,
+ FROM_HERE, base::Bind(&VideoFramePump::SendCursorShape, this,
base::Passed(&cursor_proto)));
}
-void VideoScheduler::OnMouseCursorPosition(
+void VideoFramePump::OnMouseCursorPosition(
webrtc::MouseCursorMonitor::CursorState state,
const webrtc::DesktopVector& position) {
// We're not subscribing to mouse position changes.
NOTREACHED();
}
-void VideoScheduler::StartOnCaptureThread() {
+void VideoFramePump::StartOnCaptureThread() {
DCHECK(capture_task_runner_->BelongsToCurrentThread());
mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY);
capturer_->Start(this);
}
-void VideoScheduler::StopOnCaptureThread() {
+void VideoFramePump::StopOnCaptureThread() {
DCHECK(capture_task_runner_->BelongsToCurrentThread());
// This doesn't deleted already captured frames, so encoder can keep using the
@@ -215,7 +215,7 @@ void VideoScheduler::StopOnCaptureThread() {
mouse_cursor_monitor_.reset();
}
-void VideoScheduler::CaptureNextFrameOnCaptureThread() {
+void VideoFramePump::CaptureNextFrameOnCaptureThread() {
DCHECK(capture_task_runner_->BelongsToCurrentThread());
// Capture mouse shape first and then screen content.
@@ -225,15 +225,15 @@ void VideoScheduler::CaptureNextFrameOnCaptureThread() {
// Network thread --------------------------------------------------------------
-void VideoScheduler::CaptureNextFrame() {
+void VideoFramePump::CaptureNextFrame() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
capture_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&VideoScheduler::CaptureNextFrameOnCaptureThread, this));
+ base::Bind(&VideoFramePump::CaptureNextFrameOnCaptureThread, this));
}
-void VideoScheduler::EncodeAndSendFrame(
+void VideoFramePump::EncodeAndSendFrame(
scoped_ptr<webrtc::DesktopFrame> frame) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
@@ -248,11 +248,11 @@ void VideoScheduler::EncodeAndSendFrame(
base::PostTaskAndReplyWithResult(
encode_task_runner_.get(), FROM_HERE,
base::Bind(&EncodeFrame, encoder_.get(), base::Passed(&frame)),
- base::Bind(&VideoScheduler::SendEncodedFrame, this,
+ base::Bind(&VideoFramePump::SendEncodedFrame, this,
latest_event_timestamp_, base::TimeTicks::Now()));
}
-void VideoScheduler::SendEncodedFrame(int64 latest_event_timestamp,
+void VideoFramePump::SendEncodedFrame(int64 latest_event_timestamp,
base::TimeTicks timestamp,
scoped_ptr<VideoPacket> packet) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
@@ -269,10 +269,10 @@ void VideoScheduler::SendEncodedFrame(int64 latest_event_timestamp,
base::TimeDelta::FromMilliseconds(packet->encode_time_ms()));
video_stub_->ProcessVideoPacket(
- packet.Pass(), base::Bind(&VideoScheduler::OnVideoPacketSent, this));
+ packet.Pass(), base::Bind(&VideoFramePump::OnVideoPacketSent, this));
}
-void VideoScheduler::OnVideoPacketSent() {
+void VideoFramePump::OnVideoPacketSent() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
if (!video_stub_)
@@ -282,22 +282,22 @@ void VideoScheduler::OnVideoPacketSent() {
keep_alive_timer_->Reset();
}
-void VideoScheduler::SendKeepAlivePacket() {
+void VideoFramePump::SendKeepAlivePacket() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
video_stub_->ProcessVideoPacket(
make_scoped_ptr(new VideoPacket()),
- base::Bind(&VideoScheduler::OnKeepAlivePacketSent, this));
+ base::Bind(&VideoFramePump::OnKeepAlivePacketSent, this));
}
-void VideoScheduler::OnKeepAlivePacketSent() {
+void VideoFramePump::OnKeepAlivePacketSent() {
DCHECK(network_task_runner_->BelongsToCurrentThread());
if (keep_alive_timer_)
keep_alive_timer_->Reset();
}
-void VideoScheduler::SendCursorShape(
+void VideoFramePump::SendCursorShape(
scoped_ptr<protocol::CursorShapeInfo> cursor_shape) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
diff --git a/remoting/host/video_scheduler.h b/remoting/host/video_frame_pump.h
index 6adab18..90fea78 100644
--- a/remoting/host/video_scheduler.h
+++ b/remoting/host/video_frame_pump.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef REMOTING_HOST_VIDEO_SCHEDULER_H_
-#define REMOTING_HOST_VIDEO_SCHEDULER_H_
+#ifndef REMOTING_HOST_VIDEO_FRAME_PUMP_H_
+#define REMOTING_HOST_VIDEO_FRAME_PUMP_H_
#include <vector>
@@ -28,7 +28,6 @@ class DesktopCapturer;
namespace remoting {
class CaptureScheduler;
-class CursorShapeInfo;
namespace protocol {
class CursorShapeInfo;
@@ -68,24 +67,24 @@ class VideoStub;
// | Time
// v
//
-// VideoScheduler would ideally schedule captures so as to saturate the slowest
+// VideoFramePump would ideally schedule captures so as to saturate the slowest
// of the capture, encode and network processes. However, it also needs to
// rate-limit captures to avoid overloading the host system, either by consuming
// too much CPU, or hogging the host's graphics subsystem.
//
-// TODO(sergeyu): Rename this class to VideoFramePipe.
-class VideoScheduler : public base::RefCountedThreadSafe<VideoScheduler>,
+// TODO(sergeyu): Rename this class to VideoFramePump.
+class VideoFramePump : public base::RefCountedThreadSafe<VideoFramePump>,
public webrtc::DesktopCapturer::Callback,
public webrtc::MouseCursorMonitor::Callback {
public:
// Enables timestamps for generated frames. Used for testing.
static void EnableTimestampsForTests();
- // Creates a VideoScheduler running capture, encode and network tasks on the
+ // Creates a VideoFramePump running capture, encode and network tasks on the
// supplied TaskRunners. Video and cursor shape updates will be pumped to
// |video_stub| and |client_stub|, which must remain valid until Stop() is
// called. |capturer| is used to capture frames.
- VideoScheduler(
+ VideoFramePump(
scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
@@ -116,13 +115,13 @@ class VideoScheduler : public base::RefCountedThreadSafe<VideoScheduler>,
void SetLosslessColor(bool want_lossless);
private:
- friend class base::RefCountedThreadSafe<VideoScheduler>;
- ~VideoScheduler() override;
+ friend class base::RefCountedThreadSafe<VideoFramePump>;
+ ~VideoFramePump() override;
// Capturer thread ----------------------------------------------------------
// TODO(sergeyu): Move all methods that run on the capture thread to a
- // separate class and make VideoScheduler not ref-counted.
+ // separate class and make VideoFramePump not ref-counted.
// webrtc::DesktopCapturer::Callback implementation.
webrtc::SharedMemory* CreateSharedMemory(size_t size) override;
@@ -189,16 +188,16 @@ class VideoScheduler : public base::RefCountedThreadSafe<VideoScheduler>,
// Timer used to ensure that we send empty keep-alive frames to the client
// even when the video stream is paused or encoder is busy.
- scoped_ptr<base::DelayTimer<VideoScheduler> > keep_alive_timer_;
+ scoped_ptr<base::DelayTimer<VideoFramePump> > keep_alive_timer_;
// Number updated by the caller to trace performance.
int64 latest_event_timestamp_;
scoped_ptr<CaptureScheduler> capture_scheduler_;
- DISALLOW_COPY_AND_ASSIGN(VideoScheduler);
+ DISALLOW_COPY_AND_ASSIGN(VideoFramePump);
};
} // namespace remoting
-#endif // REMOTING_HOST_VIDEO_SCHEDULER_H_
+#endif // REMOTING_HOST_VIDEO_FRAME_PUMP_H_
diff --git a/remoting/host/video_scheduler_unittest.cc b/remoting/host/video_frame_pump_unittest.cc
index 5adfafa..ea61973 100644
--- a/remoting/host/video_scheduler_unittest.cc
+++ b/remoting/host/video_frame_pump_unittest.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/host/video_scheduler.h"
+#include "remoting/host/video_frame_pump.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
@@ -123,18 +123,18 @@ class ThreadCheckMouseCursorMonitor : public FakeMouseCursorMonitor {
DISALLOW_COPY_AND_ASSIGN(ThreadCheckMouseCursorMonitor);
};
-class VideoSchedulerTest : public testing::Test {
+class VideoFramePumpTest : public testing::Test {
public:
- VideoSchedulerTest();
+ VideoFramePumpTest();
void SetUp() override;
void TearDown() override;
- void StartVideoScheduler(
+ void StartVideoFramePump(
scoped_ptr<webrtc::DesktopCapturer> capturer,
scoped_ptr<VideoEncoder> encoder,
scoped_ptr<webrtc::MouseCursorMonitor> mouse_monitor);
- void StopVideoScheduler();
+ void StopVideoFramePump();
// webrtc::DesktopCapturer mocks.
void OnCapturerStart(webrtc::DesktopCapturer::Callback* callback);
@@ -153,7 +153,7 @@ class VideoSchedulerTest : public testing::Test {
scoped_refptr<AutoThreadTaskRunner> capture_task_runner_;
scoped_refptr<AutoThreadTaskRunner> encode_task_runner_;
scoped_refptr<AutoThreadTaskRunner> main_task_runner_;
- scoped_refptr<VideoScheduler> scheduler_;
+ scoped_refptr<VideoFramePump> scheduler_;
MockClientStub client_stub_;
MockVideoStub video_stub_;
@@ -165,22 +165,22 @@ class VideoSchedulerTest : public testing::Test {
webrtc::MouseCursorMonitor::Callback* mouse_monitor_callback_;
private:
- DISALLOW_COPY_AND_ASSIGN(VideoSchedulerTest);
+ DISALLOW_COPY_AND_ASSIGN(VideoFramePumpTest);
};
-VideoSchedulerTest::VideoSchedulerTest()
+VideoFramePumpTest::VideoFramePumpTest()
: capturer_callback_(nullptr),
mouse_monitor_callback_(nullptr) {
}
-void VideoSchedulerTest::SetUp() {
+void VideoFramePumpTest::SetUp() {
main_task_runner_ = new AutoThreadTaskRunner(
message_loop_.message_loop_proxy(), run_loop_.QuitClosure());
capture_task_runner_ = main_task_runner_;
encode_task_runner_ = main_task_runner_;
}
-void VideoSchedulerTest::TearDown() {
+void VideoFramePumpTest::TearDown() {
// Release the task runners, so that the test can quit.
capture_task_runner_ = nullptr;
encode_task_runner_ = nullptr;
@@ -190,11 +190,11 @@ void VideoSchedulerTest::TearDown() {
run_loop_.Run();
}
-void VideoSchedulerTest::StartVideoScheduler(
+void VideoFramePumpTest::StartVideoFramePump(
scoped_ptr<webrtc::DesktopCapturer> capturer,
scoped_ptr<VideoEncoder> encoder,
scoped_ptr<webrtc::MouseCursorMonitor> mouse_monitor) {
- scheduler_ = new VideoScheduler(
+ scheduler_ = new VideoFramePump(
capture_task_runner_,
encode_task_runner_,
main_task_runner_,
@@ -206,12 +206,12 @@ void VideoSchedulerTest::StartVideoScheduler(
scheduler_->Start();
}
-void VideoSchedulerTest::StopVideoScheduler() {
+void VideoFramePumpTest::StopVideoFramePump() {
scheduler_->Stop();
scheduler_ = nullptr;
}
-void VideoSchedulerTest::OnCapturerStart(
+void VideoFramePumpTest::OnCapturerStart(
webrtc::DesktopCapturer::Callback* callback) {
EXPECT_FALSE(capturer_callback_);
EXPECT_TRUE(callback);
@@ -219,7 +219,7 @@ void VideoSchedulerTest::OnCapturerStart(
capturer_callback_ = callback;
}
-void VideoSchedulerTest::OnCaptureFrame(const webrtc::DesktopRegion& region) {
+void VideoFramePumpTest::OnCaptureFrame(const webrtc::DesktopRegion& region) {
scoped_ptr<webrtc::DesktopFrame> frame(
new webrtc::BasicDesktopFrame(webrtc::DesktopSize(kWidth, kHeight)));
frame->mutable_updated_region()->SetRect(
@@ -227,7 +227,7 @@ void VideoSchedulerTest::OnCaptureFrame(const webrtc::DesktopRegion& region) {
capturer_callback_->OnCaptureCompleted(frame.release());
}
-void VideoSchedulerTest::OnCaptureMouse() {
+void VideoFramePumpTest::OnCaptureMouse() {
EXPECT_TRUE(mouse_monitor_callback_);
scoped_ptr<webrtc::MouseCursor> mouse_cursor(
@@ -239,7 +239,7 @@ void VideoSchedulerTest::OnCaptureMouse() {
mouse_monitor_callback_->OnMouseCursor(mouse_cursor.release());
}
-void VideoSchedulerTest::OnMouseCursorMonitorInit(
+void VideoFramePumpTest::OnMouseCursorMonitorInit(
webrtc::MouseCursorMonitor::Callback* callback,
webrtc::MouseCursorMonitor::Mode mode) {
EXPECT_FALSE(mouse_monitor_callback_);
@@ -248,7 +248,7 @@ void VideoSchedulerTest::OnMouseCursorMonitorInit(
mouse_monitor_callback_ = callback;
}
-void VideoSchedulerTest::SetCursorShape(
+void VideoFramePumpTest::SetCursorShape(
const protocol::CursorShapeInfo& cursor_shape) {
EXPECT_TRUE(cursor_shape.has_width());
EXPECT_EQ(kCursorWidth, cursor_shape.width());
@@ -265,9 +265,9 @@ void VideoSchedulerTest::SetCursorShape(
// This test mocks capturer, encoder and network layer to simulate one capture
// cycle. When the first encoded packet is submitted to the network
-// VideoScheduler is instructed to come to a complete stop. We expect the stop
+// VideoFramePump is instructed to come to a complete stop. We expect the stop
// sequence to be executed successfully.
-TEST_F(VideoSchedulerTest, StartAndStop) {
+TEST_F(VideoFramePumpTest, StartAndStop) {
scoped_ptr<webrtc::MockScreenCapturer> capturer(
new webrtc::MockScreenCapturer());
scoped_ptr<MockMouseCursorMonitor> cursor_monitor(
@@ -278,20 +278,20 @@ TEST_F(VideoSchedulerTest, StartAndStop) {
EXPECT_CALL(*cursor_monitor, Init(_, _))
.WillOnce(
- Invoke(this, &VideoSchedulerTest::OnMouseCursorMonitorInit));
+ Invoke(this, &VideoFramePumpTest::OnMouseCursorMonitorInit));
EXPECT_CALL(*cursor_monitor, Capture())
- .WillRepeatedly(Invoke(this, &VideoSchedulerTest::OnCaptureMouse));
+ .WillRepeatedly(Invoke(this, &VideoFramePumpTest::OnCaptureMouse));
}
Expectation capturer_start =
EXPECT_CALL(*capturer, Start(_))
- .WillOnce(Invoke(this, &VideoSchedulerTest::OnCapturerStart));
+ .WillOnce(Invoke(this, &VideoFramePumpTest::OnCapturerStart));
// First the capturer is called.
Expectation capturer_capture = EXPECT_CALL(*capturer, Capture(_))
.After(capturer_start)
- .WillRepeatedly(Invoke(this, &VideoSchedulerTest::OnCaptureFrame));
+ .WillRepeatedly(Invoke(this, &VideoFramePumpTest::OnCaptureFrame));
scoped_ptr<MockVideoEncoder> encoder(new MockVideoEncoder());
@@ -303,22 +303,22 @@ TEST_F(VideoSchedulerTest, StartAndStop) {
EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
.WillRepeatedly(FinishSend());
- // When the first ProcessVideoPacket is received we stop the VideoScheduler.
+ // When the first ProcessVideoPacket is received we stop the VideoFramePump.
EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
.WillOnce(DoAll(
FinishSend(),
- InvokeWithoutArgs(this, &VideoSchedulerTest::StopVideoScheduler)))
+ InvokeWithoutArgs(this, &VideoFramePumpTest::StopVideoFramePump)))
.RetiresOnSaturation();
EXPECT_CALL(client_stub_, SetCursorShape(_))
- .WillOnce(Invoke(this, &VideoSchedulerTest::SetCursorShape));
+ .WillOnce(Invoke(this, &VideoFramePumpTest::SetCursorShape));
// Start video frame capture.
scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor(
new FakeMouseCursorMonitor());
- StartVideoScheduler(capturer.Pass(), encoder.Pass(), cursor_monitor.Pass());
+ StartVideoFramePump(capturer.Pass(), encoder.Pass(), cursor_monitor.Pass());
- // Run until there are no more pending tasks from the VideoScheduler.
+ // Run until there are no more pending tasks from the VideoFramePump.
// Otherwise, a lingering frame capture might attempt to trigger a capturer
// expectation action and crash.
base::RunLoop().RunUntilIdle();
@@ -326,7 +326,7 @@ TEST_F(VideoSchedulerTest, StartAndStop) {
// Verify that the capturer, encoder and mouse monitor are torn down on the
// correct threads.
-TEST_F(VideoSchedulerTest, DeleteOnThreads) {
+TEST_F(VideoFramePumpTest, DeleteOnThreads) {
capture_task_runner_ = AutoThread::Create("capture", main_task_runner_);
encode_task_runner_ = AutoThread::Create("encode", main_task_runner_);
@@ -339,9 +339,9 @@ TEST_F(VideoSchedulerTest, DeleteOnThreads) {
// Start and stop the scheduler, so it will tear down the screen capturer,
// video encoder and mouse monitor.
- StartVideoScheduler(capturer.Pass(), encoder.Pass(),
+ StartVideoFramePump(capturer.Pass(), encoder.Pass(),
mouse_cursor_monitor.Pass());
- StopVideoScheduler();
+ StopVideoFramePump();
}
} // namespace remoting
diff --git a/remoting/remoting_host_srcs.gypi b/remoting/remoting_host_srcs.gypi
index 8083520..2d92908 100644
--- a/remoting/remoting_host_srcs.gypi
+++ b/remoting/remoting_host_srcs.gypi
@@ -230,8 +230,8 @@
'host/video_frame_recorder.h',
'host/video_frame_recorder_host_extension.cc',
'host/video_frame_recorder_host_extension.h',
- 'host/video_scheduler.cc',
- 'host/video_scheduler.h',
+ 'host/video_frame_pump.cc',
+ 'host/video_frame_pump.h',
'host/win/com_imported_mstscax.tlh',
'host/win/com_security.cc',
'host/win/com_security.h',
diff --git a/remoting/remoting_test.gypi b/remoting/remoting_test.gypi
index 67c5594..0b97aa22 100644
--- a/remoting/remoting_test.gypi
+++ b/remoting/remoting_test.gypi
@@ -181,7 +181,7 @@
'host/shaped_desktop_capturer_unittest.cc',
'host/token_validator_factory_impl_unittest.cc',
'host/video_frame_recorder_unittest.cc',
- 'host/video_scheduler_unittest.cc',
+ 'host/video_frame_pump_unittest.cc',
'host/win/rdp_client_unittest.cc',
'host/win/worker_process_launcher.cc',
'host/win/worker_process_launcher.h',
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc
index 7c4ffa3..f5edd8fd 100644
--- a/remoting/test/protocol_perftest.cc
+++ b/remoting/test/protocol_perftest.cc
@@ -22,7 +22,7 @@
#include "remoting/host/chromoting_host.h"
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/fake_desktop_environment.h"
-#include "remoting/host/video_scheduler.h"
+#include "remoting/host/video_frame_pump.h"
#include "remoting/protocol/jingle_session_manager.h"
#include "remoting/protocol/libjingle_transport_factory.h"
#include "remoting/protocol/me2me_host_authenticator_factory.h"
@@ -81,7 +81,7 @@ class ProtocolPerfTest
: host_thread_("host"),
capture_thread_("capture"),
encode_thread_("encode") {
- VideoScheduler::EnableTimestampsForTests();
+ VideoFramePump::EnableTimestampsForTests();
host_thread_.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
capture_thread_.Start();