Chromium Code Reviews| 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" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 RectangleUpdateDecoder(MessageLoop* message_loop, | 31 RectangleUpdateDecoder(MessageLoop* message_loop, |
| 32 FrameConsumer* consumer); | 32 FrameConsumer* consumer); |
| 33 | 33 |
| 34 // Initializes decoder with the infromation from the protocol config. | 34 // Initializes decoder with the infromation from the protocol config. |
| 35 void Initialize(const protocol::SessionConfig& config); | 35 void Initialize(const protocol::SessionConfig& config); |
| 36 | 36 |
| 37 // Decodes the contents of |packet| calling OnPartialFrameOutput() in the | 37 // Decodes the contents of |packet| calling OnPartialFrameOutput() in the |
| 38 // regsitered as data is avaialable. DecodePacket may keep a reference to | 38 // regsitered as data is avaialable. DecodePacket may keep a reference to |
| 39 // |packet| so the |packet| must remain alive and valid until |done| is | 39 // |packet| so the |packet| must remain alive and valid until |done| is |
| 40 // executed. | 40 // executed. |
| 41 // | 41 void DecodePacket(const VideoPacket* packet, const base::Closure& done); |
| 42 // TODO(ajwong): Should packet be a const pointer to make the lifetime | |
| 43 // more clear? | |
| 44 void DecodePacket(const VideoPacket* packet, Task* done); | |
| 45 | 42 |
| 46 // Set the scale ratio for the decoded video frame. Scale ratio greater | 43 // Set the scale ratio for the decoded video frame. Scale ratio greater |
| 47 // than 1.0 is not supported. | 44 // than 1.0 is not supported. |
| 48 void SetScaleRatios(double horizontal_ratio, double vertical_ratio); | 45 void SetScaleRatios(double horizontal_ratio, double vertical_ratio); |
| 49 | 46 |
| 50 // Set a new clipping rectangle for the decoder. Decoder should respect | 47 // Set a new clipping rectangle for the decoder. Decoder should respect |
| 51 // this clipping rectangle and only decode content in this rectangle and | 48 // this clipping rectangle and only decode content in this rectangle and |
| 52 // report dirty rectangles accordingly to enhance performance. | 49 // report dirty rectangles accordingly to enhance performance. |
| 53 // | 50 // |
| 54 // If scale ratio is not 1.0 then clipping rectangle is ignored. | 51 // If scale ratio is not 1.0 then clipping rectangle is ignored. |
| 55 void UpdateClipRect(const SkIRect& clip_rect); | 52 void UpdateClipRect(const SkIRect& clip_rect); |
| 56 | 53 |
| 57 // Force the decoder to output the last decoded video frame without any | 54 // Force the decoder to output the last decoded video frame without any |
| 58 // clipping. | 55 // clipping. |
| 59 void RefreshFullFrame(); | 56 void RefreshFullFrame(); |
| 60 | 57 |
| 61 private: | 58 private: |
| 62 friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>; | 59 friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>; |
| 63 friend class PartialFrameCleanup; | 60 friend class PartialFrameCleanup; |
| 64 | 61 |
| 65 ~RectangleUpdateDecoder(); | 62 ~RectangleUpdateDecoder(); |
| 66 | 63 |
| 67 void AllocateFrame(const VideoPacket* packet, Task* done); | 64 void AllocateFrame(const VideoPacket* packet, const base::Closure& done); |
| 68 void ProcessPacketData(const VideoPacket* packet, Task* done); | 65 void ProcessPacketData(const VideoPacket* packet, const base::Closure& done); |
| 69 void RefreshRects(const RectVector& rects); | 66 void RefreshRects(const RectVector& rects); |
| 70 | 67 |
| 71 // Obtain updated rectangles from decoder and submit it to the consumer. | 68 // Obtain updated rectangles from decoder and submit it to the consumer. |
| 72 void SubmitToConsumer(); | 69 void SubmitToConsumer(); |
| 73 | 70 |
| 74 // Use |refresh_rects_| to do a refresh to the backing video frame. | 71 // Use |refresh_rects_| to do a refresh to the backing video frame. |
| 75 // When done the affected rectangles are submitted to the consumer. | 72 // When done the affected rectangles are submitted to the consumer. |
| 76 void DoRefresh(); | 73 void DoRefresh(); |
| 77 | 74 |
| 78 // Called by PartialFrameCleanup when consumer has finished using our | 75 // Called by PartialFrameCleanup when consumer has finished using our |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 92 // The video frame that the decoder writes to. | 89 // The video frame that the decoder writes to. |
| 93 scoped_refptr<media::VideoFrame> frame_; | 90 scoped_refptr<media::VideoFrame> frame_; |
| 94 bool frame_is_new_; | 91 bool frame_is_new_; |
| 95 | 92 |
| 96 // True if |consumer_| is currently using the frame. | 93 // True if |consumer_| is currently using the frame. |
| 97 bool frame_is_consuming_; | 94 bool frame_is_consuming_; |
| 98 }; | 95 }; |
| 99 | 96 |
| 100 } // namespace remoting | 97 } // namespace remoting |
| 101 | 98 |
| 102 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder); | 99 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder); |
|
awong
2011/11/09 21:52:44
Do we still need this?
Sergey Ulanov
2011/11/09 22:09:22
Done. Also removed DISABLE_RUNNABLE_METHOD_REFCOUN
| |
| 103 | 100 |
| 104 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H | 101 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H |
| OLD | NEW |