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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "remoting/base/compressor_verbatim.h" | 6 #include "remoting/base/compressor_verbatim.h" |
7 | 7 |
8 namespace remoting { | 8 namespace remoting { |
9 | 9 |
10 CompressorVerbatim::CompressorVerbatim() { | 10 CompressorVerbatim::CompressorVerbatim() { |
11 } | 11 } |
12 | 12 |
13 CompressorVerbatim::~CompressorVerbatim() { | 13 CompressorVerbatim::~CompressorVerbatim() { |
14 } | 14 } |
15 | 15 |
16 void CompressorVerbatim::Reset() { | 16 void CompressorVerbatim::Reset() { |
17 } | 17 } |
18 | 18 |
19 bool CompressorVerbatim::Process(const uint8* input_data, int input_size, | 19 bool CompressorVerbatim::Process(const uint8* input_data, int input_size, |
20 uint8* output_data, int output_size, | 20 uint8* output_data, int output_size, |
21 CompressorFlush flush, int* consumed, | 21 CompressorFlush flush, int* consumed, |
22 int* written) { | 22 int* written) { |
23 DCHECK_GT(output_size, 0); | 23 DCHECK_GT(output_size, 0); |
24 int bytes_to_copy = std::min(input_size, output_size); | 24 int bytes_to_copy = std::min(input_size, output_size); |
25 memcpy(output_data, input_data, bytes_to_copy); | 25 memcpy(output_data, input_data, bytes_to_copy); |
26 | 26 |
27 // Since we're just a memcpy, consumed and written are the same. | 27 // Since we're just a memcpy, consumed and written are the same. |
28 *consumed = *written = bytes_to_copy; | 28 *consumed = *written = bytes_to_copy; |
29 return true; | 29 return (flush != CompressorFinish) || (output_size < bytes_to_copy); |
30 } | 30 } |
31 | 31 |
32 } // namespace remoting | 32 } // namespace remoting |
OLD | NEW |