OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RECTANGLE_UPDATE_DECODER_H | 5 #ifndef REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H |
6 #define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H | 6 #define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
11 #include "remoting/base/decoder.h" | 11 #include "remoting/base/decoder.h" |
12 #include "ui/gfx/rect.h" | |
13 #include "ui/gfx/size.h" | |
14 | 12 |
15 class MessageLoop; | 13 class MessageLoop; |
16 | 14 |
17 namespace remoting { | 15 namespace remoting { |
18 | 16 |
19 class FrameConsumer; | 17 class FrameConsumer; |
20 class VideoPacketFormat; | 18 class VideoPacketFormat; |
21 class VideoPacket; | 19 class VideoPacket; |
22 | 20 |
23 namespace protocol { | 21 namespace protocol { |
(...skipping 23 matching lines...) Expand all Loading... |
47 | 45 |
48 // Set the scale ratio for the decoded video frame. Scale ratio greater | 46 // Set the scale ratio for the decoded video frame. Scale ratio greater |
49 // than 1.0 is not supported. | 47 // than 1.0 is not supported. |
50 void SetScaleRatios(double horizontal_ratio, double vertical_ratio); | 48 void SetScaleRatios(double horizontal_ratio, double vertical_ratio); |
51 | 49 |
52 // Set a new clipping rectangle for the decoder. Decoder should respect | 50 // Set a new clipping rectangle for the decoder. Decoder should respect |
53 // this clipping rectangle and only decode content in this rectangle and | 51 // this clipping rectangle and only decode content in this rectangle and |
54 // report dirty rectangles accordingly to enhance performance. | 52 // report dirty rectangles accordingly to enhance performance. |
55 // | 53 // |
56 // If scale ratio is not 1.0 then clipping rectangle is ignored. | 54 // If scale ratio is not 1.0 then clipping rectangle is ignored. |
57 void UpdateClipRect(const gfx::Rect& clip_rect); | 55 void UpdateClipRect(const SkIRect& clip_rect); |
58 | 56 |
59 // Force the decoder to output the last decoded video frame without any | 57 // Force the decoder to output the last decoded video frame without any |
60 // clipping. | 58 // clipping. |
61 void RefreshFullFrame(); | 59 void RefreshFullFrame(); |
62 | 60 |
63 private: | 61 private: |
64 friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>; | 62 friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>; |
65 friend class PartialFrameCleanup; | 63 friend class PartialFrameCleanup; |
66 | 64 |
67 ~RectangleUpdateDecoder(); | 65 ~RectangleUpdateDecoder(); |
68 | 66 |
69 void AllocateFrame(const VideoPacket* packet, Task* done); | 67 void AllocateFrame(const VideoPacket* packet, Task* done); |
70 void ProcessPacketData(const VideoPacket* packet, Task* done); | 68 void ProcessPacketData(const VideoPacket* packet, Task* done); |
71 void RefreshRects(const std::vector<gfx::Rect>& rects); | 69 void RefreshRects(const RectVector& rects); |
72 | 70 |
73 // Obtain updated rectangles from decoder and submit it to the consumer. | 71 // Obtain updated rectangles from decoder and submit it to the consumer. |
74 void SubmitToConsumer(); | 72 void SubmitToConsumer(); |
75 | 73 |
76 // Use |refresh_rects_| to do a refresh to the backing video frame. | 74 // Use |refresh_rects_| to do a refresh to the backing video frame. |
77 // When done the affected rectangles are submitted to the consumer. | 75 // When done the affected rectangles are submitted to the consumer. |
78 void DoRefresh(); | 76 void DoRefresh(); |
79 | 77 |
80 // Called by PartialFrameCleanup when consumer has finished using our | 78 // Called by PartialFrameCleanup when consumer has finished using our |
81 // internal frame. | 79 // internal frame. |
82 void OnFrameConsumed(); | 80 void OnFrameConsumed(); |
83 | 81 |
84 // Pointers to infrastructure objects. Not owned. | 82 // Pointers to infrastructure objects. Not owned. |
85 MessageLoop* message_loop_; | 83 MessageLoop* message_loop_; |
86 FrameConsumer* consumer_; | 84 FrameConsumer* consumer_; |
87 | 85 |
88 gfx::Size initial_screen_size_; | 86 SkISize initial_screen_size_; |
89 gfx::Rect clip_rect_; | 87 SkIRect clip_rect_; |
90 std::vector<gfx::Rect> refresh_rects_; | 88 RectVector refresh_rects_; |
91 | 89 |
92 scoped_ptr<Decoder> decoder_; | 90 scoped_ptr<Decoder> decoder_; |
93 | 91 |
94 // The video frame that the decoder writes to. | 92 // The video frame that the decoder writes to. |
95 scoped_refptr<media::VideoFrame> frame_; | 93 scoped_refptr<media::VideoFrame> frame_; |
96 bool frame_is_new_; | 94 bool frame_is_new_; |
97 | 95 |
98 // True if |consumer_| is currently using the frame. | 96 // True if |consumer_| is currently using the frame. |
99 bool frame_is_consuming_; | 97 bool frame_is_consuming_; |
100 }; | 98 }; |
101 | 99 |
102 } // namespace remoting | 100 } // namespace remoting |
103 | 101 |
104 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder); | 102 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder); |
105 | 103 |
106 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H | 104 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H |
OLD | NEW |