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

Side by Side Diff: remoting/base/encoder_verbatim.cc

Issue 3011010: Unit test for Encoder / Decoder for remoting (Closed)
Patch Set: fixed comments Created 10 years, 5 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
« no previous file with comments | « remoting/base/decoder_verbatim_unittest.cc ('k') | remoting/base/encoder_verbatim_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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/base/encoder_verbatim.h" 5 #include "remoting/base/encoder_verbatim.h"
6 6
7 #include "gfx/rect.h" 7 #include "gfx/rect.h"
8 #include "media/base/data_buffer.h" 8 #include "media/base/data_buffer.h"
9 #include "remoting/base/capture_data.h" 9 #include "remoting/base/capture_data.h"
10 #include "remoting/base/protocol_util.h" 10 #include "remoting/base/protocol_util.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (!in) continue; 64 if (!in) continue;
65 output_size += row_size * height; 65 output_size += row_size * height;
66 } 66 }
67 67
68 // Resize the output data buffer. 68 // Resize the output data buffer.
69 packet->mutable_rect_data()->mutable_data()->resize(output_size); 69 packet->mutable_rect_data()->mutable_data()->resize(output_size);
70 uint8* out = reinterpret_cast<uint8*>( 70 uint8* out = reinterpret_cast<uint8*>(
71 &((*packet->mutable_rect_data()->mutable_data())[0])); 71 &((*packet->mutable_rect_data()->mutable_data())[0]));
72 72
73 for (int i = 0; i < DataPlanes::kPlaneCount; ++i) { 73 for (int i = 0; i < DataPlanes::kPlaneCount; ++i) {
74 const uint8* in = capture_data->data_planes().data[i];
75 // Skip over planes that don't have data. 74 // Skip over planes that don't have data.
76 if (!in) continue; 75 if (!capture_data->data_planes().data[i])
76 continue;
77
78 const uint8* in = capture_data->data_planes().data[i] +
79 y * capture_data->data_planes().strides[i] +
80 x * bytes_per_pixel;
77 81
78 // TODO(hclam): Handle YUV since the height would be different. 82 // TODO(hclam): Handle YUV since the height would be different.
79 for (int j = 0; j < height; ++j) { 83 for (int j = 0; j < height; ++j) {
80 DCHECK_LE(row_size, capture_data->data_planes().strides[i]); 84 DCHECK_LE(row_size, capture_data->data_planes().strides[i]);
81 memcpy(out, in, row_size); 85 memcpy(out, in, width * bytes_per_pixel);
82 in += capture_data->data_planes().strides[i]; 86 in += capture_data->data_planes().strides[i];
83 out += row_size; 87 out += row_size;
84 } 88 }
85 } 89 }
86 return true; 90 return true;
87 } 91 }
88 92
89 } // namespace remoting 93 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/decoder_verbatim_unittest.cc ('k') | remoting/base/encoder_verbatim_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698