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

Unified Diff: remoting/protocol/webrtc_frame_scheduler_simple.h

Issue 2335923002: Add WebrtcCaptureScheduler interface. (Closed)
Patch Set: include <algorithm> 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/protocol/webrtc_frame_scheduler.h ('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
new file mode 100644
index 0000000000000000000000000000000000000000..17a1f0017b817d30ededb04e642b3a68a40912e8
--- /dev/null
+++ b/remoting/protocol/webrtc_frame_scheduler_simple.h
@@ -0,0 +1,56 @@
+// 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_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_
+#define REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_
+
+#include "remoting/protocol/webrtc_frame_scheduler.h"
+
+#include "base/timer/timer.h"
+
+namespace remoting {
+namespace protocol {
+
+// WebrtcFrameSchedulerSimple is a simple implementation of
+// WebrtcFrameScheduler that always keeps only one frame in the pipeline.
+// It schedules each frame after the previous one is expected to finish sending.
+class WebrtcFrameSchedulerSimple : public WebrtcFrameScheduler {
+ public:
+ WebrtcFrameSchedulerSimple();
+ ~WebrtcFrameSchedulerSimple() override;
+
+ // WebrtcFrameScheduler implementation.
+ void Start(const base::Closure& capture_callback) override;
+ void Pause(bool pause) override;
+ void SetKeyFrameRequest() override;
+ void SetTargetBitrate(int bitrate_kbps) override;
+ bool GetEncoderFrameParams(
+ const webrtc::DesktopFrame& frame,
+ WebrtcVideoEncoder::FrameParams* params_out) override;
+ void OnFrameEncoded(
+ const WebrtcVideoEncoder::EncodedFrame& encoded_frame,
+ const webrtc::EncodedImageCallback::Result& send_result) override;
+
+ private:
+ void ScheduleNextFrame();
+ void CaptureNextFrame();
+
+ base::Closure capture_callback_;
+ bool paused_ = false;
+ bool key_frame_request_ = false;
+ uint32_t target_bitrate_kbps_ = 1000; // Initial bitrate.
+
+ base::TimeTicks last_capture_started_time_;
+ base::TimeTicks last_frame_send_finish_time_;
+
+ // Set to true when encoding unchanged frames for top-off.
+ bool top_off_is_active_ = false;
+
+ base::OneShotTimer capture_timer_;
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_
« no previous file with comments | « remoting/protocol/webrtc_frame_scheduler.h ('k') | remoting/protocol/webrtc_frame_scheduler_simple.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698