Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: remoting/codec/webrtc_video_encoder.h

Issue 2335923002: Add WebrtcCaptureScheduler interface. (Closed)
Patch Set: include <algorithm> Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | remoting/codec/webrtc_video_encoder_vpx.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Target bitrate in kilobits per second.
27 int bitrate_kbps = -1;
28
29 // Frame duration.
27 base::TimeDelta duration; 30 base::TimeDelta duration;
28 bool key_frame; 31
32 // If set to true then the active map passed to the encoder will only
33 // contain updated_region() from the current frame. Otherwise the active map
34 // is not cleared before adding updated_region(), which means it will
35 // contain union of updated_region() from all frames since this flag was
36 // last set. This flag is used to top-off video quality with VP8.
37 bool clear_active_map = false;
38
39 // Indicates that the encoder should encode this frame as a key frame.
40 bool key_frame = false;
41
42 // Quantization parameters for the encoder.
43 int vpx_min_quantizer = -1;
44 int vpx_max_quantizer = -1;
29 }; 45 };
30 46
31 struct EncodedFrame { 47 struct EncodedFrame {
32 webrtc::DesktopSize size; 48 webrtc::DesktopSize size;
33 std::string data; 49 std::string data;
34 bool key_frame; 50 bool key_frame;
35 int quantizer; 51 int quantizer;
36 }; 52 };
37 53
38 virtual ~WebrtcVideoEncoder() {} 54 virtual ~WebrtcVideoEncoder() {}
39 55
40 // Encode an image stored in |frame|. If |frame.updated_region()| is empty 56 // 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 57 // 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 58 // portions of the frame to higher quality) or return nullptr to indicate that
43 // there is no work to do. 59 // there is no work to do.
44 virtual std::unique_ptr<EncodedFrame> Encode( 60 virtual std::unique_ptr<EncodedFrame> Encode(
45 const webrtc::DesktopFrame& frame, 61 const webrtc::DesktopFrame& frame,
46 const FrameParams& param) = 0; 62 const FrameParams& param) = 0;
47 }; 63 };
48 64
49 } // namespace remoting 65 } // namespace remoting
50 66
51 #endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_ 67 #endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/codec/webrtc_video_encoder_vpx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698