Chromium Code Reviews| Index: remoting/client/rectangle_update_decoder.h |
| diff --git a/remoting/client/rectangle_update_decoder.h b/remoting/client/rectangle_update_decoder.h |
| index 3c7468a082165b2629095ecd7375e703cb3f0e32..53cdc88a10e1cb7e9db02c3623b6ec9b97dd1299 100644 |
| --- a/remoting/client/rectangle_update_decoder.h |
| +++ b/remoting/client/rectangle_update_decoder.h |
| @@ -5,16 +5,13 @@ |
| #ifndef REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_ |
| #define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_ |
| -#include <list> |
| - |
| -#include "base/callback_forward.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "remoting/codec/video_decoder.h" |
| #include "remoting/client/chromoting_stats.h" |
| #include "remoting/client/frame_consumer_proxy.h" |
| #include "remoting/client/frame_producer.h" |
| -#include "remoting/protocol/video_stub.h" |
| +#include "remoting/client/video_processor.h" |
| #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| namespace base { |
| @@ -25,17 +22,11 @@ namespace remoting { |
| class ChromotingStats; |
| -namespace protocol { |
| -class SessionConfig; |
| -} // namespace protocol |
| - |
| -// TODO(ajwong): Re-examine this API, especially with regards to how error |
| -// conditions on each step are reported. Should they be CHECKs? Logs? Other? |
| +// Implementation of VideoProcessor interface that decodes frame on a separate |
| +// thread and then passes decoded frames to a FrameConsumer./ |
|
Wez
2014/01/14 16:23:14
nit: Lose the trailing /
Sergey Ulanov
2014/01/15 00:58:17
Done.
|
| +// |
| // TODO(sergeyu): Rename this class. |
|
Wez
2014/01/14 16:23:14
e.g. SoftwareVideoRenderer, since it's what we use
Sergey Ulanov
2014/01/15 00:58:17
Done.
|
| -class RectangleUpdateDecoder |
| - : public base::RefCountedThreadSafe<RectangleUpdateDecoder>, |
| - public FrameProducer, |
| - public protocol::VideoStub { |
| +class RectangleUpdateDecoder : public VideoProcessor, public FrameProducer { |
| public: |
| // Creates an update decoder on |main_task_runner_| and |decode_task_runner_|, |
| // outputting to |consumer|. The |main_task_runner_| is responsible for |
| @@ -47,8 +38,11 @@ class RectangleUpdateDecoder |
| scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner, |
| scoped_refptr<FrameConsumerProxy> consumer); |
| - // Initializes decoder with the information from the protocol config. |
| - void Initialize(const protocol::SessionConfig& config); |
| + // VideoProcessor implementation. |
| + virtual void Initialize(const protocol::SessionConfig& config) OVERRIDE; |
| + virtual ChromotingStats* GetStats() OVERRIDE; |
| + virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
| + const base::Closure& done) OVERRIDE; |
| // FrameProducer implementation. These methods may be called before we are |
| // Initialize()d, or we know the source screen size. |
| @@ -60,56 +54,11 @@ class RectangleUpdateDecoder |
| const webrtc::DesktopRect& clip_area) OVERRIDE; |
| virtual const webrtc::DesktopRegion* GetBufferShape() OVERRIDE; |
| - // VideoStub implementation. |
| - virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
| - const base::Closure& done) OVERRIDE; |
| - |
| - // Return the stats recorded by this client. |
| - ChromotingStats* GetStats(); |
| - |
| private: |
| - friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>; |
| - virtual ~RectangleUpdateDecoder(); |
| - |
| - // Paints the invalidated region to the next available buffer and returns it |
| - // to the consumer. |
| - void SchedulePaint(); |
| - void DoPaint(); |
| - |
| - // Decodes the contents of |packet|. DecodePacket may keep a reference to |
| - // |packet| so the |packet| must remain alive and valid until |done| is |
| - // executed. |
| - void DecodePacket(scoped_ptr<VideoPacket> packet, const base::Closure& done); |
| - |
| - // Callback method when a VideoPacket is processed. |decode_start| contains |
| - // the timestamp when the packet will start to be processed. |
| - void OnPacketDone(base::Time decode_start, const base::Closure& done); |
| - |
| - scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| - scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner_; |
| - scoped_refptr<FrameConsumerProxy> consumer_; |
| - scoped_ptr<VideoDecoder> decoder_; |
| - |
| - // Remote screen size in pixels. |
| - webrtc::DesktopSize source_size_; |
| - |
| - // Vertical and horizontal DPI of the remote screen. |
| - webrtc::DesktopVector source_dpi_; |
| - |
| - // The current dimensions of the frame consumer view. |
| - webrtc::DesktopSize view_size_; |
| - webrtc::DesktopRect clip_area_; |
| - |
| - // The drawing buffers supplied by the frame consumer. |
| - std::list<webrtc::DesktopFrame*> buffers_; |
| - |
| - // Flag used to coalesce runs of SchedulePaint()s into a single DoPaint(). |
| - bool paint_scheduled_; |
| - |
| - ChromotingStats stats_; |
| + class Core; |
| + scoped_refptr<Core> core_; |
|
Wez
2014/01/14 16:23:14
refptr makes kitteh sad... !^.^
Can't Core be an
Sergey Ulanov
2014/01/15 00:58:17
Done.
|
| - // Keep track of the most recent sequence number bounced back from the host. |
| - int64 latest_sequence_number_; |
| + DISALLOW_COPY_AND_ASSIGN(RectangleUpdateDecoder); |
| }; |
| } // namespace remoting |