| OLD | NEW |
| 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/host/encoder_verbatim.h" | 5 #include "remoting/host/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/protocol/chromotocol.pb.h" | 9 #include "remoting/base/protocol/chromotocol.pb.h" |
| 10 | 10 |
| 11 namespace remoting { | 11 namespace remoting { |
| 12 | 12 |
| 13 using media::DataBuffer; | 13 using media::DataBuffer; |
| 14 | 14 |
| 15 void EncoderVerbatim::Encode(const DirtyRects& dirty_rects, | 15 void EncoderVerbatim::Encode(const DirtyRects& dirty_rects, |
| 16 const uint8* const* input_data, | 16 const uint8* const* input_data, |
| 17 const int* strides, | 17 const int* strides, |
| 18 bool key_frame, | 18 bool key_frame, |
| 19 DataAvailableCallback* data_available_callback) { | 19 DataAvailableCallback* data_available_callback) { |
| 20 int num_rects = dirty_rects.size(); | 20 int num_rects = dirty_rects.size(); |
| 21 for (int i = 0; i < num_rects; i++) { | 21 for (int i = 0; i < num_rects; i++) { |
| 22 scoped_refptr<DataBuffer> data; | 22 scoped_refptr<DataBuffer> data; |
| 23 gfx::Rect dirty_rect = dirty_rects[i]; | 23 gfx::Rect dirty_rect = dirty_rects[i]; |
| 24 PixelFormat pixel_format; | |
| 25 UpdateStreamEncoding encoding; | |
| 26 scoped_ptr<UpdateStreamPacketHeader> header(new UpdateStreamPacketHeader); | 24 scoped_ptr<UpdateStreamPacketHeader> header(new UpdateStreamPacketHeader); |
| 27 if (EncodeRect(dirty_rect, | 25 if (EncodeRect(dirty_rect, |
| 28 input_data, | 26 input_data, |
| 29 strides, | 27 strides, |
| 30 header.get(), | 28 header.get(), |
| 31 &data)) { | 29 &data)) { |
| 32 EncodingState state = EncodingInProgress; | 30 EncodingState state = EncodingInProgress; |
| 33 if (i == 0) { | 31 if (i == 0) { |
| 34 state |= EncodingStarting; | 32 state |= EncodingStarting; |
| 35 } else if (i == num_rects - 1) { | 33 } else if (i == num_rects - 1) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 DCHECK_LE(row_size, strides[i]); | 100 DCHECK_LE(row_size, strides[i]); |
| 103 memcpy(out, in, row_size); | 101 memcpy(out, in, row_size); |
| 104 in += strides[i]; | 102 in += strides[i]; |
| 105 out += row_size; | 103 out += row_size; |
| 106 } | 104 } |
| 107 } | 105 } |
| 108 return true; | 106 return true; |
| 109 } | 107 } |
| 110 | 108 |
| 111 } // namespace remoting | 109 } // namespace remoting |
| OLD | NEW |