Chromium Code Reviews| 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 = -1; | |
| 27 base::TimeDelta duration; | |
| 28 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
| |
| 29 bool key_frame = false; | |
| 30 int vpx_min_quantizer = -1; | |
| 31 int vpx_max_quantizer = -1; | |
| 32 }; | |
| 33 | |
| 34 struct EncodedFrame { | |
| 35 webrtc::DesktopSize size; | |
| 36 std::string data; | |
| 37 bool key_frame; | |
| 38 int quantizer; | |
| 39 }; | |
| 40 | |
| 41 virtual ~WebrtcVideoEncoder() {} | |
| 42 | |
| 43 // Encode an image stored in |frame|. If |frame.updated_region()| is empty | |
| 44 // then the encoder may return a packet (e.g. to top-off previously-encoded | |
| 45 // portions of the frame to higher quality) or return nullptr to indicate that | |
| 46 // there is no work to do. | |
| 47 virtual std::unique_ptr<EncodedFrame> Encode( | |
| 48 const webrtc::DesktopFrame& frame, | |
| 49 const FrameParams& param) = 0; | |
| 50 }; | |
| 51 | |
| 52 } // namespace remoting | |
| 53 | |
| 54 #endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_H_ | |
| OLD | NEW |