Chromium Code Reviews| Index: remoting/codec/webrtc_video_encoder.h |
| diff --git a/remoting/codec/webrtc_video_encoder.h b/remoting/codec/webrtc_video_encoder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..565e4b3206864a8150f17867c871ad1d6d68c51e |
| --- /dev/null |
| +++ b/remoting/codec/webrtc_video_encoder.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_ |
| +#define REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <memory> |
| + |
| +#include "base/time/time.h" |
| +#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| + |
| +namespace webrtc { |
| +class DesktopFrame; |
| +} // namespace webrtc |
| + |
| +namespace remoting { |
| + |
| +// A class to perform the task of encoding a continuous stream of images. The |
| +// interface is asynchronous to enable maximum throughput. |
| +class WebrtcVideoEncoder { |
| + public: |
| + struct FrameParams { |
| + int bitrate_kbps = -1; |
| + base::TimeDelta duration; |
| + bool clear_active_map = false; |
|
Irfan
2016/09/12 22:55:30
It seems some of these are not used anywhere ? Can
Sergey Ulanov
2016/09/12 23:05:23
Yes. Moved these fields to the follow-up CL where
|
| + bool key_frame = false; |
| + int vpx_min_quantizer = -1; |
| + int vpx_max_quantizer = -1; |
| + }; |
| + |
| + struct EncodedFrame { |
| + webrtc::DesktopSize size; |
| + std::string data; |
| + bool key_frame; |
| + int quantizer; |
| + }; |
| + |
| + virtual ~WebrtcVideoEncoder() {} |
| + |
| + // Encode an image stored in |frame|. If |frame.updated_region()| is empty |
| + // then the encoder may return a packet (e.g. to top-off previously-encoded |
| + // portions of the frame to higher quality) or return nullptr to indicate that |
| + // there is no work to do. |
| + virtual std::unique_ptr<EncodedFrame> Encode( |
| + const webrtc::DesktopFrame& frame, |
| + const FrameParams& param) = 0; |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_ |