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

Unified Diff: remoting/protocol/webrtc_frame_scheduler_simple.h

Issue 2562893003: Limit target encoder bitrate change frequency in the frame scheduler. (Closed)
Patch Set: . Created 4 years 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/protocol/webrtc_connection_to_host.cc ('k') | remoting/protocol/webrtc_frame_scheduler_simple.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_frame_scheduler_simple.h
diff --git a/remoting/protocol/webrtc_frame_scheduler_simple.h b/remoting/protocol/webrtc_frame_scheduler_simple.h
index 12855d1cc4643311dda1c4faaaa75130c2bcea8e..413dabd84785467ebc7690c538c8fdd3986ce955 100644
--- a/remoting/protocol/webrtc_frame_scheduler_simple.h
+++ b/remoting/protocol/webrtc_frame_scheduler_simple.h
@@ -7,6 +7,8 @@
#include "remoting/protocol/webrtc_frame_scheduler.h"
+#include <queue>
+
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "remoting/base/leaky_bucket.h"
@@ -43,6 +45,22 @@ class WebrtcFrameSchedulerSimple : public VideoChannelStateObserver,
HostFrameStats* frame_stats) override;
private:
+ // Helper class used to calculate target encoder bitrate.
+ class EncoderBitrateFilter {
+ public:
+ EncoderBitrateFilter();
+ ~EncoderBitrateFilter();
+
+ void SetBandwidthEstimate(int bandwidth_kbps, base::TimeTicks now);
+ int GetTargetBitrateKbps(webrtc::DesktopSize size, base::TimeTicks now);
+
+ private:
+ std::queue<std::pair<base::TimeTicks, int>> bandwidth_samples_;
+ int bandwidth_samples_sum_ = 0;
+
+ int current_target_bitrate_;
+ };
+
void ScheduleNextFrame(base::TimeTicks now);
void CaptureNextFrame();
@@ -54,6 +72,8 @@ class WebrtcFrameSchedulerSimple : public VideoChannelStateObserver,
LeakyBucket pacing_bucket_;
+ EncoderBitrateFilter encoder_bitrate_;
+
// Set to true when a frame is being captured or encoded.
bool frame_pending_ = false;
« no previous file with comments | « remoting/protocol/webrtc_connection_to_host.cc ('k') | remoting/protocol/webrtc_frame_scheduler_simple.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698