summaryrefslogtreecommitdiffstats
path: root/remoting/base/encoder_verbatim.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-24 02:22:07 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-24 02:22:07 +0000
commitfb13c766d30c440a7b9a2850ceee5fc49a8903dc (patch)
tree1a6d425cdf3e8e09c7685e983932bc59f299d7b9 /remoting/base/encoder_verbatim.cc
parent7fb32637bd9968a4c4c9e1d0a08e9b3501b0f7f8 (diff)
downloadchromium_src-fb13c766d30c440a7b9a2850ceee5fc49a8903dc.zip
chromium_src-fb13c766d30c440a7b9a2850ceee5fc49a8903dc.tar.gz
chromium_src-fb13c766d30c440a7b9a2850ceee5fc49a8903dc.tar.bz2
Unit test for Encoder / Decoder for remoting
Unit test utils for Encoder and Decoder. The tests will cover the state and messages sent out of the Encoder and Decoder are in correct order. It also make sure Decoded output matches input to the Encoder. Review URL: http://codereview.chromium.org/3011010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/encoder_verbatim.cc')
-rw-r--r--remoting/base/encoder_verbatim.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/remoting/base/encoder_verbatim.cc b/remoting/base/encoder_verbatim.cc
index f6cc2ca..509daf9 100644
--- a/remoting/base/encoder_verbatim.cc
+++ b/remoting/base/encoder_verbatim.cc
@@ -71,14 +71,18 @@ bool EncoderVerbatim::EncodeRect(
&((*packet->mutable_rect_data()->mutable_data())[0]));
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;
+ if (!capture_data->data_planes().data[i])
+ continue;
+
+ const uint8* in = capture_data->data_planes().data[i] +
+ y * capture_data->data_planes().strides[i] +
+ x * bytes_per_pixel;
// TODO(hclam): Handle YUV since the height would be different.
for (int j = 0; j < height; ++j) {
DCHECK_LE(row_size, capture_data->data_planes().strides[i]);
- memcpy(out, in, row_size);
+ memcpy(out, in, width * bytes_per_pixel);
in += capture_data->data_planes().strides[i];
out += row_size;
}