diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-27 01:42:46 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-27 01:42:46 +0000 |
commit | 66db1af9f23041dd22f821cdee8f470e20bd2650 (patch) | |
tree | b284e9776df8cafc55629c5c75f5d7df4846f5eb /remoting/base/compressor.h | |
parent | 60b7dda9b3a35d038b7ac0f04ca8f242266eb2c6 (diff) | |
download | chromium_src-66db1af9f23041dd22f821cdee8f470e20bd2650.zip chromium_src-66db1af9f23041dd22f821cdee8f470e20bd2650.tar.gz chromium_src-66db1af9f23041dd22f821cdee8f470e20bd2650.tar.bz2 |
EncoderZlib/DecoderZlib for chromoting
Encoder and decoder using zlib for chromoting. This implementation has zero
copy out of the decoder and encoder. The consequence is that we have to break
out the zlib stream into rect boundaries which requires the synchronication
flush feature in zlib. This feature will hurt compression ratio but the effect
still need to be measured.
This patch also provides tests for testing the Encoder and Decoder pair with
zlib.
TEST=remoting_unittests
Review URL: http://codereview.chromium.org/2868062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53738 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/compressor.h')
-rw-r--r-- | remoting/base/compressor.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/remoting/base/compressor.h b/remoting/base/compressor.h index fd4c412..edb64f8 100644 --- a/remoting/base/compressor.h +++ b/remoting/base/compressor.h @@ -16,6 +16,13 @@ namespace remoting { // lifetime. This object should be destroyed after use. class Compressor { public: + + // Defines the flush modes for a compressor. + enum CompressorFlush { + CompressorNoFlush, + CompressorSyncFlush, + CompressorFinish, + }; virtual ~Compressor() {} // Compress |input_data| with |input_size| bytes. @@ -23,7 +30,14 @@ class Compressor { // |output_data| is provided by the caller and |output_size| is the // size of |output_data|. |output_size| must be greater than 0. // - // |input_size| is set to 0 to indicate the end of input stream. + // |flush| is set to one of the three value: + // - CompressorNoFlush + // No flushing is requested + // - CompressorSyncFlush + // Write all pending output and write a synchronization point in the + // output data stream. + // - CompressorFinish + // Mark the end of stream. // // Compressed data is written to |output_data|. |consumed| will // contain the number of bytes consumed from the input. |written| @@ -34,7 +48,7 @@ class Compressor { // useful for end of the compression stream. virtual bool Process(const uint8* input_data, int input_size, uint8* output_data, int output_size, - int* consumed, int* written) = 0; + CompressorFlush flush, int* consumed, int* written) = 0; }; } // namespace remoting |