summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
Diffstat (limited to 'remoting')
-rw-r--r--remoting/base/capture_data.h75
-rw-r--r--remoting/base/decoder.h (renamed from remoting/client/decoder.h)6
-rw-r--r--remoting/base/decoder_verbatim.cc (renamed from remoting/client/decoder_verbatim.cc)2
-rw-r--r--remoting/base/decoder_verbatim.h (renamed from remoting/client/decoder_verbatim.h)8
-rw-r--r--remoting/base/decoder_verbatim_unittest.cc (renamed from remoting/client/decoder_verbatim_unittest.cc)2
-rw-r--r--remoting/base/encoder.h (renamed from remoting/host/encoder.h)10
-rw-r--r--remoting/base/encoder_verbatim.cc (renamed from remoting/host/encoder_verbatim.cc)30
-rw-r--r--remoting/base/encoder_verbatim.h (renamed from remoting/host/encoder_verbatim.h)14
-rw-r--r--remoting/base/encoder_vp8.cc (renamed from remoting/host/encoder_vp8.cc)0
-rw-r--r--remoting/base/encoder_vp8.h (renamed from remoting/host/encoder_vp8.h)6
-rw-r--r--remoting/base/encoder_vp8_unittest.cc (renamed from remoting/host/encoder_vp8_unittest.cc)0
-rw-r--r--remoting/base/mock_objects.h16
-rw-r--r--remoting/client/mock_objects.h1
-rw-r--r--remoting/client/plugin/pepper_view.cc2
-rw-r--r--remoting/client/plugin/pepper_view.h2
-rw-r--r--remoting/client/x11_view.cc2
-rw-r--r--remoting/client/x11_view.h2
-rw-r--r--remoting/host/capturer.h62
-rw-r--r--remoting/host/capturer_fake.cc2
-rw-r--r--remoting/host/capturer_fake_ascii.cc2
-rw-r--r--remoting/host/capturer_gdi.cc2
-rw-r--r--remoting/host/capturer_mac.cc2
-rw-r--r--remoting/host/capturer_mac_unittest.cc6
-rw-r--r--remoting/host/chromoting_host.cc3
-rw-r--r--remoting/host/chromoting_host.h8
-rw-r--r--remoting/host/mock_objects.h14
-rw-r--r--remoting/host/session_manager.cc6
-rw-r--r--remoting/host/session_manager.h8
-rw-r--r--remoting/host/session_manager_unittest.cc11
-rw-r--r--remoting/host/simple_host_process.cc2
-rw-r--r--remoting/remoting.gyp25
31 files changed, 176 insertions, 155 deletions
diff --git a/remoting/base/capture_data.h b/remoting/base/capture_data.h
new file mode 100644
index 0000000..2ac8a12
--- /dev/null
+++ b/remoting/base/capture_data.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2010 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_BASE_CAPTURE_DATA_H_
+#define REMOTING_BASE_CAPTURE_DATA_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+#include "gfx/rect.h"
+#include "remoting/base/protocol/chromotocol.pb.h"
+
+namespace remoting {
+
+typedef std::vector<gfx::Rect> RectVector;
+
+struct DataPlanes {
+ static const int kPlaneCount = 3;
+ uint8* data[kPlaneCount];
+ int strides[kPlaneCount];
+
+ DataPlanes() {
+ for (int i = 0; i < kPlaneCount; ++i) {
+ data[i] = NULL;
+ strides[i] = 0;
+ }
+ }
+};
+
+// Stores the data and information of a capture to pass off to the
+// encoding thread.
+class CaptureData : public base::RefCountedThreadSafe<CaptureData> {
+ public:
+ CaptureData(const DataPlanes &data_planes,
+ int width,
+ int height,
+ PixelFormat format) :
+ data_planes_(data_planes), dirty_rects_(),
+ width_(width), height_(height), pixel_format_(format) { }
+
+ // Get the data_planes data of the last capture.
+ const DataPlanes& data_planes() const { return data_planes_; }
+
+ // Get the list of updated rectangles in the last capture. The result is
+ // written into |rects|.
+ const RectVector& dirty_rects() const { return dirty_rects_; }
+
+ // Get the width of the image captured.
+ int width() const { return width_; }
+
+ // Get the height of the image captured.
+ int height() const { return height_; }
+
+ // Get the pixel format of the image captured.
+ PixelFormat pixel_format() const { return pixel_format_; }
+
+ // Mutating methods.
+ RectVector& mutable_dirty_rects() { return dirty_rects_; }
+
+ private:
+ const DataPlanes data_planes_;
+ RectVector dirty_rects_;
+ int width_;
+ int height_;
+ PixelFormat pixel_format_;
+
+ friend class base::RefCountedThreadSafe<CaptureData>;
+ ~CaptureData() {}
+};
+
+} // namespace remoting
+
+#endif // REMOTING_BASE_CAPTURE_DATA_H_
diff --git a/remoting/client/decoder.h b/remoting/base/decoder.h
index 4d083bd..1df477d 100644
--- a/remoting/client/decoder.h
+++ b/remoting/base/decoder.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef REMOTING_CLIENT_DECODER_H_
-#define REMOTING_CLIENT_DECODER_H_
+#ifndef REMOTING_BASE_DECODER_H_
+#define REMOTING_BASE_DECODER_H_
#include <vector>
@@ -111,4 +111,4 @@ class Decoder {
} // namespace remoting
-#endif // REMOTING_CLIENT_DECODER_H_
+#endif // REMOTING_BASE_DECODER_H_
diff --git a/remoting/client/decoder_verbatim.cc b/remoting/base/decoder_verbatim.cc
index d27d265..e17310d 100644
--- a/remoting/client/decoder_verbatim.cc
+++ b/remoting/base/decoder_verbatim.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/client/decoder_verbatim.h"
+#include "remoting/base/decoder_verbatim.h"
#include "remoting/base/protocol_util.h"
diff --git a/remoting/client/decoder_verbatim.h b/remoting/base/decoder_verbatim.h
index 6efc732..ba97b5e 100644
--- a/remoting/client/decoder_verbatim.h
+++ b/remoting/base/decoder_verbatim.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef REMOTING_CLIENT_DECODER_VERBATIM_H_
-#define REMOTING_CLIENT_DECODER_VERBATIM_H_
+#ifndef REMOTING_BASE_DECODER_VERBATIM_H_
+#define REMOTING_BASE_DECODER_VERBATIM_H_
-#include "remoting/client/decoder.h"
+#include "remoting/base/decoder.h"
namespace remoting {
@@ -53,4 +53,4 @@ class DecoderVerbatim : public Decoder {
} // namespace remoting
-#endif // REMOTING_CLIENT_DECODER_VERBATIM_H_
+#endif // REMOTING_BASE_DECODER_VERBATIM_H_
diff --git a/remoting/client/decoder_verbatim_unittest.cc b/remoting/base/decoder_verbatim_unittest.cc
index d541d22..f32b08c 100644
--- a/remoting/client/decoder_verbatim_unittest.cc
+++ b/remoting/base/decoder_verbatim_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "media/base/video_frame.h"
-#include "remoting/client/decoder_verbatim.h"
+#include "remoting/base/decoder_verbatim.h"
#include "remoting/client/mock_objects.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/remoting/host/encoder.h b/remoting/base/encoder.h
index ee43c94..0c1fd50f 100644
--- a/remoting/host/encoder.h
+++ b/remoting/base/encoder.h
@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef REMOTING_HOST_ENCODER_H_
-#define REMOTING_HOST_ENCODER_H_
+#ifndef REMOTING_BASE_ENCODER_H_
+#define REMOTING_BASE_ENCODER_H_
#include "base/basictypes.h"
#include "base/callback.h"
#include "media/base/data_buffer.h"
#include "remoting/base/protocol/chromotocol.pb.h"
-#include "remoting/host/capturer.h"
namespace media {
class DataBuffer;
@@ -17,6 +16,7 @@ namespace media {
namespace remoting {
+class CaptureData;
class HostMessage;
// A class to perform the task of encoding a continous stream of
@@ -51,11 +51,11 @@ class Encoder {
//
// When encoded data is available, partial or full |data_available_callback|
// is called.
- virtual void Encode(scoped_refptr<Capturer::CaptureData> capture_data,
+ virtual void Encode(scoped_refptr<CaptureData> capture_data,
bool key_frame,
DataAvailableCallback* data_available_callback) = 0;
};
} // namespace remoting
-#endif // REMOTING_HOST_ENCODER_H_
+#endif // REMOTING_BASE_ENCODER_H_
diff --git a/remoting/host/encoder_verbatim.cc b/remoting/base/encoder_verbatim.cc
index fd9dadf..f6cc2ca 100644
--- a/remoting/host/encoder_verbatim.cc
+++ b/remoting/base/encoder_verbatim.cc
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remoting/host/encoder_verbatim.h"
+#include "remoting/base/encoder_verbatim.h"
#include "gfx/rect.h"
#include "media/base/data_buffer.h"
+#include "remoting/base/capture_data.h"
#include "remoting/base/protocol_util.h"
#include "remoting/base/protocol/chromotocol.pb.h"
@@ -13,7 +14,7 @@ namespace remoting {
using media::DataBuffer;
-void EncoderVerbatim::Encode(scoped_refptr<Capturer::CaptureData> capture_data,
+void EncoderVerbatim::Encode(scoped_refptr<CaptureData> capture_data,
bool key_frame,
DataAvailableCallback* data_available_callback) {
int num_rects = capture_data->dirty_rects().size();
@@ -22,7 +23,8 @@ void EncoderVerbatim::Encode(scoped_refptr<Capturer::CaptureData> capture_data,
HostMessage* msg = new HostMessage();
UpdateStreamPacketMessage* packet = msg->mutable_update_stream_packet();
- if (EncodeRect(dirty_rect, capture_data, packet)) {
+ if (EncodeRect(dirty_rect.x(), dirty_rect.y(), dirty_rect.width(),
+ dirty_rect.height(), capture_data, packet)) {
// Prepare the end rect content.
packet->mutable_end_rect();
@@ -41,26 +43,26 @@ void EncoderVerbatim::Encode(scoped_refptr<Capturer::CaptureData> capture_data,
}
bool EncoderVerbatim::EncodeRect(
- const gfx::Rect& dirty,
- const scoped_refptr<Capturer::CaptureData>& capture_data,
+ int x, int y, int width, int height,
+ const scoped_refptr<CaptureData>& capture_data,
UpdateStreamPacketMessage* packet) {
// Prepare the begin rect content.
- packet->mutable_begin_rect()->set_x(dirty.x());
- packet->mutable_begin_rect()->set_y(dirty.y());
- packet->mutable_begin_rect()->set_width(dirty.width());
- packet->mutable_begin_rect()->set_height(dirty.height());
+ packet->mutable_begin_rect()->set_x(x);
+ packet->mutable_begin_rect()->set_y(y);
+ packet->mutable_begin_rect()->set_width(width);
+ packet->mutable_begin_rect()->set_height(height);
packet->mutable_begin_rect()->set_encoding(EncodingNone);
packet->mutable_begin_rect()->set_pixel_format(capture_data->pixel_format());
// Calculate the size of output.
int bytes_per_pixel = GetBytesPerPixel(capture_data->pixel_format());
- int row_size = bytes_per_pixel * dirty.width();
+ int row_size = bytes_per_pixel * width;
int output_size = 0;
- for (int i = 0; i < Capturer::DataPlanes::kPlaneCount; ++i) {
+ for (int i = 0; i < DataPlanes::kPlaneCount; ++i) {
// TODO(hclam): Handle YUV since the height would be different.
const uint8* in = capture_data->data_planes().data[i];
if (!in) continue;
- output_size += row_size * dirty.height();
+ output_size += row_size * height;
}
// Resize the output data buffer.
@@ -68,13 +70,13 @@ bool EncoderVerbatim::EncodeRect(
uint8* out = reinterpret_cast<uint8*>(
&((*packet->mutable_rect_data()->mutable_data())[0]));
- for (int i = 0; i < Capturer::DataPlanes::kPlaneCount; ++i) {
+ for (int i = 0; i < DataPlanes::kPlaneCount; ++i) {
const uint8* in = capture_data->data_planes().data[i];
// Skip over planes that don't have data.
if (!in) continue;
// TODO(hclam): Handle YUV since the height would be different.
- for (int j = 0; j < dirty.height(); ++j) {
+ for (int j = 0; j < height; ++j) {
DCHECK_LE(row_size, capture_data->data_planes().strides[i]);
memcpy(out, in, row_size);
in += capture_data->data_planes().strides[i];
diff --git a/remoting/host/encoder_verbatim.h b/remoting/base/encoder_verbatim.h
index 175b954..dd019fc 100644
--- a/remoting/host/encoder_verbatim.h
+++ b/remoting/base/encoder_verbatim.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef REMOTING_HOST_ENCODER_VERBATIM_H_
-#define REMOTING_HOST_ENCODER_VERBATIM_H_
+#ifndef REMOTING_BASE_ENCODER_VERBATIM_H_
+#define REMOTING_BASE_ENCODER_VERBATIM_H_
-#include "remoting/host/encoder.h"
+#include "remoting/base/encoder.h"
namespace remoting {
@@ -18,7 +18,7 @@ class EncoderVerbatim : public Encoder {
EncoderVerbatim() {}
virtual ~EncoderVerbatim() {}
- virtual void Encode(scoped_refptr<Capturer::CaptureData> capture_data,
+ virtual void Encode(scoped_refptr<CaptureData> capture_data,
bool key_frame,
DataAvailableCallback* data_available_callback);
@@ -26,11 +26,11 @@ class EncoderVerbatim : public Encoder {
// Encode a single dirty rect. Called by Encode(). Output is written
// to |msg|.
// Returns false if there is an error.
- bool EncodeRect(const gfx::Rect& dirty,
- const scoped_refptr<Capturer::CaptureData>& capture_data,
+ bool EncodeRect(int x, int y, int width, int height,
+ const scoped_refptr<CaptureData>& capture_data,
UpdateStreamPacketMessage* msg);
};
} // namespace remoting
-#endif // REMOTING_HOST_ENCODER_VERBATIM_H_
+#endif // REMOTING_BASE_ENCODER_VERBATIM_H_
diff --git a/remoting/host/encoder_vp8.cc b/remoting/base/encoder_vp8.cc
index 231acd5..231acd5 100644
--- a/remoting/host/encoder_vp8.cc
+++ b/remoting/base/encoder_vp8.cc
diff --git a/remoting/host/encoder_vp8.h b/remoting/base/encoder_vp8.h
index 1cd16ac..4b8b539 100644
--- a/remoting/host/encoder_vp8.h
+++ b/remoting/base/encoder_vp8.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef REMOTING_HOST_ENCODER_VP8_H_
-#define REMOTING_HOST_ENCODER_VP8_H_
+#ifndef REMOTING_BASE_ENCODER_VP8_H_
+#define REMOTING_BASE_ENCODER_VP8_H_
#include "remoting/host/encoder.h"
@@ -58,4 +58,4 @@ class EncoderVp8 : public Encoder {
} // namespace remoting
-#endif // REMOTING_HOST_ENCODER_VP8_H_
+#endif // REMOTING_BASE_ENCODER_VP8_H_
diff --git a/remoting/host/encoder_vp8_unittest.cc b/remoting/base/encoder_vp8_unittest.cc
index 0b29830..0b29830 100644
--- a/remoting/host/encoder_vp8_unittest.cc
+++ b/remoting/base/encoder_vp8_unittest.cc
diff --git a/remoting/base/mock_objects.h b/remoting/base/mock_objects.h
index a61830e..7565f22 100644
--- a/remoting/base/mock_objects.h
+++ b/remoting/base/mock_objects.h
@@ -5,6 +5,9 @@
#ifndef REMOTING_BASE_MOCK_OBJECTS_H_
#define REMOTING_BASE_MOCK_OBJECTS_H_
+#include "remoting/base/capture_data.h"
+#include "remoting/base/decoder.h"
+#include "remoting/base/encoder.h"
#include "remoting/base/protocol_decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -25,6 +28,19 @@ class MockProtocolDecoder : public ProtocolDecoder {
DISALLOW_COPY_AND_ASSIGN(MockProtocolDecoder);
};
+class MockEncoder : public Encoder {
+ public:
+ MockEncoder() {}
+
+ MOCK_METHOD3(Encode, void(
+ scoped_refptr<CaptureData> capture_data,
+ bool key_frame,
+ DataAvailableCallback* data_available_callback));
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockEncoder);
+};
+
} // namespace remoting
#endif // REMOTING_BASE_MOCK_OBJECTS_H_
diff --git a/remoting/client/mock_objects.h b/remoting/client/mock_objects.h
index 06ed801..bee3581 100644
--- a/remoting/client/mock_objects.h
+++ b/remoting/client/mock_objects.h
@@ -6,7 +6,6 @@
#define REMOTING_CLIENT_MOCK_OBJECTS_H_
#include "base/ref_counted.h"
-#include "remoting/client/decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace remoting {
diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc
index ce38289..5b96226 100644
--- a/remoting/client/plugin/pepper_view.cc
+++ b/remoting/client/plugin/pepper_view.cc
@@ -5,7 +5,7 @@
#include "remoting/client/plugin/pepper_view.h"
#include "base/message_loop.h"
-#include "remoting/client/decoder_verbatim.h"
+#include "remoting/base/decoder_verbatim.h"
#include "remoting/client/plugin/chromoting_plugin.h"
#include "remoting/client/plugin/pepper_util.h"
#include "third_party/ppapi/cpp/device_context_2d.h"
diff --git a/remoting/client/plugin/pepper_view.h b/remoting/client/plugin/pepper_view.h
index 3622ab3..0a3147e 100644
--- a/remoting/client/plugin/pepper_view.h
+++ b/remoting/client/plugin/pepper_view.h
@@ -17,8 +17,8 @@
#include "base/scoped_ptr.h"
#include "base/task.h"
#include "media/base/video_frame.h"
+#include "remoting/base/decoder.h"
#include "remoting/client/chromoting_view.h"
-#include "remoting/client/decoder.h"
#include "third_party/ppapi/cpp/device_context_2d.h"
namespace remoting {
diff --git a/remoting/client/x11_view.cc b/remoting/client/x11_view.cc
index e4b59ae..fe30291 100644
--- a/remoting/client/x11_view.cc
+++ b/remoting/client/x11_view.cc
@@ -10,7 +10,7 @@
#include <X11/extensions/Xcomposite.h>
#include "base/logging.h"
-#include "remoting/client/decoder_verbatim.h"
+#include "remoting/base/decoder_verbatim.h"
namespace remoting {
diff --git a/remoting/client/x11_view.h b/remoting/client/x11_view.h
index 73e63c7..2825575 100644
--- a/remoting/client/x11_view.h
+++ b/remoting/client/x11_view.h
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "media/base/video_frame.h"
-#include "remoting/client/decoder.h"
+#include "remoting/base/decoder.h"
#include "remoting/client/chromoting_view.h"
typedef unsigned long XID;
diff --git a/remoting/host/capturer.h b/remoting/host/capturer.h
index 6e16098..30d6737 100644
--- a/remoting/host/capturer.h
+++ b/remoting/host/capturer.h
@@ -5,19 +5,14 @@
#ifndef REMOTING_HOST_CAPTURER_H_
#define REMOTING_HOST_CAPTURER_H_
-#include <vector>
-
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/lock.h"
#include "base/task.h"
-#include "gfx/rect.h"
-#include "remoting/base/protocol/chromotocol.pb.h"
+#include "remoting/base/capture_data.h"
namespace remoting {
-typedef std::vector<gfx::Rect> RectVector;
-
// A class to perform the task of capturing the image of a window.
// The capture action is asynchronous to allow maximum throughput.
//
@@ -27,61 +22,6 @@ typedef std::vector<gfx::Rect> RectVector;
// happening.
class Capturer {
public:
-
- struct DataPlanes {
- static const int kPlaneCount = 3;
- uint8* data[kPlaneCount];
- int strides[kPlaneCount];
-
- DataPlanes() {
- for (int i = 0; i < kPlaneCount; ++i) {
- data[i] = NULL;
- strides[i] = 0;
- }
- }
- };
-
- // Stores the data and information of a capture to pass off to the
- // encoding thread.
- class CaptureData : public base::RefCountedThreadSafe<CaptureData> {
- public:
- CaptureData(const DataPlanes &data_planes,
- int width,
- int height,
- PixelFormat format) :
- data_planes_(data_planes), dirty_rects_(),
- width_(width), height_(height), pixel_format_(format) { }
-
- // Get the data_planes data of the last capture.
- const DataPlanes& data_planes() const { return data_planes_; }
-
- // Get the list of updated rectangles in the last capture. The result is
- // written into |rects|.
- const RectVector& dirty_rects() const { return dirty_rects_; }
-
- // Get the width of the image captured.
- int width() const { return width_; }
-
- // Get the height of the image captured.
- int height() const { return height_; }
-
- // Get the pixel format of the image captured.
- PixelFormat pixel_format() const { return pixel_format_; }
-
- // Mutating methods.
- RectVector& mutable_dirty_rects() { return dirty_rects_; }
-
- private:
- const DataPlanes data_planes_;
- RectVector dirty_rects_;
- int width_;
- int height_;
- PixelFormat pixel_format_;
-
- friend class base::RefCountedThreadSafe<CaptureData>;
- ~CaptureData() {}
- };
-
// CaptureCompletedCallback is called when the capturer has completed.
typedef Callback1<scoped_refptr<CaptureData> >::Type CaptureCompletedCallback;
diff --git a/remoting/host/capturer_fake.cc b/remoting/host/capturer_fake.cc
index 9ffe5bf..eee2d5a 100644
--- a/remoting/host/capturer_fake.cc
+++ b/remoting/host/capturer_fake.cc
@@ -23,7 +23,7 @@ CapturerFake::~CapturerFake() {
void CapturerFake::CaptureRects(const RectVector& rects,
CaptureCompletedCallback* callback) {
GenerateImage();
- Capturer::DataPlanes planes;
+ DataPlanes planes;
planes.data[0] = buffers_[current_buffer_].get();
planes.strides[0] = bytes_per_row_;
diff --git a/remoting/host/capturer_fake_ascii.cc b/remoting/host/capturer_fake_ascii.cc
index d0d7479..ccdbfcf 100644
--- a/remoting/host/capturer_fake_ascii.cc
+++ b/remoting/host/capturer_fake_ascii.cc
@@ -21,7 +21,7 @@ CapturerFakeAscii::~CapturerFakeAscii() {
void CapturerFakeAscii::CaptureRects(const RectVector& rects,
CaptureCompletedCallback* callback) {
GenerateImage();
- Capturer::DataPlanes planes;
+ DataPlanes planes;
planes.data[0] = buffers_[current_buffer_].get();
planes.strides[0] = bytes_per_row_;
scoped_refptr<CaptureData> capture_data(new CaptureData(planes,
diff --git a/remoting/host/capturer_gdi.cc b/remoting/host/capturer_gdi.cc
index 7f54aa9..6190819 100644
--- a/remoting/host/capturer_gdi.cc
+++ b/remoting/host/capturer_gdi.cc
@@ -79,7 +79,7 @@ void CapturerGdi::ScreenConfigurationChanged() {
void CapturerGdi::CaptureRects(const RectVector& rects,
CaptureCompletedCallback* callback) {
- Capturer::DataPlanes planes;
+ DataPlanes planes;
planes.data[0] = static_cast<uint8*>(buffers_[current_buffer_]);
planes.strides[0] = bytes_per_row_;
diff --git a/remoting/host/capturer_mac.cc b/remoting/host/capturer_mac.cc
index 52d58c3..bfb031a 100644
--- a/remoting/host/capturer_mac.cc
+++ b/remoting/host/capturer_mac.cc
@@ -93,7 +93,7 @@ void CapturerMac::CaptureRects(const RectVector& rects,
buffers_[current_buffer_].get());
glPopClientAttrib();
- Capturer::DataPlanes planes;
+ DataPlanes planes;
planes.data[0] = buffers_[current_buffer_].get();
planes.strides[0] = bytes_per_row_;
diff --git a/remoting/host/capturer_mac_unittest.cc b/remoting/host/capturer_mac_unittest.cc
index e59a0bb..a172b15 100644
--- a/remoting/host/capturer_mac_unittest.cc
+++ b/remoting/host/capturer_mac_unittest.cc
@@ -28,7 +28,7 @@ class CapturerMacTest : public testing::Test {
class CapturerCallback {
public:
explicit CapturerCallback(const RectVector& rects) : rects_(rects) { }
- void CaptureDoneCallback(scoped_refptr<Capturer::CaptureData> capture_data);
+ void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data);
protected:
RectVector rects_;
@@ -38,7 +38,7 @@ class CapturerCallback {
};
void CapturerCallback::CaptureDoneCallback(
- scoped_refptr<Capturer::CaptureData> capture_data) {
+ scoped_refptr<CaptureData> capture_data) {
CGDirectDisplayID mainDevice = CGMainDisplayID();
int width = CGDisplayPixelsWide(mainDevice);
int height = CGDisplayPixelsHigh(mainDevice);
@@ -46,7 +46,7 @@ void CapturerCallback::CaptureDoneCallback(
EXPECT_EQ(rects_, capture_data->dirty_rects());
EXPECT_EQ(width, capture_data->width());
EXPECT_EQ(height, capture_data->height());
- const Capturer::DataPlanes &planes = capture_data->data_planes();
+ const DataPlanes &planes = capture_data->data_planes();
EXPECT_TRUE(planes.data[0] != NULL);
EXPECT_TRUE(planes.data[1] == NULL);
EXPECT_TRUE(planes.data[2] == NULL);
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 3c349fa..7795de1 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -8,8 +8,11 @@
#include "base/task.h"
#include "build/build_config.h"
#include "remoting/base/constants.h"
+#include "remoting/base/encoder.h"
#include "remoting/base/protocol_decoder.h"
#include "remoting/host/chromoting_host_context.h"
+#include "remoting/host/capturer.h"
+#include "remoting/host/event_executor.h"
#include "remoting/host/host_config.h"
#include "remoting/host/session_manager.h"
#include "remoting/jingle_glue/jingle_channel.h"
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index ee15b47a..d281b97 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -8,12 +8,8 @@
#include <string>
#include "base/thread.h"
-#include "remoting/host/capturer.h"
#include "remoting/host/client_connection.h"
-#include "remoting/host/encoder.h"
-#include "remoting/host/event_executor.h"
#include "remoting/host/heartbeat_sender.h"
-#include "remoting/host/session_manager.h"
#include "remoting/jingle_glue/jingle_client.h"
#include "remoting/jingle_glue/jingle_thread.h"
@@ -21,8 +17,12 @@ class Task;
namespace remoting {
+class Capturer;
class ChromotingHostContext;
+class Encoder;
+class EventExecutor;
class MutableHostConfig;
+class SessionManager;
// A class to implement the functionality of a host process.
//
diff --git a/remoting/host/mock_objects.h b/remoting/host/mock_objects.h
index f4135f2..f58ac3b 100644
--- a/remoting/host/mock_objects.h
+++ b/remoting/host/mock_objects.h
@@ -9,7 +9,6 @@
#include "remoting/base/protocol_decoder.h"
#include "remoting/host/capturer.h"
#include "remoting/host/client_connection.h"
-#include "remoting/host/encoder.h"
#include "remoting/host/event_executor.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -32,19 +31,6 @@ class MockCapturer : public Capturer {
DISALLOW_COPY_AND_ASSIGN(MockCapturer);
};
-class MockEncoder : public Encoder {
- public:
- MockEncoder() {}
-
- MOCK_METHOD3(Encode, void(
- scoped_refptr<Capturer::CaptureData> capture_data,
- bool key_frame,
- DataAvailableCallback* data_available_callback));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockEncoder);
-};
-
class MockEventExecutor : public EventExecutor {
public:
MockEventExecutor() {}
diff --git a/remoting/host/session_manager.cc b/remoting/host/session_manager.cc
index 5be8b56d..ebfafeba 100644
--- a/remoting/host/session_manager.cc
+++ b/remoting/host/session_manager.cc
@@ -10,9 +10,9 @@
#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
#include "media/base/data_buffer.h"
+#include "remoting/base/capture_data.h"
#include "remoting/base/protocol_decoder.h"
#include "remoting/host/client_connection.h"
-#include "remoting/host/encoder.h"
namespace remoting {
@@ -219,7 +219,7 @@ void SessionManager::DoCapture() {
}
void SessionManager::CaptureDoneCallback(
- scoped_refptr<Capturer::CaptureData> capture_data) {
+ scoped_refptr<CaptureData> capture_data) {
// TODO(hclam): There is a bug if the capturer doesn't produce any dirty rects.
DCHECK_EQ(capture_loop_, MessageLoop::current());
encode_loop_->PostTask(
@@ -381,7 +381,7 @@ void SessionManager::DoRemoveAllClients() {
// Encoder thread --------------------------------------------------------------
void SessionManager::DoEncode(
- scoped_refptr<Capturer::CaptureData> capture_data) {
+ scoped_refptr<CaptureData> capture_data) {
DCHECK_EQ(encode_loop_, MessageLoop::current());
// TODO(hclam): Enable |force_refresh| if a new client was
diff --git a/remoting/host/session_manager.h b/remoting/host/session_manager.h
index c2a2149..83c437a 100644
--- a/remoting/host/session_manager.h
+++ b/remoting/host/session_manager.h
@@ -12,9 +12,9 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
+#include "remoting/base/encoder.h"
#include "remoting/base/protocol/chromotocol.pb.h"
#include "remoting/host/capturer.h"
-#include "remoting/host/encoder.h"
namespace media {
@@ -24,7 +24,7 @@ class DataBuffer;
namespace remoting {
-class Encoder;
+class CaptureData;
class ClientConnection;
// A class for controlling and coordinate Capturer, Encoder
@@ -115,7 +115,7 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
void ScheduleNextCapture();
void DoCapture();
- void CaptureDoneCallback(scoped_refptr<Capturer::CaptureData> capture_data);
+ void CaptureDoneCallback(scoped_refptr<CaptureData> capture_data);
void DoFinishEncode();
void DoGetInitInfo(scoped_refptr<ClientConnection> client);
@@ -142,7 +142,7 @@ class SessionManager : public base::RefCountedThreadSafe<SessionManager> {
// Encoder thread -----------------------------------------------------------
- void DoEncode(scoped_refptr<Capturer::CaptureData> capture_data);
+ void DoEncode(scoped_refptr<CaptureData> capture_data);
// EncodeDataAvailableTask takes ownership of header and is responsible for
// deleting it.
diff --git a/remoting/host/session_manager_unittest.cc b/remoting/host/session_manager_unittest.cc
index e6d8114..239eb97 100644
--- a/remoting/host/session_manager_unittest.cc
+++ b/remoting/host/session_manager_unittest.cc
@@ -4,6 +4,7 @@
#include "base/message_loop.h"
#include "base/task.h"
+#include "remoting/base/mock_objects.h"
#include "remoting/host/mock_objects.h"
#include "remoting/host/session_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -80,15 +81,13 @@ TEST_F(SessionManagerTest, OneRecordCycle) {
RectVector update_rects;
update_rects.push_back(gfx::Rect(0, 0, 10, 10));
- Capturer::DataPlanes planes;
- for (int i = 0; i < Capturer::DataPlanes::kPlaneCount; ++i) {
+ DataPlanes planes;
+ for (int i = 0; i < DataPlanes::kPlaneCount; ++i) {
planes.data[i] = reinterpret_cast<uint8*>(i);
planes.strides[i] = kWidth * 4;
}
- scoped_refptr<Capturer::CaptureData> data(new Capturer::CaptureData(planes,
- kWidth,
- kHeight,
- kFormat));
+ scoped_refptr<CaptureData> data(new CaptureData(planes, kWidth,
+ kHeight, kFormat));
// Set the recording rate to very low to avoid capture twice.
record_->SetMaxRate(0.01);
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index a83dfc8..1c89fa3 100644
--- a/remoting/host/simple_host_process.cc
+++ b/remoting/host/simple_host_process.cc
@@ -26,10 +26,10 @@
#include "base/nss_util.h"
#include "base/scoped_nsautorelease_pool.h"
#include "base/thread.h"
+#include "remoting/base/encoder_verbatim.h"
#include "remoting/host/capturer_fake.h"
#include "remoting/host/chromoting_host.h"
#include "remoting/host/chromoting_host_context.h"
-#include "remoting/host/encoder_verbatim.h"
#include "remoting/host/json_host_config.h"
#if defined(OS_WIN)
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index 85718e3..3c601d3 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -129,14 +129,24 @@
# depend on chromotocol_proto_lib for headers.
'hard_dependency': 1,
'sources': [
+ 'base/capture_data.h',
'base/compressor.h',
'base/compressor_zlib.cc',
'base/compressor_zlib.h',
'base/constants.cc',
'base/constants.h',
+ 'base/decoder.h',
+ 'base/decoder_verbatim.cc',
+ 'base/decoder_verbatim.h',
'base/decompressor.h',
'base/decompressor_zlib.cc',
'base/decompressor_zlib.h',
+ 'base/encoder.h',
+ 'base/encoder_verbatim.cc',
+ 'base/encoder_verbatim.h',
+ # TODO(hclam): Enable VP8 in the build.
+ #'base/encoder_vp8.cc',
+ #'base/encoder_vp8.h',
'base/multiple_array_input_stream.cc',
'base/multiple_array_input_stream.h',
'base/protocol_decoder.cc',
@@ -166,12 +176,6 @@
'host/differ.cc',
'host/differ_block.h',
'host/differ_block.cc',
- 'host/encoder.h',
- 'host/encoder_verbatim.cc',
- 'host/encoder_verbatim.h',
- # TODO(hclam): Enable VP8 in the build.
- #'host/encoder_vp8.cc',
- #'host/encoder_vp8.h',
'host/event_executor.h',
'host/session_manager.cc',
'host/session_manager.h',
@@ -231,9 +235,6 @@
'client/client_context.h',
'client/client_util.cc',
'client/client_util.h',
- 'client/decoder.h',
- 'client/decoder_verbatim.cc',
- 'client/decoder_verbatim.h',
'client/host_connection.h',
'client/input_handler.h',
'client/jingle_host_connection.cc',
@@ -342,12 +343,14 @@
],
'sources': [
'base/compressor_zlib_unittest.cc',
+ 'base/decoder_verbatim_unittest.cc',
'base/decompressor_zlib_unittest.cc',
+ # TODO(hclam): Enable VP8 in the build.
+ #'base/encoder_vp8_unittest.cc',
'base/mock_objects.h',
'base/multiple_array_input_stream_unittest.cc',
'base/protocol_decoder_unittest.cc',
'client/mock_objects.h',
- 'client/decoder_verbatim_unittest.cc',
'host/chromoting_host_context_unittest.cc',
'host/client_connection_unittest.cc',
'host/differ_unittest.cc',
@@ -355,8 +358,6 @@
'host/json_host_config_unittest.cc',
'host/mock_objects.h',
'host/session_manager_unittest.cc',
- # TODO(hclam): Enable VP8 in the build.
- #'host/encoder_vp8_unittest.cc',
'jingle_glue/jingle_thread_unittest.cc',
'jingle_glue/jingle_channel_unittest.cc',
'jingle_glue/iq_request_unittest.cc',