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

Unified Diff: remoting/protocol/webrtc_video_encoder.h

Issue 1908203002: Adapt encoder behavior to target bitrate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/protocol/webrtc_video_encoder.h
diff --git a/remoting/protocol/webrtc_video_encoder.h b/remoting/protocol/webrtc_video_encoder.h
index 0a32957d2de200171166e4c0ddf4d5214d7def8a..84c850cc78902b5e9ba6be42c54b897fb6edf104 100644
--- a/remoting/protocol/webrtc_video_encoder.h
+++ b/remoting/protocol/webrtc_video_encoder.h
@@ -16,6 +16,8 @@
namespace remoting {
+using TargetBitrateCallback = base::Callback<void(uint32_t)>;
+
// This is the interface between the WebRtc engine and the external encoder
// provided by remoting. WebRtc provides feedback on network bandwidth, latency
// & RTT and in turn remoting passes encoded frames as they get encoded
@@ -42,16 +44,18 @@ class WebRtcVideoEncoder : public webrtc::VideoEncoder {
int SendEncodedFrame(int64_t capture_timestamp_ms,
std::unique_ptr<VideoPacket> pkt);
void SetKeyFrameRequestCallback(const base::Closure& key_frame_request);
+ void SetTargetBitrateCallback(const TargetBitrateCallback& target_bitrate_cb);
private:
- // Protects |encoded_callback_|, |key_frame_request_| and |state_|.
+ // Protects |encoded_callback_|, |key_frame_request_|,
+ // |target_bitrate_cb_| and |state_|.
base::Lock lock_;
State state_;
webrtc::EncodedImageCallback* encoded_callback_;
base::Closure key_frame_request_;
+ TargetBitrateCallback target_bitrate_cb_;
webrtc::VideoCodecType video_codec_type_;
- uint32_t target_bitrate_;
};
// This is the external encoder factory implementation that is passed to
@@ -75,11 +79,13 @@ class WebRtcVideoEncoderFactory : public cricket::WebRtcVideoEncoderFactory {
std::unique_ptr<VideoPacket> pkt);
void SetKeyFrameRequestCallback(const base::Closure& key_frame_request);
+ void SetTargetBitrateCallback(const TargetBitrateCallback& target_bitrate_cb);
private:
- // Protects |key_frame_request_|.
+ // Protects |key_frame_request_| and |target_bitrate_cb_|.
base::Lock lock_;
base::Closure key_frame_request_;
+ TargetBitrateCallback target_bitrate_cb_;
std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec> codecs_;
std::vector<std::unique_ptr<WebRtcVideoEncoder>> encoders_;
};

Powered by Google App Engine
This is Rietveld 408576698