From 7f796145c1ef2847c2e6ef9bf38323c703914bd4 Mon Sep 17 00:00:00 2001 From: "ajwong@chromium.org" Date: Mon, 27 Sep 2010 22:49:19 +0000 Subject: Add in a new FrameConsumer interface, Decode API, and a RectangleUpdateDecoder abstraction. This should allow a decoder that can still request the view to allocate frames without being owned by the view itself. This allows for cleaner threading semantics and reduced coupling of classes. The new decoder API keeps the decoder from being aware of the network packet types tightening up the API layering. BUG=52833 TEST=None. This code isn't used yet. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=60703 Review URL: http://codereview.chromium.org/3335012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60721 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/base/decoder.h | 24 ++++++++++++++++++++++++ remoting/base/protocol/chromotocol.proto | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'remoting/base') diff --git a/remoting/base/decoder.h b/remoting/base/decoder.h index 75ffa03..c8c77a7 100644 --- a/remoting/base/decoder.h +++ b/remoting/base/decoder.h @@ -90,6 +90,30 @@ class Decoder { // of BeginDecode() / EndDecode(). virtual bool IsStarted() { return started_; } + // --- NEW API --- + // TODO(ajwong): This API is incorrect in the face of a streaming decode + // protocol like VP8. However, it breaks the layering abstraction by + // depending on the network packet protocol buffer type. I'm going to go + // forward with it as is, and then refactor again to support streaming + // decodes. + + // Initializes the decoder to draw into the given |frame|. The |clip| + // specifies the region to draw into. The clip region must fit inside + // the dimensions of frame. Failure to do so will CHECK Fail. + virtual void Initialize(scoped_refptr frame, + const gfx::Rect& clip) {} + + // Reset the decoder to an uninitialized state. Release all references to + // the initialized |frame|. Initialize() must be called before the decoder + // is used again. + virtual void Reset() {} + + // Feeds more data into the decoder. + virtual void DecodeBytes(const std::string& encoded_bytes) {} + + // Returns true if decoder is ready to accept data via ProcessRectangleData. + virtual bool IsReadyForData() { return false; } + protected: // Every decoder will have two internal states because there are three // kinds of messages send to PartialDecode(). diff --git a/remoting/base/protocol/chromotocol.proto b/remoting/base/protocol/chromotocol.proto index b3fa848..865fd3f 100644 --- a/remoting/base/protocol/chromotocol.proto +++ b/remoting/base/protocol/chromotocol.proto @@ -138,7 +138,7 @@ message RectangleUpdatePacket { optional int32 sequence_number = 2 [default = 0]; // This is provided on the first packet of the rectangle data, when - // the sequence_number is 0. + // the flags has FIRST_PACKET set. optional RectangleFormat format = 3; optional bytes encoded_rect = 4; -- cgit v1.1