summaryrefslogtreecommitdiffstats
path: root/remoting/host/encoder.h
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-15 16:35:33 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-15 16:35:33 +0000
commit7c186b16ffa7f386a60223157daa08a897052681 (patch)
tree942d5756bac3c6ea0665deab9873ca3c70c4e538 /remoting/host/encoder.h
parentded827d5bbdf31d0903d12ce326534cd4b956dbf (diff)
downloadchromium_src-7c186b16ffa7f386a60223157daa08a897052681.zip
chromium_src-7c186b16ffa7f386a60223157daa08a897052681.tar.gz
chromium_src-7c186b16ffa7f386a60223157daa08a897052681.tar.bz2
Revamp threading a bit so that arguments are passed through and owned by the various threads instead of being all owned by the session manager.
BUG=none TEST=none Review URL: http://codereview.chromium.org/2807002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/encoder.h')
-rw-r--r--remoting/host/encoder.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/remoting/host/encoder.h b/remoting/host/encoder.h
index 53ddb63..808b34f 100644
--- a/remoting/host/encoder.h
+++ b/remoting/host/encoder.h
@@ -6,7 +6,8 @@
#define REMOTING_HOST_ENCODER_H_
#include "base/basictypes.h"
-#include "base/task.h"
+#include "base/callback.h"
+#include "media/base/data_buffer.h"
#include "remoting/base/protocol/chromotocol.pb.h"
#include "remoting/host/capturer.h"
@@ -23,6 +24,24 @@ namespace remoting {
// This class operates asynchronously to enable maximum throughput.
class Encoder {
public:
+
+ // EncodingState is a bitfield that tracks the state of the encoding.
+ // An encoding that consists of a single block could concievably be starting
+ // inprogress and ended at the same time.
+ enum {
+ EncodingStarting = 1 << 0,
+ EncodingInProgress = 1 << 1,
+ EncodingEnded = 1 << 2
+ };
+ typedef int EncodingState;
+
+ // DataAvailableCallback is called as blocks of data are made available
+ // from the encoder. The callback takes ownership of header and is
+ // responsible for deleting it.
+ typedef Callback3<const UpdateStreamPacketHeader*,
+ const scoped_refptr<media::DataBuffer>&,
+ EncodingState>::Type DataAvailableCallback;
+
virtual ~Encoder() {}
// Encode an image stored in |input_data|. |dirty_rects| contains
@@ -41,13 +60,10 @@ class Encoder {
// Implementation has to ensure that when |data_available_task| is called
// output parameters are stable.
virtual void Encode(const DirtyRects& dirty_rects,
- const uint8** input_data,
+ const uint8* const* input_data,
const int* strides,
bool key_frame,
- UpdateStreamPacketHeader* header,
- scoped_refptr<media::DataBuffer>* output_data,
- bool* encode_done,
- Task* data_available_task) = 0;
+ DataAvailableCallback* data_available_callback) = 0;
// Set the dimension of the incoming images. Need to call this before
// calling Encode().