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

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

Issue 3013015: Initial pass at integrating Differ into the chromoting host code.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « remoting/base/codec_test.cc ('k') | remoting/base/encoder_zlib.h » ('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"
11 #include "remoting/base/protocol/chromotocol.pb.h" 11 #include "remoting/base/protocol/chromotocol.pb.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 14
15 using media::DataBuffer; 15 using media::DataBuffer;
16 16
17 void EncoderVerbatim::Encode(scoped_refptr<CaptureData> capture_data, 17 void EncoderVerbatim::Encode(scoped_refptr<CaptureData> capture_data,
18 bool key_frame, 18 bool key_frame,
19 DataAvailableCallback* data_available_callback) { 19 DataAvailableCallback* data_available_callback) {
20 int num_rects = capture_data->dirty_rects().size(); 20 const InvalidRects& rects = capture_data->dirty_rects();
21 for (int i = 0; i < num_rects; i++) { 21 int num_rects = rects.size();
22 const gfx::Rect& dirty_rect = capture_data->dirty_rects()[i]; 22 int index = 0;
23 for (InvalidRects::const_iterator r = rects.begin();
24 r != rects.end(); ++r, ++index) {
25 const gfx::Rect& dirty_rect = *r;
23 HostMessage* msg = new HostMessage(); 26 HostMessage* msg = new HostMessage();
24 UpdateStreamPacketMessage* packet = msg->mutable_update_stream_packet(); 27 UpdateStreamPacketMessage* packet = msg->mutable_update_stream_packet();
25 28
26 if (EncodeRect(dirty_rect.x(), dirty_rect.y(), dirty_rect.width(), 29 if (EncodeRect(dirty_rect.x(), dirty_rect.y(), dirty_rect.width(),
27 dirty_rect.height(), capture_data, packet)) { 30 dirty_rect.height(), capture_data, packet)) {
28 // Prepare the end rect content. 31 // Prepare the end rect content.
29 packet->mutable_end_rect(); 32 packet->mutable_end_rect();
30 33
31 EncodingState state = EncodingInProgress; 34 EncodingState state = EncodingInProgress;
32 if (i == 0) { 35 if (index == 0) {
33 state |= EncodingStarting; 36 state |= EncodingStarting;
34 } 37 }
35 if (i == num_rects - 1) { 38 if (index == num_rects - 1) {
36 state |= EncodingEnded; 39 state |= EncodingEnded;
37 } 40 }
38 data_available_callback->Run(msg, state); 41 data_available_callback->Run(msg, state);
39 } 42 }
40 } 43 }
41 44
42 delete data_available_callback; 45 delete data_available_callback;
43 } 46 }
44 47
45 bool EncoderVerbatim::EncodeRect( 48 bool EncoderVerbatim::EncodeRect(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 DCHECK_LE(row_size, capture_data->data_planes().strides[i]); 86 DCHECK_LE(row_size, capture_data->data_planes().strides[i]);
84 memcpy(out, in, width * bytes_per_pixel); 87 memcpy(out, in, width * bytes_per_pixel);
85 in += capture_data->data_planes().strides[i]; 88 in += capture_data->data_planes().strides[i];
86 out += row_size; 89 out += row_size;
87 } 90 }
88 } 91 }
89 return true; 92 return true;
90 } 93 }
91 94
92 } // namespace remoting 95 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/codec_test.cc ('k') | remoting/base/encoder_zlib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698