OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_CLIENT_FRAME_CONSUMER_H_ | 5 #ifndef REMOTING_CLIENT_FRAME_CONSUMER_H_ |
6 #define REMOTING_CLIENT_FRAME_CONSUMER_H_ | 6 #define REMOTING_CLIENT_FRAME_CONSUMER_H_ |
7 | 7 |
8 #include "remoting/base/decoder.h" // For UpdatedRects | 8 #include "base/callback_forward.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "third_party/skia/include/core/SkRect.h" | |
11 #include "third_party/skia/include/core/SkRegion.h" | |
12 #include "third_party/skia/include/core/SkSize.h" | |
13 | |
14 namespace pp { | |
15 class ImageData; | |
16 } // namespace pp | |
9 | 17 |
10 namespace remoting { | 18 namespace remoting { |
11 | 19 |
12 class FrameConsumer { | 20 class FrameConsumer { |
13 public: | 21 public: |
14 FrameConsumer() {} | 22 FrameConsumer() {} |
15 virtual ~FrameConsumer() {} | 23 virtual ~FrameConsumer() {} |
16 | 24 |
17 // Request a frame be allocated from the FrameConsumer. | 25 // OnFrameReady() is called every time at least one rectangle of |
18 // | 26 // output is produced. The routine captures the view parameters and |
19 // If a frame cannot be allocated to fit the format, and |size| | 27 // the backing store where the updated pixels should be written to. |
Wez
2012/02/07 01:56:31
Not sure what it means for it to "capture" them?
Wez
2012/02/07 01:56:31
It looks like OnFrameReady() is used to indicate t
alexeypa (please no reviews)
2012/02/15 23:06:22
This interface was completely changed. So this com
| |
20 // requirements, |frame_out| will be set to NULL. | 28 virtual void OnFrameReady(const SkISize& screen_size, |
21 // | 29 SkISize* view_size_out, |
22 // An allocated frame will have at least the |size| requested, but | 30 SkIRect* clip_area_out, |
23 // may be bigger. Query the retrun frame for the actual frame size, | 31 scoped_ptr<pp::ImageData>* backing_store_out, |
Wez
2012/02/07 01:56:31
Rather than having out-parameters, define a frame-
| |
24 // stride, etc. | 32 const base::Closure& done) = 0; |
25 // | |
26 // The AllocateFrame call is asynchronous. From invocation, until when the | |
27 // |done| callback is invoked, |frame_out| should be considered to be locked | |
28 // by the FrameConsumer, must remain a valid pointer, and should not be | |
29 // examined or modified. After |done| is called, the |frame_out| will | |
30 // contain a result of the allocation. If a frame could not be allocated, | |
31 // |frame_out| will be NULL. | |
32 // | |
33 // All frames retrieved via the AllocateFrame call must be released by a | |
34 // corresponding call ReleaseFrame(scoped_refptr<VideoFrame>* frame_out. | |
35 virtual void AllocateFrame(media::VideoFrame::Format format, | |
36 const SkISize& size, | |
37 scoped_refptr<media::VideoFrame>* frame_out, | |
38 const base::Closure& done) = 0; | |
39 | 33 |
40 virtual void ReleaseFrame(media::VideoFrame* frame) = 0; | 34 // OnPaintDone is called when painting has been done and the backing |
41 | 35 // store should be flushed to the screen. |
42 // OnPartialFrameOutput() is called every time at least one rectangle of | 36 virtual void OnPaintDone(scoped_ptr<pp::ImageData> backing_store, |
43 // output is produced. The |frame| is guaranteed to have valid data for all | 37 scoped_ptr<SkRegion> updated_region) = 0; |
Wez
2012/02/07 01:56:31
No completion indicator? How do we rate-limit to
| |
44 // of |region|. | |
45 // | |
46 // Both |frame| and |region| are guaranteed to be valid until the |done| | |
47 // callback is invoked. | |
48 virtual void OnPartialFrameOutput(media::VideoFrame* frame, | |
49 SkRegion* region, | |
50 const base::Closure& done) = 0; | |
51 | 38 |
52 private: | 39 private: |
53 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); | 40 DISALLOW_COPY_AND_ASSIGN(FrameConsumer); |
54 }; | 41 }; |
55 | 42 |
56 } // namespace remoting | 43 } // namespace remoting |
57 | 44 |
58 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ | 45 #endif // REMOTING_CLIENT_FRAME_CONSUMER_H_ |
OLD | NEW |