| 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_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 <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "remoting/codec/video_decoder.h" | 13 #include "remoting/codec/video_decoder.h" |
| 14 #include "remoting/client/chromoting_stats.h" | 14 #include "remoting/client/chromoting_stats.h" |
| 15 #include "remoting/client/frame_consumer_proxy.h" | 15 #include "remoting/client/frame_consumer_proxy.h" |
| 16 #include "remoting/client/frame_producer.h" | 16 #include "remoting/client/frame_producer.h" |
| 17 #include "remoting/protocol/video_stub.h" | 17 #include "remoting/protocol/video_stub.h" |
| 18 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | |
| 19 | 18 |
| 20 namespace base { | 19 namespace base { |
| 21 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
| 22 } // namespace base | 21 } // namespace base |
| 23 | 22 |
| 24 namespace remoting { | 23 namespace remoting { |
| 25 | 24 |
| 26 class ChromotingStats; | 25 class ChromotingStats; |
| 27 | 26 |
| 28 namespace protocol { | 27 namespace protocol { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 46 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 45 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 47 scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner, | 46 scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner, |
| 48 scoped_refptr<FrameConsumerProxy> consumer); | 47 scoped_refptr<FrameConsumerProxy> consumer); |
| 49 | 48 |
| 50 // Initializes decoder with the information from the protocol config. | 49 // Initializes decoder with the information from the protocol config. |
| 51 void Initialize(const protocol::SessionConfig& config); | 50 void Initialize(const protocol::SessionConfig& config); |
| 52 | 51 |
| 53 // FrameProducer implementation. These methods may be called before we are | 52 // FrameProducer implementation. These methods may be called before we are |
| 54 // Initialize()d, or we know the source screen size. | 53 // Initialize()d, or we know the source screen size. |
| 55 virtual void DrawBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; | 54 virtual void DrawBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; |
| 56 virtual void InvalidateRegion(const webrtc::DesktopRegion& region) OVERRIDE; | 55 virtual void InvalidateRegion(const SkRegion& region) OVERRIDE; |
| 57 virtual void RequestReturnBuffers(const base::Closure& done) OVERRIDE; | 56 virtual void RequestReturnBuffers(const base::Closure& done) OVERRIDE; |
| 58 virtual void SetOutputSizeAndClip( | 57 virtual void SetOutputSizeAndClip(const SkISize& view_size, |
| 59 const webrtc::DesktopSize& view_size, | 58 const SkIRect& clip_area) OVERRIDE; |
| 60 const webrtc::DesktopRect& clip_area) OVERRIDE; | 59 virtual const SkRegion* GetBufferShape() OVERRIDE; |
| 61 virtual const webrtc::DesktopRegion* GetBufferShape() OVERRIDE; | |
| 62 | 60 |
| 63 // VideoStub implementation. | 61 // VideoStub implementation. |
| 64 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, | 62 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, |
| 65 const base::Closure& done) OVERRIDE; | 63 const base::Closure& done) OVERRIDE; |
| 66 | 64 |
| 67 // Return the stats recorded by this client. | 65 // Return the stats recorded by this client. |
| 68 ChromotingStats* GetStats(); | 66 ChromotingStats* GetStats(); |
| 69 | 67 |
| 70 private: | 68 private: |
| 71 friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>; | 69 friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 84 // Callback method when a VideoPacket is processed. |decode_start| contains | 82 // Callback method when a VideoPacket is processed. |decode_start| contains |
| 85 // the timestamp when the packet will start to be processed. | 83 // the timestamp when the packet will start to be processed. |
| 86 void OnPacketDone(base::Time decode_start, const base::Closure& done); | 84 void OnPacketDone(base::Time decode_start, const base::Closure& done); |
| 87 | 85 |
| 88 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 86 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 89 scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner_; | 87 scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner_; |
| 90 scoped_refptr<FrameConsumerProxy> consumer_; | 88 scoped_refptr<FrameConsumerProxy> consumer_; |
| 91 scoped_ptr<VideoDecoder> decoder_; | 89 scoped_ptr<VideoDecoder> decoder_; |
| 92 | 90 |
| 93 // Remote screen size in pixels. | 91 // Remote screen size in pixels. |
| 94 webrtc::DesktopSize source_size_; | 92 SkISize source_size_; |
| 95 | 93 |
| 96 // Vertical and horizontal DPI of the remote screen. | 94 // Vertical and horizontal DPI of the remote screen. |
| 97 webrtc::DesktopVector source_dpi_; | 95 SkIPoint source_dpi_; |
| 98 | 96 |
| 99 // The current dimensions of the frame consumer view. | 97 // The current dimensions of the frame consumer view. |
| 100 webrtc::DesktopSize view_size_; | 98 SkISize view_size_; |
| 101 webrtc::DesktopRect clip_area_; | 99 SkIRect clip_area_; |
| 102 | 100 |
| 103 // The drawing buffers supplied by the frame consumer. | 101 // The drawing buffers supplied by the frame consumer. |
| 104 std::list<webrtc::DesktopFrame*> buffers_; | 102 std::list<webrtc::DesktopFrame*> buffers_; |
| 105 | 103 |
| 106 // Flag used to coalesce runs of SchedulePaint()s into a single DoPaint(). | 104 // Flag used to coalesce runs of SchedulePaint()s into a single DoPaint(). |
| 107 bool paint_scheduled_; | 105 bool paint_scheduled_; |
| 108 | 106 |
| 109 ChromotingStats stats_; | 107 ChromotingStats stats_; |
| 110 | 108 |
| 111 // Keep track of the most recent sequence number bounced back from the host. | 109 // Keep track of the most recent sequence number bounced back from the host. |
| 112 int64 latest_sequence_number_; | 110 int64 latest_sequence_number_; |
| 113 }; | 111 }; |
| 114 | 112 |
| 115 } // namespace remoting | 113 } // namespace remoting |
| 116 | 114 |
| 117 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_ | 115 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_ |
| OLD | NEW |