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_CODEC_VIDEO_ENCODER_VERBATIM_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ |
6 #define REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ | 6 #define REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ |
7 | 7 |
8 #include "base/time/time.h" | |
9 #include "remoting/codec/video_encoder.h" | 8 #include "remoting/codec/video_encoder.h" |
10 #include "remoting/proto/video.pb.h" | 9 #include "remoting/proto/video.pb.h" |
11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
12 | 11 |
13 namespace remoting { | 12 namespace remoting { |
14 | 13 |
15 // VideoEncoderVerbatim implements a VideoEncoder that sends image data as a | 14 // VideoEncoderVerbatim implements a VideoEncoder that sends image data as a |
16 // sequence of RGB values, without compression. | 15 // sequence of RGB values, without compression. |
17 class VideoEncoderVerbatim : public VideoEncoder { | 16 class VideoEncoderVerbatim : public VideoEncoder { |
18 public: | 17 public: |
19 VideoEncoderVerbatim(); | 18 VideoEncoderVerbatim(); |
20 virtual ~VideoEncoderVerbatim(); | 19 virtual ~VideoEncoderVerbatim(); |
21 | 20 |
22 // Sets maximum size of data in video packets. Used by unittests. | |
23 void SetMaxPacketSize(int size); | |
24 | |
25 // VideoEncoder interface. | 21 // VideoEncoder interface. |
26 virtual void Encode( | 22 virtual scoped_ptr<VideoPacket> Encode( |
27 const webrtc::DesktopFrame* frame, | 23 const webrtc::DesktopFrame& frame) OVERRIDE; |
28 const DataAvailableCallback& data_available_callback) OVERRIDE; | |
29 | 24 |
30 private: | 25 private: |
31 // Encode a single dirty |rect|. | |
32 void EncodeRect(const webrtc::DesktopFrame* frame, | |
33 const webrtc::DesktopRect& rect, | |
34 bool last); | |
35 | |
36 // Initializes first packet in a sequence of video packets to update screen | |
37 // rectangle |rect|. | |
38 void PrepareUpdateStart(const webrtc::DesktopFrame* frame, | |
39 const webrtc::DesktopRect& rect, | |
40 VideoPacket* packet); | |
41 | |
42 // Allocates a buffer of the specified |size| inside |packet| and returns the | 26 // Allocates a buffer of the specified |size| inside |packet| and returns the |
43 // pointer to it. | 27 // pointer to it. |
44 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); | 28 uint8* GetOutputBuffer(VideoPacket* packet, size_t size); |
45 | 29 |
46 // Submit |packet| to |callback_|. | |
47 void SubmitMessage(VideoPacket* packet, size_t rect_index); | |
48 | |
49 DataAvailableCallback callback_; | |
50 base::Time encode_start_time_; | |
51 | |
52 // The most recent screen size. | 30 // The most recent screen size. |
Wez
2013/09/12 14:20:15
nit: Suggest "Used to re-send screen-size only whe
Sergey Ulanov
2013/09/12 19:18:45
Done.
| |
53 webrtc::DesktopSize screen_size_; | 31 webrtc::DesktopSize screen_size_; |
54 | |
55 int max_packet_size_; | |
56 }; | 32 }; |
57 | 33 |
58 } // namespace remoting | 34 } // namespace remoting |
59 | 35 |
60 #endif // REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ | 36 #endif // REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_ |
OLD | NEW |