Remove redundant deinitialization code from HttpCache::Transaction.
[chromium-blink-merge.git] / remoting / codec / video_encoder_verbatim.h
blobf2078fce6711e6852dfd92c6999f1d504c878017
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_
6 #define REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_
8 #include "base/time/time.h"
9 #include "remoting/codec/video_encoder.h"
10 #include "remoting/proto/video.pb.h"
11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
13 namespace remoting {
15 // VideoEncoderVerbatim implements a VideoEncoder that sends image data as a
16 // sequence of RGB values, without compression.
17 class VideoEncoderVerbatim : public VideoEncoder {
18 public:
19 VideoEncoderVerbatim();
20 virtual ~VideoEncoderVerbatim();
22 // Sets maximum size of data in video packets. Used by unittests.
23 void SetMaxPacketSize(int size);
25 // VideoEncoder interface.
26 virtual void Encode(
27 const webrtc::DesktopFrame* frame,
28 const DataAvailableCallback& data_available_callback) OVERRIDE;
30 private:
31 // Encode a single dirty |rect|.
32 void EncodeRect(const webrtc::DesktopFrame* frame,
33 const webrtc::DesktopRect& rect,
34 bool last);
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);
42 // Allocates a buffer of the specified |size| inside |packet| and returns the
43 // pointer to it.
44 uint8* GetOutputBuffer(VideoPacket* packet, size_t size);
46 // Submit |packet| to |callback_|.
47 void SubmitMessage(VideoPacket* packet, size_t rect_index);
49 DataAvailableCallback callback_;
50 base::Time encode_start_time_;
52 // The most recent screen size.
53 webrtc::DesktopSize screen_size_;
55 int max_packet_size_;
58 } // namespace remoting
60 #endif // REMOTING_CODEC_VIDEO_ENCODER_VERBATIM_H_