| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "gfx/size.h" |
| 10 #include "media/base/video_frame.h" | 11 #include "media/base/video_frame.h" |
| 11 #include "remoting/base/decoder.h" // For UpdatedRects | |
| 12 | 12 |
| 13 class MessageLoop; | 13 class MessageLoop; |
| 14 | 14 |
| 15 namespace remoting { | 15 namespace remoting { |
| 16 | 16 |
| 17 class Decoder; | 17 class Decoder; |
| 18 class FrameConsumer; | 18 class FrameConsumer; |
| 19 class VideoPacketFormat; | 19 class VideoPacketFormat; |
| 20 class VideoPacket; | 20 class VideoPacket; |
| 21 | 21 |
| 22 namespace protocol { |
| 23 class SessionConfig; |
| 24 } // namespace protocol |
| 25 |
| 22 // TODO(ajwong): Re-examine this API, especially with regards to how error | 26 // TODO(ajwong): Re-examine this API, especially with regards to how error |
| 23 // conditions on each step are reported. Should they be CHECKs? Logs? Other? | 27 // conditions on each step are reported. Should they be CHECKs? Logs? Other? |
| 28 // TODO(sergeyu): Rename this class. |
| 24 class RectangleUpdateDecoder { | 29 class RectangleUpdateDecoder { |
| 25 public: | 30 public: |
| 26 RectangleUpdateDecoder(MessageLoop* message_loop, | 31 RectangleUpdateDecoder(MessageLoop* message_loop, |
| 27 FrameConsumer* consumer); | 32 FrameConsumer* consumer); |
| 28 ~RectangleUpdateDecoder(); | 33 ~RectangleUpdateDecoder(); |
| 29 | 34 |
| 35 // Initializes decoder with the infromation from the protocol config. |
| 36 void Initialize(const protocol::SessionConfig* config); |
| 37 |
| 30 // Decodes the contents of |packet| calling OnPartialFrameOutput() in the | 38 // Decodes the contents of |packet| calling OnPartialFrameOutput() in the |
| 31 // regsitered as data is avaialable. DecodePacket may keep a reference to | 39 // regsitered as data is avaialable. DecodePacket may keep a reference to |
| 32 // |packet| so the |packet| must remain alive and valid until |done| is | 40 // |packet| so the |packet| must remain alive and valid until |done| is |
| 33 // executed. | 41 // executed. |
| 34 // | 42 // |
| 35 // TODO(ajwong): Should packet be a const pointer to make the lifetime | 43 // TODO(ajwong): Should packet be a const pointer to make the lifetime |
| 36 // more clear? | 44 // more clear? |
| 37 void DecodePacket(const VideoPacket& packet, Task* done); | 45 void DecodePacket(const VideoPacket* packet, Task* done); |
| 38 | 46 |
| 39 private: | 47 private: |
| 40 static bool IsValidPacket(const VideoPacket& packet); | 48 void InitializeDecoder(Task* done); |
| 41 | 49 |
| 42 void InitializeDecoder(const VideoPacketFormat& format, Task* done); | 50 void ProcessPacketData(const VideoPacket* packet, Task* done); |
| 43 | |
| 44 void ProcessPacketData(const VideoPacket& packet, Task* done); | |
| 45 | 51 |
| 46 // Pointers to infrastructure objects. Not owned. | 52 // Pointers to infrastructure objects. Not owned. |
| 47 MessageLoop* message_loop_; | 53 MessageLoop* message_loop_; |
| 48 FrameConsumer* consumer_; | 54 FrameConsumer* consumer_; |
| 49 | 55 |
| 56 gfx::Size screen_size_; |
| 57 |
| 50 scoped_ptr<Decoder> decoder_; | 58 scoped_ptr<Decoder> decoder_; |
| 51 UpdatedRects updated_rects_; | |
| 52 | 59 |
| 53 // Framebuffer for the decoder. | 60 // Framebuffer for the decoder. |
| 54 scoped_refptr<media::VideoFrame> frame_; | 61 scoped_refptr<media::VideoFrame> frame_; |
| 55 }; | 62 }; |
| 56 | 63 |
| 57 } // namespace remoting | 64 } // namespace remoting |
| 58 | 65 |
| 59 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder); | 66 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder); |
| 60 | 67 |
| 61 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H | 68 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H |
| OLD | NEW |