summaryrefslogtreecommitdiffstats
path: root/remoting/client/frame_consumer.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/frame_consumer.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/frame_consumer.h')
-rw-r--r--remoting/client/frame_consumer.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/remoting/client/frame_consumer.h b/remoting/client/frame_consumer.h
new file mode 100644
index 0000000..05c4448
--- /dev/null
+++ b/remoting/client/frame_consumer.h
@@ -0,0 +1,59 @@
+// 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_FRAME_CONSUMER_H_
+#define REMOTING_CLIENT_FRAME_CONSUMER_H_
+
+namespace remoting {
+
+class FrameConsumer {
+ public:
+ FrameConsumer() {}
+ virtual ~FrameConsumer() {}
+
+ // Request a frame be allocated from the FrameConsumer.
+ //
+ // If a frame cannot be allocated to fit the format, and height/width
+ // requirements, |frame_out| will be set to NULL.
+ //
+ // An allocated frame will have at least the width and height requested, but
+ // may be bigger. Query the retrun frame for the actual frame size, stride,
+ // etc.
+ //
+ // The AllocateFrame call is asynchronous. From invocation, until when the
+ // |done| callback is invoked, |frame_out| should be considered to be locked
+ // by the FrameConsumer, must remain a valid pointer, and should not be
+ // examined or modified. After |done| is called, the |frame_out| will
+ // contain a result of the allocation. If a frame could not be allocated,
+ // |frame_out| will be NULL.
+ //
+ // All frames retrieved via the AllocateFrame call must be released by a
+ // corresponding call ReleaseFrame(scoped_refptr<VideoFrame>* frame_out.
+ virtual void AllocateFrame(media::VideoFrame::Format format,
+ size_t width,
+ size_t height,
+ base::TimeDelta timestamp,
+ base::TimeDelta duration,
+ scoped_refptr<media::VideoFrame>* frame_out,
+ Task* done) = 0;
+
+ virtual void ReleaseFrame(media::VideoFrame* frame) = 0;
+
+ // OnPartialFrameOutput() is called every time at least one rectangle of
+ // output is produced. The |frame| is guaranteed to have valid data for
+ // every region included in the |rects| list.
+ //
+ // Both |frame| and |rects| are guaranteed to be valid until the |done|
+ // callback is invoked.
+ virtual void OnPartialFrameOutput(media::VideoFrame* frame,
+ UpdatedRects* rects,
+ Task* done) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FrameConsumer);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_CLIENT_FRAME_CONSUMER_H_