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

Unified Diff: remoting/codec/webrtc_video_encoder_vpx.h

Issue 1908203002: Adapt encoder behavior to target bitrate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved webrtc encoder to its own file Created 4 years, 7 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
Index: remoting/codec/webrtc_video_encoder_vpx.h
diff --git a/remoting/codec/video_encoder_vpx.h b/remoting/codec/webrtc_video_encoder_vpx.h
similarity index 75%
copy from remoting/codec/video_encoder_vpx.h
copy to remoting/codec/webrtc_video_encoder_vpx.h
index a6701093b2cba402396c217b20cb9317614e9c16..f551c45045d17821cd74c960083818b8b9680a0c 100644
--- a/remoting/codec/video_encoder_vpx.h
+++ b/remoting/codec/webrtc_video_encoder_vpx.h
@@ -1,9 +1,9 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// 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_VIDEO_ENCODER_VPX_H_
-#define REMOTING_CODEC_VIDEO_ENCODER_VPX_H_
+#ifndef REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_
+#define REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_
#include <stdint.h>
@@ -14,6 +14,7 @@
#include "remoting/codec/scoped_vpx_codec.h"
#include "remoting/codec/video_encoder.h"
#include "remoting/codec/video_encoder_helper.h"
+#include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h"
typedef struct vpx_image vpx_image_t;
@@ -24,13 +25,16 @@ class DesktopSize;
namespace remoting {
-class VideoEncoderVpx : public VideoEncoder {
+// This is a copy of VideoEncoderVpx with enhancements to encoder for use
+// over WebRTC as transport. The original VideoEncoderVpx should be deleted
+// once the old implementation is no longer in use.
+class WebRtcVideoEncoderVpx : public VideoEncoder {
public:
// Create encoder for the specified protocol.
- static std::unique_ptr<VideoEncoderVpx> CreateForVP8();
- static std::unique_ptr<VideoEncoderVpx> CreateForVP9();
+ static std::unique_ptr<WebRtcVideoEncoderVpx> CreateForVP8();
+ static std::unique_ptr<WebRtcVideoEncoderVpx> CreateForVP9();
- ~VideoEncoderVpx() override;
+ ~WebRtcVideoEncoderVpx() override;
void SetTickClockForTests(base::TickClock* tick_clock);
@@ -39,9 +43,10 @@ class VideoEncoderVpx : public VideoEncoder {
void SetLosslessColor(bool want_lossless) override;
std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame,
uint32_t flags) override;
+ void UpdateTargetBitrate(uint32_t bitrate) override;
private:
- explicit VideoEncoderVpx(bool use_vp9);
+ explicit WebRtcVideoEncoderVpx(bool use_vp9);
// (Re)Configures this instance to encode frames of the specified |size|,
// with the configured lossless color & encoding modes.
@@ -71,6 +76,9 @@ class VideoEncoderVpx : public VideoEncoder {
// Holds the initialized & configured codec.
ScopedVpxCodec codec_;
+ vpx_codec_enc_cfg_t config_;
+ uint32_t target_bitrate_kbps_;
+
// Used to generate zero-based frame timestamps.
base::TimeTicks timestamp_base_;
@@ -91,9 +99,9 @@ class VideoEncoderVpx : public VideoEncoder {
base::DefaultTickClock default_tick_clock_;
base::TickClock* clock_;
- DISALLOW_COPY_AND_ASSIGN(VideoEncoderVpx);
+ DISALLOW_COPY_AND_ASSIGN(WebRtcVideoEncoderVpx);
};
} // namespace remoting
-#endif // REMOTING_CODEC_VIDEO_ENCODER_VPX_H_
+#endif // REMOTING_CODEC_WEBRTC_VIDEO_ENCODER_VPX_H_

Powered by Google App Engine
This is Rietveld 408576698