OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #ifndef REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_ |
| 6 #define REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #include "base/time/time.h" |
| 13 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 14 |
| 15 namespace webrtc { |
| 16 class DesktopFrame; |
| 17 } // namespace webrtc |
| 18 |
| 19 namespace remoting { |
| 20 |
| 21 // A class to perform the task of encoding a continuous stream of images. The |
| 22 // interface is asynchronous to enable maximum throughput. |
| 23 class WebrtcVideoEncoder { |
| 24 public: |
| 25 struct FrameParams { |
| 26 int bitrate_kbps; |
| 27 base::TimeDelta duration; |
| 28 bool key_frame; |
| 29 }; |
| 30 |
| 31 struct EncodedFrame { |
| 32 webrtc::DesktopSize size; |
| 33 std::string data; |
| 34 bool key_frame; |
| 35 int quantizer; |
| 36 }; |
| 37 |
| 38 virtual ~WebrtcVideoEncoder() {} |
| 39 |
| 40 // Encode an image stored in |frame|. If |frame.updated_region()| is empty |
| 41 // then the encoder may return a packet (e.g. to top-off previously-encoded |
| 42 // portions of the frame to higher quality) or return nullptr to indicate that |
| 43 // there is no work to do. |
| 44 virtual std::unique_ptr<EncodedFrame> Encode( |
| 45 const webrtc::DesktopFrame& frame, |
| 46 const FrameParams& param) = 0; |
| 47 }; |
| 48 |
| 49 } // namespace remoting |
| 50 |
| 51 #endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_ |
OLD | NEW |