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