summaryrefslogtreecommitdiffstats
path: root/remoting/client/rectangle_update_decoder.h
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-27 22:49:19 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-27 22:49:19 +0000
commit7f796145c1ef2847c2e6ef9bf38323c703914bd4 (patch)
treec3700f199ea3e2252266a3edd99c22f0ba2bd372 /remoting/client/rectangle_update_decoder.h
parent8f0c70f64b4d12174b6fe266b31c9b1d51409940 (diff)
downloadchromium_src-7f796145c1ef2847c2e6ef9bf38323c703914bd4.zip
chromium_src-7f796145c1ef2847c2e6ef9bf38323c703914bd4.tar.gz
chromium_src-7f796145c1ef2847c2e6ef9bf38323c703914bd4.tar.bz2
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
Diffstat (limited to 'remoting/client/rectangle_update_decoder.h')
-rw-r--r--remoting/client/rectangle_update_decoder.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/remoting/client/rectangle_update_decoder.h b/remoting/client/rectangle_update_decoder.h
new file mode 100644
index 0000000..5f18e12
--- /dev/null
+++ b/remoting/client/rectangle_update_decoder.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H
+#define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H
+
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "media/base/video_frame.h"
+#include "remoting/base/decoder.h" // For UpdatedRects.
+
+class MessageLoop;
+
+namespace remoting {
+
+class FrameConsumer;
+class RectangleFormat;
+class RectangleUpdatePacket;
+
+// TODO(ajwong): Re-examine this API, especially with regards to how error
+// conditions on each step are reported. Should they be CHECKs? Logs? Other?
+class RectangleUpdateDecoder {
+ public:
+ RectangleUpdateDecoder(MessageLoop* message_loop,
+ FrameConsumer* consumer);
+ ~RectangleUpdateDecoder();
+
+ // Decodes the contents of |packet| calling OnPartialFrameOutput() in the
+ // regsitered as data is avaialable. DecodePacket may keep a reference to
+ // |packet| so the |packet| must remain alive and valid until |done| is
+ // executed.
+ //
+ // TODO(ajwong): Should packet be a const pointer to make the lifetime
+ // more clear?
+ void DecodePacket(const RectangleUpdatePacket& packet, Task* done);
+
+ private:
+ static bool IsValidPacket(const RectangleUpdatePacket& packet);
+
+ void InitializeDecoder(const RectangleFormat& format, Task* done);
+
+ void ProcessPacketData(const RectangleUpdatePacket& packet, Task* done);
+
+ // Pointers to infrastructure objects. Not owned.
+ MessageLoop* message_loop_;
+ FrameConsumer* consumer_;
+
+ scoped_ptr<Decoder> decoder_;
+ UpdatedRects updated_rects_;
+
+ // Framebuffer for the decoder.
+ scoped_refptr<media::VideoFrame> frame_;
+};
+
+} // namespace remoting
+
+DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder);
+
+#endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H