Chromium Code Reviews| Index: remoting/protocol/webrtc_capture_scheduler_simple.h |
| diff --git a/remoting/protocol/webrtc_capture_scheduler_simple.h b/remoting/protocol/webrtc_capture_scheduler_simple.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ede3a1bd7b9800ba2078879d45f4b1ce7cb2d4de |
| --- /dev/null |
| +++ b/remoting/protocol/webrtc_capture_scheduler_simple.h |
| @@ -0,0 +1,57 @@ |
| +// 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_CAPTURE_SCHEDULER_SIMPLE_H_ |
| +#define REMOTING_PROTOCOL_WEBRTC_CAPTURE_SCHEDULER_SIMPLE_H_ |
| + |
| +#include "remoting/protocol/webrtc_capture_scheduler.h" |
| + |
| +#include "base/timer/timer.h" |
| + |
| +namespace remoting { |
| +namespace protocol { |
| + |
| +// WebrtcCaptureSchedulerSimple is a simple implementation of |
| +// WebrtcCaptureScheduler that always keeps only one frame in the pipeline. |
| +// It schedules each frame after the previous one is expected to finish sending |
|
Irfan
2016/09/14 20:01:29
s/finish sending the sender/finish sending/ ?
Sergey Ulanov
2016/09/16 00:02:47
Done.
|
| +// the sender. |
| +class WebrtcCaptureSchedulerSimple : public WebrtcCaptureScheduler { |
| + public: |
| + WebrtcCaptureSchedulerSimple(); |
| + ~WebrtcCaptureSchedulerSimple() override; |
| + |
| + // WebrtcCaptureScheduler 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_CAPTURE_SCHEDULER_SIMPLE_H_ |