Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_WEBRTC_CAPTURE_SCHEDULER_SIMPLE_H_ | |
| 6 #define REMOTING_PROTOCOL_WEBRTC_CAPTURE_SCHEDULER_SIMPLE_H_ | |
| 7 | |
| 8 #include "remoting/protocol/webrtc_capture_scheduler.h" | |
| 9 | |
| 10 #include "base/timer/timer.h" | |
| 11 | |
| 12 namespace remoting { | |
| 13 namespace protocol { | |
| 14 | |
| 15 // WebrtcCaptureSchedulerSimple is a simple implementation of | |
| 16 // WebrtcCaptureScheduler that always keeps only one frame in the pipeline. | |
| 17 // 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.
| |
| 18 // the sender. | |
| 19 class WebrtcCaptureSchedulerSimple : public WebrtcCaptureScheduler { | |
| 20 public: | |
| 21 WebrtcCaptureSchedulerSimple(); | |
| 22 ~WebrtcCaptureSchedulerSimple() override; | |
| 23 | |
| 24 // WebrtcCaptureScheduler implementation. | |
| 25 void Start(const base::Closure& capture_callback) override; | |
| 26 void Pause(bool pause) override; | |
| 27 void SetKeyFrameRequest() override; | |
| 28 void SetTargetBitrate(int bitrate_kbps) override; | |
| 29 bool GetEncoderFrameParams( | |
| 30 const webrtc::DesktopFrame& frame, | |
| 31 WebrtcVideoEncoder::FrameParams* params_out) override; | |
| 32 void OnFrameEncoded( | |
| 33 const WebrtcVideoEncoder::EncodedFrame& encoded_frame, | |
| 34 const webrtc::EncodedImageCallback::Result& send_result) override; | |
| 35 | |
| 36 private: | |
| 37 void ScheduleNextFrame(); | |
| 38 void CaptureNextFrame(); | |
| 39 | |
| 40 base::Closure capture_callback_; | |
| 41 bool paused_ = false; | |
| 42 bool key_frame_request_ = false; | |
| 43 uint32_t target_bitrate_kbps_ = 1000; // Initial bitrate. | |
| 44 | |
| 45 base::TimeTicks last_capture_started_time_; | |
| 46 base::TimeTicks last_frame_send_finish_time_; | |
| 47 | |
| 48 // Set to true when encoding unchanged frames for top-off. | |
| 49 bool top_off_is_active_ = false; | |
| 50 | |
| 51 base::OneShotTimer capture_timer_; | |
| 52 }; | |
| 53 | |
| 54 } // namespace protocol | |
| 55 } // namespace remoting | |
| 56 | |
| 57 #endif // REMOTING_PROTOCOL_WEBRTC_CAPTURE_SCHEDULER_SIMPLE_H_ | |
| OLD | NEW |