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

Unified Diff: remoting/codec/webrtc_video_encoder.h

Issue 2329653002: Add WebrtcVideoEncoder interface (Closed)
Patch Set: win 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/codec/video_encoder_vpx_unittest.cc ('k') | remoting/codec/webrtc_video_encoder_vpx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3b56a455bd95efd822d7d6ccd98723b3e971ed90
--- /dev/null
+++ b/remoting/codec/webrtc_video_encoder.h
@@ -0,0 +1,51 @@
+// 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;
+ base::TimeDelta duration;
+ bool key_frame;
+ };
+
+ 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_
« no previous file with comments | « remoting/codec/video_encoder_vpx_unittest.cc ('k') | remoting/codec/webrtc_video_encoder_vpx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698